Re: [PATCH 1/2] git-commit: Disallow unchanged tree in non-merge mode

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Dmitry V. Levin <ldv@...>
Cc: Git Mailing List <git@...>, Junio C Hamano <gitster@...>
Date: Sunday, September 9, 2007 - 12:46 am

"Dmitry V. Levin" <ldv@altlinux.org> wrote:

OK, I was too rash on my original reply.  I think the change you
were going after was to try and prevent the user from ever keeping
a commit that has the same tree as its parent and which is not a
merge commit, as such commits are generally useless.

That's actually what I expect git-commit to be doing today, and if
it is not doing that then it really should be taught to be avoid it.
I guess that's what your patch was about.

So I take back my "NO".
 

Hmm.  I think you want something like this perhaps?

	if test "$tree" = "$current_tree"
	then
		if test z$amend = zt
		then
			echo >&2 "nothing to amend (use \"git reset --soft HEAD^\" to discard last commit)"
		else
			echo >&2 "nothing to commit"
		fi
	fi

Because there's this weird trick where you can amend the last commit
using a dirty index and in the process maybe cause the last commit
to have the same tree as his parent.  In such a case you would want
to discard the last commit instead of amending it.

But I have to also wonder, aside from the sick amend case I just
talked about, how does one get to this part of git-commit.sh with
nothing to commit?
 
-- 
Shawn.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 1/2] git-commit: Disallow unchanged tree in non-m..., Shawn O. Pearce, (Sun Sep 9, 12:46 am)