Re: git-diff: must --exit-code work with --ignore* options?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Thell Fowler
Date: Tuesday, September 8, 2009 - 1:58 pm

On Sun, 30 Aug 2009, Junio C Hamano wrote:


Perhaps I'm expected something different than what I _should_ be 
expecting, but shouldn't --quiet always return the same as --exit-code?

# Cut/Paste example
mkdir test_ws_quiet && cd test_ws_quiet && git init
printf "foo bar  \n\n" >f1.txt
git add .
git commit -m 'f text'
printf "foo  bar\n\n" >f1.txt
git commit -a -m 'f with diff white-space in middle & end'
git diff -w --exit-code HEAD^ >/dev/null
echo $?
# returns '0' which it should
git diff -w --quiet HEAD^
echo $?
# returns '0' which it should
git diff -b --exit-code HEAD^ >/dev/null
echo $?
# returns '0' which it should
git diff -b --quiet HEAD^ >/dev/null
echo $?
# returns '0' which it should
git diff --ignore-space-at-eol --exit-code HEAD^ >/dev/null
echo $?
# returns '1' which it should
git diff --ignore-space-at-eol --quiet HEAD^
echo $?
#returns '0' <=== Unexpected.

#
# Next phase
#
printf "foobar\n\n">f1.txt
git commit -a -m 'f without any spaces'
git diff -w --exit-code HEAD^ >/dev/null
echo $?
# returns '0' which it should
git diff -w --quiet HEAD^
echo $?
# returns '0' which it should
git diff -b --exit-code HEAD^ >/dev/null
echo $?
# returns '1' which it should
git diff -b --quiet HEAD^ >/dev/null
echo $?
# returns '0' <=== Unexpected
git diff --ignore-space-at-eol --exit-code HEAD^ >/dev/null
echo $?
# returns '1' which it should
git diff --ignore-space-at-eol --quiet HEAD^
echo $?
#returns '0' <=== Unexpected.

-- 
Thell
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git-diff: must --exit-code work with --ignore* options?, Jim Meyering, (Fri May 22, 7:01 am)
Re: git-diff: must --exit-code work with --ignore* options?, Thell Fowler, (Tue Sep 8, 1:58 pm)