Documentation: git log: --exit-code undocumented?
Hello,
$ git help log | grep exit-code
problems are found. Not compatible with --exit-code.
$What --exit-code does in "git log"?
Signature · 1 line
Sergey.
Quoted 7 lines · Sergey Organov
Hello,
$ git help log | grep exit-code problems are found. Not compatible with --exit-code. $What --exit-code does in "git log"?
It doesn't. That is why it is not listed.
Quoted 11 lines · Junio C Hamano
Quoted 7 lines · Sergey Organov
Hello,
$ git help log | grep exit-code problems are found. Not compatible with --exit-code. $What --exit-code does in "git log"?
It doesn't. That is why it is not listed.
I disagree that --exit-code does nothing: it indicates whether the listed log is empty. So for example
git log -1 --exit-code a..b > /dev/null
can be used to figure out whether "a" is a proper ancestor of "b" or not.
Signature · 1 line
David Kastrup
Quoted 7 lines · David Kastrup
I disagree that --exit-code does nothing: it indicates whether the listed log is empty. So for example
git log -1 --exit-code a..b >
/dev/nullcan be used to figure out whether "a" is a proper ancestor of "b" or not.
Hmph.
$ git log --exit-code master..maint >/dev/null; echo $?
0
$ git log --exit-code maint..master >/dev/null; echo $?
1That is a strange way to use --exit-code. I suspect that if you did this, you will get 0 from the log between HEAD~..HEAD
$ git checkout master^0
$ git commit --allow-empty -m empty
$ git log --exit-code HEAD~..HEADeven though HEAD~ is a proper ancestor of HEAD, so it is not giving us anything useful. Isn't it a mere artifact that "log" happens to share the underlying machinery with "diff" that --exit-code shows a non-zero exit when there is any single commit in the range that has any change?
Quoted 10 lines · Junio C Hamano
Quoted 7 lines · David Kastrup
I disagree that --exit-code does nothing: it indicates whether the listed log is empty. So for example
git log -1 --exit-code a..b >
/dev/nullcan be used to figure out whether "a" is a proper ancestor of "b" or not.
Quoted 8 lines
Hmph.
$ git log --exit-code master..maint >/dev/null; echo $? 0 $ git log --exit-code maint..master >/dev/null; echo $? 1That is a strange way to use --exit-code.
What's the best way then to tell if "a" is an ancestor of "b"?
Signature · 1 line
Sergey.
Quoted 14 lines · Sergey Organov
Quoted 12 lines · Junio C Hamano
Quoted 7 lines · David Kastrup
I disagree that --exit-code does nothing: it indicates whether the listed log is empty. So for example
git log -1 --exit-code a..b >
/dev/nullcan be used to figure out whether "a" is a proper ancestor of "b" or not.
Hmph.
Quoted 8 lines
Quoted 6 lines
$ git log --exit-code master..maint >/dev/null; echo $? 0 $ git log --exit-code maint..master >/dev/null; echo $? 1That is a strange way to use --exit-code.
What's the best way then to tell if "a" is an ancestor of "b"?
git merge-base --is-ancestor a b
Quoted 24 lines · Junio C Hamano
Quoted 7 lines · David Kastrup
I disagree that --exit-code does nothing: it indicates whether the listed log is empty. So for example
git log -1 --exit-code a..b >
/dev/nullcan be used to figure out whether "a" is a proper ancestor of "b" or not.
Hmph.
$ git log --exit-code master..maint >/dev/null; echo $? 0 $ git log --exit-code maint..master >/dev/null; echo $? 1That is a strange way to use --exit-code. I suspect that if you did this, you will get 0 from the log between HEAD~..HEAD
$ git checkout master^0 $ git commit --allow-empty -m empty $ git log --exit-code HEAD~..HEAD
Quoted 5 lines
even though HEAD~ is a proper ancestor of HEAD, so it is not giving us anything useful. Isn't it a mere artifact that "log" happens to share the underlying machinery with "diff" that --exit-code shows a non-zero exit when there is any single commit in the range that has any change?
Possibly: I haven't checked the underlying code for the details. At any rate, it is an option git log accepts for whatever reason.
Signature · 1 line
David Kastrup
Quoted 11 lines · Junio C Hamano
Quoted 7 lines · Sergey Organov
Hello,
$ git help log | grep exit-code problems are found. Not compatible with --exit-code. $What --exit-code does in "git log"?
It doesn't. That is why it is not listed.
Then, how can --check possibly interfer with it?
Signature · 1 line
Sergey.
Quoted 10 lines · Sergey Organov
Quoted 8 lines · Junio C Hamano
Quoted 6 lines · Sergey Organov
Hello,
$ git help log | grep exit-code problems are found. Not compatible with --exit-code. $
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
What --exit-code does in "git log"?
It doesn't. That is why it is not listed.
Then, how can --check possibly interfer with it?
The description is shared with "git diff" and friends, which is invoked via "git log -p". As "log" does not give the exit code of individual "diff-tree" invocation for each commit, --exit-code option is irrelevant.
Quoted 14 lines · Junio C Hamano
Quoted 12 lines · Sergey Organov
Quoted 10 lines · Junio C Hamano
Quoted 7 lines · Sergey Organov
Hello,
$ git help log | grep exit-code problems are found. Not compatible with --exit-code. $What --exit-code does in "git log"?
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
It doesn't. That is why it is not listed.
Then, how can --check possibly interfer with it?
The description is shared with "git diff" and friends, which is invoked via "git log -p". As "log" does not give the exit code of individual "diff-tree" invocation for each commit, --exit-code option is irrelevant.
Do you agree there is some minor problem here? First, "git log" silently eats the --exit-code option that does nothing. Next, git-log manual page doesn't include --exit-log description while refers to it elsewhere. What's proposed resulution?
Signature · 1 line
Sergey.