threads / bug / 38086

[BUG] git rebase -X fails with merge-recursive error

Subject: [BUG] git rebase -X fails with merge-recursive error

## tl;dr

One message between Dec 1, 2014 and Dec 1, 2014.

replies: 0people: 1as markdown or json

Øystein Walle· Dec 1, 2014, 14:33 UTC · lore
Hi,

I discovered this while rebasing a branch after having converted files to use LF line endings. I got around the problem by using --ignore-whitespace but the error still seems strange to me so I'm reporting it.

The following script is equivalent: it creates a repo with a CRLF file, creates a "feature" branch, converts the file and then tries to rebase the feature branch with git rebase -X ignore-whitespace-at-eol:

    git init
    echo "That's some catch, that Catch-1984" >file.txt
    unix2dos file.txt
    git add file.txt
    git commit -m 'Initial commit'
    git checkout -b feature
    ex -sc 's/1984/22/|x' file.txt
    git commit -m "Fix literary confusion" file.txt
    git checkout master
    echo '* text=auto' > .gitattributes
    dos2unix file.txt
    git add .
    git commit -m 'CRLF to LF'
    git checkout feature
    gti config merge.renormalize true
    git rebase -X ignore-space-at-eol master
While rebasing the following error appears:
    error: addinfo_cache failed for path 'file.txt'

It comes from the git-merge-recursive invocation git-rebase performs[1] and is printed because make_cache_entry() fails[2]. I also get this error when using the other 'ignore-*' strategy options, as well as 'theirs'.

At this point file.txt still has its CRLF terminator, but simply:

git add file.txt git rebase --continue

has the desired effect (as it did in my real life situation). I've tested this on Git 2.2.0, 2.1.3 and 1.9.0.

I don't know whether this is actually related to git-rebase. It's a way to reproduce it if nothing else. I haven't tried any experiments with git-merge-recursive directly, I get the impression I'm not supposed to since it doesn't have a manpage ;) Interestingly, removing the creation of .gitattributes makes the problem go away.

Additionally, git-merge-recursive exits with status 0. This confuses git-rebase which will continue and then complain about the state of the index. (Interestingly, at this point my prompt thingy complains that .git/rebase-merge/done isn't there).

Regards, Øsse

[1]: https://github.com/git/git/blob/master/git-rebase--merge.sh#L70 [2]: https://github.com/git/git/blob/master/merge-recursive.c#L209

← back to recent threads