Re: [PATCH 2/2] git-rebase--interactive: auto amend only edited commit

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

 



On Tue, Sep 09, 2008 at 08:42:57AM +0200, Johannes Sixt wrote:
> Dmitry Potapov schrieb:
> > Another problem is that after being stopped at "edit", the user adds new
> > commits. In this case, automatic amend behavior of git rebase triggered
> > by some stage changes causes that not only that the log message of the
> > last commit is lost but that it will contain also wrong Author and Date
> > information.
> > 
> > Therefore, this patch restrict automatic amend only to the situation
> > where HEAD is the commit at which git rebase stop by "edit" command.
> ...
> > @@ -430,6 +430,8 @@ do
> >  			if test -f "$DOTEST"/amend
> >  			then
> >  				amend=$(git rev-parse --verify HEAD)
> > +				test "$amend" = $(cat "$DOTEST"/amend) ||
> > +				die "You have uncommitted changes"
> 
> Doesn't this terse message carry a bit of a "WTF?" factor?

Agreed. However, the current message in the case when you have some
unstaged changes in your working tree is not much better:
  "Working tree is dirty"

> In other
> situations rebase --continue goes into git-commit just fine, but it does
> not under these special conditions. How about this:
> 
> "Will not auto-commit uncommitted changes after you have already committed
> something. Please run 'git commit --amend' yourself."

I don't think this is the right suggestion. In cases that I mentioned above
(and in some others), you may want to run 'git commit' *without* --amend.
Only user may know how those changes should be committed. Giving him/her
a direct instruction to run some specific command will produce the wrong
result in half cases. So, how about this:

"You have uncommitted changes in your working tree. Please, commit them
first and then run 'git rebase --continue' again."

or if you want to describe the cause why auto-commit does not work:

"Will not auto-commit uncommitted changes after you have already committed
something. Please commit them first and then run 'git rebase --continue'
again."

Personally, I believe those words about auto-commit is not very helpful.
Auto-commit-on-edit feature is undocumented. So, those words may be more
confusing than helpful, because the user starts thinking what this auto-
commit means, while the real question here is whether changes should be
committed with --amend or without it.

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

[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