git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Øystein Walle <oystwa@gmail.com>
Date
Dec 1, 2014, 14:33 UTC
Message-ID
<loom.20141201T152914-672@post.gmane.org>
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

Message 1 of 1 in “[BUG] git rebase -X fails with merge-recursive error”
  1. Øystein WalleDec 1, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.