From: Martin von Zweigbergk Date: Sun, 09 Dec 2012 23:12:29 GMT Subject: Re: exit code from git reset Message-ID: In-Reply-To: <7vzk1mddzo.fsf@alter.siamese.dyndns.org> On Sun, Dec 9, 2012 at 3:04 PM, Junio C Hamano wrote: > Martin von Zweigbergk writes: > >> "git reset" currently returns 0 (if successful) while "git reset >> $pathspec" returns 0 iff the index matches HEAD after resetting (on >> all paths, not just those matching $pathspec). > > So in short, you observed that either of them reports with its exit > code if the resulting index (not just any subpart, but always the > entire thing) matches the HEAD, e.g. "do we have change that will be > listed on 'will be committed' section in git status output?" > > Sounds like one sane and consistent semantics to me. Heh, true, the behavior according to my description does make sense, it's just that my description was wrong; sorry :-(. What "git reset $pathspec" returns is not "whether HEAD differs from index" (as I wrote), but "whether worktree differs from index". So "git reset" and "git reset ." will return different exit codes if there are changes in the worktree as compared to HEAD before the invocation. I hope that's clearer.