From: Junio C Hamano Date: Mon, 01 Dec 2014 17:49:25 GMT Subject: Re: [BUG] Documentation: git log: --exit-code undocumented? Message-ID: In-Reply-To: <874mtfl1hx.fsf@fencepost.gnu.org> David Kastrup writes: > 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. Hmph. $ git log --exit-code master..maint >/dev/null; echo $? 0 $ git log --exit-code maint..master >/dev/null; echo $? 1 That 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 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?