Re: [PATCH/RFC] Allow empty commits during rebase -i

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH/RFC] Allow empty commits during rebase -i

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:03

Pete Harlan [off-list ref] writes:
I imagine an ideal version of this fix would make it so the use case I
presented here would work, but rebase -i would still prevent
introducing a new empty commit, or at least warn when it was
introducing one.  In the absence of that ideal fix, I think this
behavior is better than failing to handle this case.
Sorry, I actually tend to think that in the absense of that fix, your
version introduces risky behaviour that only a corner-case use case
benefits, and pros-and-cons doesn't look attractive enough.

Why not do something like:

    pick X a crap tree with a good message
    pick Y revert X
    pick Z a good tree with a crap message

-->

    # drop X
    # drop Y
    edit Z

and then run "git commit --amend -C X" when it is Z's turn to be
processed?

Re: [PATCH/RFC] Allow empty commits during rebase -i

From: Pete Harlan <hidden>
Date: 2016-06-15 22:48:03

On 01/17/2010 05:29 PM, Junio C Hamano wrote:
Pete Harlan [off-list ref] writes:
quoted
I imagine an ideal version of this fix would make it so the use case I
presented here would work, but rebase -i would still prevent
introducing a new empty commit, or at least warn when it was
introducing one.  In the absence of that ideal fix, I think this
behavior is better than failing to handle this case.
Sorry, I actually tend to think that in the absense of that fix, your
version introduces risky behaviour that only a corner-case use case
benefits, and pros-and-cons doesn't look attractive enough.

Why not do something like:

    pick X a crap tree with a good message
    pick Y revert X
    pick Z a good tree with a crap message

-->

    # drop X
    # drop Y
    edit Z

and then run "git commit --amend -C X" when it is Z's turn to be
processed?
That is another way to accomplish the same thing, but doesn't prevent
the current behavior from being confusing.

Part of the problem is that with the current behavior the user is sent
to the command line with:

  # Not currently on any branch.
  nothing to commit (working directory clean)

  Could not apply a0b17c5... Revert "Crap tree good message"

with HEAD pointed to X^.  Unsure of how to proceed from here, I
--aborted the rebase and copy/pasted the commit message I wanted and
resolved to track this down and fix it when I got a chance.

As it happens, "git rebase --continue" does exactly what I would have
wanted to happen, including putting me in an editor with all three
commit messages and succeeding when I exit the editor.  But without a
better message from git I don't expect a user to discover that.  And,
when rebase can continue just by being told so it would be nice if it
didn't require that user intervention.

If the introduction of empty commits that the user has asked for
(perhaps inadvertently) is considered too undesirable, then perhaps my
fix is too simple.  I'll think about how to do something more
sophisticated.

Thanks for your feedback,

--Pete

Re: [PATCH/RFC] Allow empty commits during rebase -i

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:48:03

Hi,

On Sun, 17 Jan 2010, Pete Harlan wrote:
If the introduction of empty commits that the user has asked for 
(perhaps inadvertently) is considered too undesirable, then perhaps my 
fix is too simple.  I'll think about how to do something more 
sophisticated.
How about something less sophisticated instead?  Namely, check for the 
condition that nothing was changed, and tell the user that the commit 
blablabla seems to introduce changes that are already present in HEAD.  
Maybe even mention that this may be due to the commit being applied 
already and saying that --continue is safe in that case, but please check.

Hmm?

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help