From: Junio C Hamano Date: Fri, 24 Feb 2006 05:56:29 GMT Subject: Re: FYI: git-am allows creation of empty commits. Message-ID: <7v1wxtgv02.fsf@assigned-by-dhcp.cox.net> In-Reply-To: ebiederm@xmission.com (Eric W. Biederman) writes: > After fixing it up and doing all of my edits I occasionally forget > the git-update-index step, before calling git-am --resolved. This > proceeds along it's merry way and creates an empty commit. Certainly a safty measure is missing here. Thanks for noticing. How about something like this? --- diff --git a/git-am.sh b/git-am.sh index 85ecada..6730813 100755 --- a/git-am.sh +++ b/git-am.sh @@ -300,10 +300,16 @@ do } >"$dotest/final-commit" ;; *) - case "$resolved,$interactive" in - tt) - # This is used only for interactive view option. + case "$resolved" in + t) + # This is used for interactive view option, but + # also we should see if the user really did + # something... git-diff-index -p --cached HEAD >"$dotest/patch" + test -s "$dotest/patch" || { + echo "You said resolved, but there is no change in the index..." + stop_here $this + } ;; esac esac