Merge branch 'jc/ll-merge-binary-ours'
authorJunio C Hamano <gitster@pobox.com>
Sat, 15 Sep 2012 04:39:56 +0000 (21:39 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 15 Sep 2012 04:39:56 +0000 (21:39 -0700)
"git merge -Xtheirs" did not help content-level merge of binary
files; it should just take their version.  Also "*.jpg binary" in
the attributes did not imply they should use the binary ll-merge
driver.

* jc/ll-merge-binary-ours:
  ll-merge: warn about inability to merge binary files only when we can't
  attr: "binary" attribute should choose built-in "binary" merge driver
  merge: teach -Xours/-Xtheirs to binary ll-merge driver

1  2 
Documentation/gitattributes.txt
attr.c
ll-merge.c

Simple merge
diff --cc attr.c
Simple merge
diff --cc ll-merge.c
index f3f7692158666ffd2ab6f65f4040462e4a7d2d00,307315b7883db7dbaa8835e1cda72cdd7bdaae93..acea33bf1babfe541c319081f14625ac779bb582
@@@ -46,11 -46,24 +46,24 @@@ static int ll_binary_merge(const struc
        assert(opts);
  
        /*
-        * The tentative merge result is "ours" for the final round,
-        * or common ancestor for an internal merge.  Still return
-        * "conflicted merge" status.
+        * The tentative merge result is the or common ancestor for an internal merge.
         */
-       stolen = opts->virtual_ancestor ? orig : src1;
+       if (opts->virtual_ancestor) {
+               stolen = orig;
+       } else {
+               switch (opts->variant) {
+               default:
 -                      warning("Cannot merge binary files: %s (%s vs. %s)\n",
++                      warning("Cannot merge binary files: %s (%s vs. %s)",
+                               path, name1, name2);
+                       /* fallthru */
+               case XDL_MERGE_FAVOR_OURS:
+                       stolen = src1;
+                       break;
+               case XDL_MERGE_FAVOR_THEIRS:
+                       stolen = src2;
+                       break;
+               }
+       }
  
        result->ptr = stolen->ptr;
        result->size = stolen->size;