Thanks for the thorough response. Here is some basic info:

$ git --version
git version 2.5.0
$ cat /etc/issue
Ubuntu 15.10
$ git config merge.tool
kdiff3

The issue seems as if it may be related to different renames of the
same file/folder in both the master branch and the feature branch.

I have a minimal repro in a repository located here:
https://github.com/royaldark/git-mergetool-issue

The repository has 2 branches, master and feature-branch. There are 3
commits: the initial commit, an additional commit on master, and a
commit on the feature branch. The initial commit has a folder named
"a" with a text file in it. The commit on the feature branch renames
that folder to "b", and the second commit on master renames it to "c".
Both commits modify the text file in the folder.

To repro the issue,
1. Clone the repo
2. git checkout feature-branch
3. git rebase master (or git merge master, either way works)
4. git mergetool

This produces errors like the following:
mv: cannot stat ‘a/b.txt’: No such file or directory
cp: cannot stat ‘./a/b_BACKUP_32417.txt’: No such file or directory
mv: cannot move ‘.merge_file_EYnyGH’ to ‘./a/b_BASE_32417.txt’: No
such file or directory
/usr/lib/git-core/git-mergetool: 229: /usr/lib/git-core/git-mergetool:
cannot create ./a/b_LOCAL_32417.txt: Directory nonexistent
/usr/lib/git-core/git-mergetool: 229: /usr/lib/git-core/git-mergetool:
cannot create ./a/b_REMOTE_32417.txt: Directory nonexistent

As for your thoughts on a workaround, you were exactly right:
> I'm not sure about a workaround, but.. it might possibly work if
> you were to `mkdir -p` the directory mentioned above, but that's
> a guess.  If that does workaround the issue then please let us
> know since that would be an interesting data point.

The following steps do NOT cause the issue:
1. git checkout feature-branch
2. git rebase master (or git merge master, either way works)
3. mkdir a
4. git mergetool

Creating the "a" directory solves the issue, and git-mergetool runs
without error.

Please let me know if I can provide any additional information.

-Joe

On Tue, Mar 1, 2016 at 10:38 AM, David Aguilar <dav...@gmail.com> wrote:
> On Tue, Feb 23, 2016 at 04:44:49PM -0600, Joe Einertson wrote:
>> I'm experiencing an annoying issue which leaves the repository in a
>> weird, broken state. I am attempting a rather vanilla rebase, rebasing
>> the commits from a feature branch on top of the newest commits on
>> master.
>
> Can you tell us a little more about what's in the branch being
> rebased?  Is it perhaps a public project that you can share so
> that we can reproduce the issue?
>
> Here are a few more questions that can help narrow down the
> issue:
>
> * What Git vesion are you using?
>
> * What mergetool are you using?
>   - See the output "git config merge.tool"
>
> * What platform are you on?  Are you on Windows?
>
> * Does the conflicting commit contain renames?
>
> I'm trying to figure out whether we are missing a `mkdir -p`
> somewhere, and whether we hadn't run into this in the past
> because the merge needs to involve renames.
>
>> So, I run a typical series of commands:
>> 1. git checkout feature-branch
>> 2. git rebase master (conflicts ensue)
>> 3. git mergetool
>>
>> The conflicts are expected, but when using mergetool to resolve them,
>> I encounter many "no such file or directory" errors.
>>
>> mv: cannot stat
>> ‘app/components/mediaManager/kbImageEditor.directive.coffee’: No such
>> file or directory
>> cp: cannot stat
>> ‘./app/components/mediaManager/kbImageEditor.directive_BACKUP_13615.coffee’:
>> No such file or directory
>> mv: cannot move ‘.merge_file_ogGjXX’ to
>> ‘./app/components/mediaManager/kbImageEditor.directive_BASE_13615.coffee’:
>> No such file or directory
>> /usr/lib/git-core/git-mergetool: 229: /usr/lib/git-core/git-mergetool:
>> cannot create 
>> ./app/components/mediaManager/kbImageEditor.directive_LOCAL_13615.coffee:
>> Directory nonexistent
>> /usr/lib/git-core/git-mergetool: 229: /usr/lib/git-core/git-mergetool:
>> cannot create 
>> ./app/components/mediaManager/kbImageEditor.directive_REMOTE_13615.coffee:
>> Directory nonexistent
>
> * Does the directory ./app/components/medaiManager/ exist in master?
>
> * Did a commit on master perhaps move its content somewhere else?
>
> * Does that directory have some chmod permissions, or is it owned
>   by a different user?
>
> * Are you able to create new files in that directory?
>
>> This leaves weird dangling files like '.merge_file_ogGjXX' in the
>> repo, and I assume I should not proceed with the merge since it
>> couldn't even create the files to compare.
>
> If you got a failure at this step you can safely delete those
> temporary dangling files and then follow the advice given by
> `git status`.
>
> Typically it'll list files with conflicts.  Open them with
> your $EDITOR, resolve conflicts like normal, and add the
> result using `git add`.  Nonetheless, we'd like to get to the
> bottom of this issue.
>
>> Is this a known issue? Is there any workaround? Is it safe to proceed
>> with the merge?
>
> I've never ran into this myself, and it's never been reported
> here so this is not a known issue.
>
> It's still safe to proceed with the merge and resolve files the
> normal way.  If you would rather undo the rebase and go back to
> your original state (before the rebase) then you can do
> `git rebase --abort` anytime.
>
> I'm not sure about a workaround, but.. it might possibly work if
> you were to `mkdir -p` the directory mentioned above, but that's
> a guess.  If that does workaround the issue then please let us
> know since that would be an interesting data point.
> --
> David
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to