From a944af1d86e6171d68ed2a3aa67b1d68f00e1fe8 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 8 Sep 2012 21:27:19 -0700 Subject: merge: teach -Xours/-Xtheirs to binary ll-merge driver The (discouraged) -Xours/-Xtheirs modes of merge are supposed to give a quick and dirty way to come up with a random mixture of cleanly merged parts and punted conflict resolution to take contents from one side in conflicting parts. These options however were only passed down to the low level merge driver for text. Teach the built-in binary merge driver to notice them as well. Signed-off-by: Junio C Hamano --- Documentation/merge-strategies.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt index 595a3cf1a7..66db80296f 100644 --- a/Documentation/merge-strategies.txt +++ b/Documentation/merge-strategies.txt @@ -32,13 +32,14 @@ ours;; This option forces conflicting hunks to be auto-resolved cleanly by favoring 'our' version. Changes from the other tree that do not conflict with our side are reflected to the merge result. + For a binary file, the entire contents are taken from our side. + This should not be confused with the 'ours' merge strategy, which does not even look at what the other tree contains at all. It discards everything the other tree did, declaring 'our' history contains all that happened in it. theirs;; - This is opposite of 'ours'. + This is the opposite of 'ours'. patience;; With this option, 'merge-recursive' spends a little extra time -- cgit v1.3-5-g9baa From 155a4b712efd3d917c228d155ec57ec2c09d7ac0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 8 Sep 2012 21:28:55 -0700 Subject: attr: "binary" attribute should choose built-in "binary" merge driver The built-in "binary" attribute macro expands to "-diff -text", so that textual diff is not produced, and the contents will not go through any CR/LF conversion ever. During a merge, it should also choose the "binary" low-level merge driver, but it didn't. Make it expand to "-diff -merge -text". Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 2 +- attr.c | 2 +- t/t6037-merge-ours-theirs.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index a85b187e04..ead7254922 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -904,7 +904,7 @@ file at the toplevel (i.e. not in any subdirectory). The built-in macro attribute "binary" is equivalent to: ------------ -[attr]binary -diff -text +[attr]binary -diff -merge -text ------------ diff --git a/attr.c b/attr.c index 303751f6c2..3f581b3cec 100644 --- a/attr.c +++ b/attr.c @@ -306,7 +306,7 @@ static void free_attr_elem(struct attr_stack *e) } static const char *builtin_attr[] = { - "[attr]binary -diff -text", + "[attr]binary -diff -merge -text", NULL, }; diff --git a/t/t6037-merge-ours-theirs.sh b/t/t6037-merge-ours-theirs.sh index 8d05671414..3889eca4ae 100755 --- a/t/t6037-merge-ours-theirs.sh +++ b/t/t6037-merge-ours-theirs.sh @@ -54,7 +54,7 @@ test_expect_success 'recursive favouring ours' ' ' test_expect_success 'binary file with -Xours/-Xtheirs' ' - echo "file -merge" >.gitattributes && + echo file binary >.gitattributes && git reset --hard master && git merge -s recursive -X theirs side && -- cgit v1.3-5-g9baa