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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 09, 2007 at 12:46:48AM -0400, Shawn O. Pearce wrote:
> "Dmitry V. Levin" wrote:
[...]
> > Would "git reset --soft HEAD^" advice be better than first one?
> > Could you suggest a better message, please?
> 
> 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

Yes, something like this is better, thank you.

> 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?

This is necessary for the next (2/2) proposed change to git-commit:
I sometimes have to run git-commit without running costly git-runstatus.


-- 
ldv

Attachment: pgpBtUxFmDBef.pgp
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux