Junio C Hamano <gitster@xxxxxxxxx> writes: > David Kastrup <dak@xxxxxxx> 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? Possibly: I haven't checked the underlying code for the details. At any rate, it is an option git log accepts for whatever reason. -- David Kastrup -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html