threads / bug / 12413

git-rebase dirty index and email address bug?

Subject: git-rebase dirty index and email address bug?

## tl;dr

8 messages between Mar 1, 2008 and Mar 4, 2008.

replies: 7people: 2as markdown or json

John Goerzen· Mar 1, 2008, 20:40 UTC · lore
Hi folks,

I have checked out a remote git repo. I have hacked on my local copy for the last two days. I have performed no merges or anything elese odd. Today I git fetched the remote, and then I tried to git rebase upstream/master. I had committed all outstanding changes first. My index was clean. It displayed:

First, rewinding head to replay your work on top of it... HEAD is now at 77f1a60... Merge branch 'trunk' Dirty index: cannot apply patches (dirty: public/dispatch.fcgi)

Tthat particular file was one that I added. It did not exist upstream either at my initial checkout, nor was it added upstream at any point since.

git status shows:

# Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: public/dispatch.fcgi # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # .dotest/

So I tried the git reset command on public/dispatch.fcgi, and also then deleted that file. I then tried git-rebase --continue, which displayed:

sed: can't read .dotest/info: No such file or directory sed: can't read .dotest/info: No such file or directory sed: can't read .dotest/info: No such file or directory Patch does not have a valid e-mail address.

I have no idea what sed is complaining about, but that last line is interesting. The upstream git repo I am monitoring was itself converted from an svn repo using, presumably, git-svn or git-svnimport. It lies at git://gitorious.org/redmine-git/mainline.git

Most patches have an author like this:
Author: jplang <jplang@e93f8b46-1217-0410-a6f0-8f06a7374b81>

Could one of the git tools be trying to parse this for some odd reason?

Or is something else going on here?
John Goerzen· Mar 1, 2008, 21:29 UTC · re: John Goerzen · lore

Re: git-rebase dirty index and email address bug?

On 2008-03-01, John Goerzen <jgoerzen@complete.org> wrote:
Show 7 quoted lines
> Hi folks,
>
> I have checked out a remote git repo.  I have hacked on my local copy
> for the last two days.  I have performed no merges or anything elese
> odd.  Today I git fetched the remote, and then I tried to git rebase
> upstream/master.  I had committed all outstanding changes first.  My
> index was clean.  It displayed:
Two things to add:
1) This was a clean branch prior to rebase (git status was empty)
2) Adding -i to the rebase command, then making no changes to the
list, caused the rebase to work perfectly.
Jeff King· Mar 2, 2008, 07:30 UTC · re: John Goerzen · lore

Re: git-rebase dirty index and email address bug?

On Sat, Mar 01, 2008 at 03:29:37PM -0600, John Goerzen wrote:
Show 6 quoted lines
> Two things to add:
> 
> 1) This was a clean branch prior to rebase (git status was empty)
> 
> 2) Adding -i to the rebase command, then making no changes to the
> list, caused the rebase to work perfectly.

Yes, "rebase -i" works somewhat differently than an ordinary rebase. It uses a series of cherry-picks rather than "format-patch | am". And the bug is, I think, in "git-am".

It probably would also have worked using "git rebase -m" which uses merge strategies to rebase.

And yes, it is a bit crazy that there are so many ways to rebase. The original, "format-patch | am" is faster than the other schemes, but doesn't handle renames (as "rebase -m" does); nor is it flexible enough to do what "rebase -i" does.

-Peff
John Goerzen· Mar 2, 2008, 13:44 UTC · re: Jeff King · lore

Re: git-rebase dirty index and email address bug?

On Sunday 02 March 2008 1:30:16 am Jeff King wrote:
Show 14 quoted lines
> On Sat, Mar 01, 2008 at 03:29:37PM -0600, John Goerzen wrote:
> > Two things to add:
> >
> > 1) This was a clean branch prior to rebase (git status was empty)
> >
> > 2) Adding -i to the rebase command, then making no changes to the
> > list, caused the rebase to work perfectly.
>
> Yes, "rebase -i" works somewhat differently than an ordinary rebase. It
> uses a series of cherry-picks rather than "format-patch | am". And the
> bug is, I think, in "git-am".
>
> It probably would also have worked using "git rebase -m" which uses
> merge strategies to rebase.

I did try that. The resulting error message was slightly different, but not significantly so, if I remember correctly.

