views:

410

answers:

1

I'm trying to combine code on two branches with the 'git merge' command, but git is crashing during the process. I need to find an alternative way to merge these branches.

To increase merge output to a debug level I ran:

    $ export GIT_MERGE_VERBOSITY=5

I am currently on the destination branch. git-status shows everything clean and clear. When I merge the branches, this is what I see (I've replaced check-in comments with %%%%%% and filenames with ####### as they may be business-sensitive).

$ git merge origin/PH-RELEASE-146.0
Merging HEAD with origin/PH-RELEASE-146.0
Merging:
8399d82 %%%%%%
4f9dcfe %%%%%%
found 2 common ancestor(s):
e0a5fa1 %%%%%%
ce62bf1 %%%%%%
  Merging:
  e0a5fa1 %%%%%%
  ce62bf1 %%%%%%
  found 1 common ancestor(s):
  af34a07 %%%%%%
  Skipped ######## (merged same as existing)
  Removed ########
  Removed ########
  ...
  Removed ########
  Auto-merged build
  CONFLICT (submodule): Merge conflict in build - needs b3efae4855bc5eb83aa3167ce6c309a4503c3286
  There are unmerged index entries:
  1 build
  2 build
  3 build
Merge with strategy recursive failed.

It turns out that at this point, git-merge has crashed. How do I know this? - when running git under Cygwin:

$ git merge origin/PH-RELEASE-146.0

     11 [main] git 4352 _cygtls::handle_exceptions: Error while dumping state (probably corrupted stack)

Segmentation fault (core dumped)
  • when running git under Linux, with 'ulimit -c unlimited':
    $ ulimit -c unlimited; ls -l core; git merge origin/PH-RELEASE-146.0; ls -l core
    ls: cannot access core: No such file or directory
    Merging HEAD with origin/PH-RELEASE-146.0
    ...
    ...
    Merge with strategy recursive failed.
    -rw------- 1 user group 1589248 Jul 29 12:48 core
  • in both cases, .git/index.lock remains and must be manually deleted before any git command will work again:

    $ git status fatal: unable to create '.git/index.lock': File exists

I've manually walked through the merge above by comparing the commit IDs with the ones in the gitk tree. It seems clear to me that git is looking for common ancestors and breaking the merge up into pieces, dealing with each ancestor recursively. But what I think has caused the problem is that the "git-link" to a sub-module called "build" has changed between commits e0a5fa1 and ce62bf1:

  • in e0a5fa1 the submodule build is meant to be 8dc84b6
  • in ce62bf1 the submodule build is meant to be b3efae4

So obviously there's a conflict. But it's a conflict during the "partial" merge or whatever it's called, not the final one. And git does not seem to handle this very well at all.

Ok, so there's probably a bug - how would I go about submitting a bug report?

But what I'm really concerned about here is the fact that I cannot merge these two branches. Does anybody know an alternative way to bring these branches together without using the 'merge' command? Can I get 'git-merge' to somehow ignore this submodule completely during the entire merge process?

Linux git version 1.6.0.4

Cygwin git version 1.6.1.2

+1  A: 

Try upgrading git on linux, 1.6.3.3 is the latest, if that doesn't help try William's idea.

OneOfOne
Yes, I can confirm that 1.6.3.3 does not exhibit this issue. The merge correctly identifies a conflict with the submodule, but instead of crashing it properly continues the merge and adds other files to the index.
meowsqueak