git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Stephan Beyer <s-beyer@gmx.net>
Cc: Git <git@vger.kernel.org>
Subject: Re: [BUG] rebase -i with only empty commits
Date: Wed, 23 Aug 2017 16:40:17 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1.1708231639470.19382@virtualbox> (raw)
In-Reply-To: <36e9c381-81b0-ae71-153a-0bcabc59856c@gmx.net>

Hi,

On Wed, 23 Aug 2017, Stephan Beyer wrote:

> On 08/23/2017 01:08 AM, Stefan Beller wrote:
> > The editor opened proposing the following instruction sheet,
> > which in my opinion is buggy:
> > 
> >     pick 1234 some commit
> >     exec make
> >     pick 2345 another commit
> >     exec make
> >     pick 3456 third commit
> >     # pick 4567 empty commit
> >     exec make
> >     pick 5678  yet another commit
> >     exec make
> 
> This reminds me of another bug I stumbled over recently regarding empty
> commits.
> 
> Do this:
> 	# repo preparation:
> 	git init
> 	:> file1
> 	git add file1
> 	git commit -m "add file1"
> 	:> file2
> 	git add file2
> 	git commit -m "add file2"
> 
> 	# the bug:
> 	git checkout -b to-be-rebased master^
> 	git commit --allow-empty -m "empty commit"
> 	git rebase -i master
> 
> It says "Nothing to do".
> Unsurprisingly, the problem persists when you apply other empty commits:
> 
> 	git commit --allow-empty -m "another empty commit"
> 	git rebase -i master
> 
> Adding a "real" commit solves the problem:
> 
> 	:>file3
> 	git add file3
> 	git commit -m "add file3"
> 
> Adding further empty commits is no problem:
> 
> 	git commit --allow-empty -m "yet another empty commit"
> 
> So the problem seems to be that rebase -i (like rebase without -i)
> considers "empty commits" as commits to be ignored. However, when using
> rebase -i one expects that you can include the empty commit...
> 
> Also, the behavior is odd. When I only have empty commits, a "git rebase
> master" works as expected like a "git reset --hard master" but "git
> rebase -i" does nothing.
> 
> The expected behavior would be that the editor shows up with a
> git-rebase-todo like:
> 	# pick 3d0f6c49 empty commit
> 	# pick bbbc5941 another empty commit
> 	noop

These days, I reflexively type `rebase -ki` instead of `rebase -i`. Maybe
you want to do that, too?

Ciao,
Dscho

  reply	other threads:[~2017-08-23 14:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 23:08 [BUG] rebase -i with empty commits + exec Stefan Beller
2017-08-23  9:08 ` [BUG] rebase -i with only empty commits Stephan Beyer
2017-08-23 14:40   ` Johannes Schindelin [this message]
2017-08-23 15:19     ` Stephan Beyer
2017-08-23 17:29       ` Stefan Beller
2017-08-23 18:06         ` Stephan Beyer
2017-08-23 18:29           ` Junio C Hamano
2017-08-23 22:42     ` Philip Oakley
2017-08-24 13:35     ` Phillip Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.1.1708231639470.19382@virtualbox \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=s-beyer@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).