-- John
Jeff King· Mar 2, 2008, 07:26 UTC · re: John Goerzen · lore

Re: git-rebase dirty index and email address bug?

On Sat, Mar 01, 2008 at 02:40:24PM -0600, John Goerzen wrote:
Show 7 quoted lines
> odd.  Today I git fetched the remote, and then I tried to git rebase
> upstream/master.  I had committed all outstanding changes first.  My
> index was clean.  It displayed:
> 
> First, rewinding head to replay your work on top of it...
> HEAD is now at 77f1a60... Merge branch 'trunk'
> Dirty index: cannot apply patches (dirty: public/dispatch.fcgi)

That seems quite strange, since git-rebase did a "git-reset --hard", which should have cleared your index anyway. And then it runs "git format-patch | git am", and "am" is responsible for the "Dirty index" message. So perhaps there is something in your commit that is triggering a bug when piped in this way.

I tried cloning the "mainline.git" repository you mentioned and doing a few simple tests, but was unable to reproduce. Can you make available the commits that you are trying to rebase?

Show 8 quoted lines
> So I tried the git reset command on public/dispatch.fcgi, and also
> then deleted that file.  I then tried git-rebase --continue, which
> displayed:
> 
> sed: can't read .dotest/info: No such file or directory
> sed: can't read .dotest/info: No such file or directory
> sed: can't read .dotest/info: No such file or directory
> Patch does not have a valid e-mail address.

Hrm. I don't think it has anything to do with your email address being invalid, but rather that we somehow failed to create the 'info' file containing information about the commit.

Show 10 quoted lines
> converted from an svn repo using, presumably, git-svn or
> git-svnimport.  It lies at
> git://gitorious.org/redmine-git/mainline.git
> 
> Most patches have an author like this:
> 
> Author: jplang <jplang@e93f8b46-1217-0410-a6f0-8f06a7374b81>
> 
> Could one of the git tools be trying to parse this for some odd
> reason?

No, that should parse fine. I think there is something more fundamental going wrong.

-Peff
John Goerzen· Mar 3, 2008, 03:28 UTC · re: Jeff King · lore

Re: git-rebase dirty index and email address bug?

On Sunday 02 March 2008 1:26:22 am Jeff King wrote:
> I tried cloning the "mainline.git" repository you mentioned and doing a
> few simple tests, but was unable to reproduce. Can you make available
> the commits that you are trying to rebase?

That repo contains some local configuration and password information. However, I would be happy to make it available to you or any other Git developer privately. Could you contact me off-list if you'd like me to send it to you? The .git directory in question is about 4.5MB, and I'd be happy to email it.

-- John
Jeff King· Mar 4, 2008, 12:08 UTC · re: John Goerzen · lore

Re: git-rebase dirty index and email address bug?

On Sun, Mar 02, 2008 at 09:28:14PM -0600, John Goerzen wrote:
Show 5 quoted lines
> That repo contains some local configuration and password information.  
> However, I would be happy to make it available to you or any other Git 
> developer privately.  Could you contact me off-list if you'd like me to send 
> it to you?  The .git directory in question is about 4.5MB, and I'd be happy 
> to email it.
I was able to turn this into a much smaller test case.
What is happening is that rebase works something like:
  1. reset to "onto" commit
  2. replay each commit between "upstream" and "branch"
but there is a bug in step 1 that is leaving the bogus
"public/dispatch.fcgi" file in the index and working tree. So step 2
correctly complains that the file is already there and uncommitted.

The bug in step 1 seems to be very hard to trigger, and requires that the "branch" commit and the "onto" commit differ such that:

  - there is a file on the branch that was a directory in "onto"
  - there is a file on the branch that is new since "onto", and that
    sorts lexically after the file mentioned above
So you can see that it is rare for it to come up. :)

I'm not sure of the correct fix for the bug, but I have posted a request for help under the subject "bug in unpack_trees", so hopefully somebody more wise than I will have something to say.

-Peff
John Goerzen· Mar 4, 2008, 15:22 UTC · re: Jeff King · lore

Re: git-rebase dirty index and email address bug?

On 2008-03-04, Jeff King <peff@peff.net> wrote:
>> to email it.
>
> I was able to turn this into a much smaller test case.
>
Many thanks for helping to track this down, Jeff!
-- John

← back to recent threads