]> git.ipfire.org Git - thirdparty/git.git/commit
diff --no-index: refuse to compare stdin to a directory
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 5 Jul 2023 19:49:27 +0000 (20:49 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Jul 2023 21:00:28 +0000 (14:00 -0700)
commit498198453dbb8ae46becbc83a1ef0979a0eb805d
tree17d45570180ca97e0cbb1b9106efe2aeda6e1150
parenta9e066fa63149291a55f383cfa113d8bdbdaa6b3
diff --no-index: refuse to compare stdin to a directory

When the user runs

    git diff --no-index file directory

we follow the behavior of POSIX diff and rewrite the arguments as

    git diff --no-index file directory/file

Doing that when "file" is "-" (which means "read from stdin") does not
make sense so we should error out if the user asks us to compare "-" to
a directory. This matches the behavior of GNU diff and diff on *BSD.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-no-index.c
t/t4053-diff-no-index.sh