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

[PATCH 2/2] attr: "binary" attribute should choose built-in "binary" merge driver

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 9, 2012, 04:40 UTC
Message-ID
<1347165639-12149-3-git-send-email-gitster@pobox.com>
In-Reply-To
<1347165639-12149-1-git-send-email-gitster@pobox.com>

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 <gitster@pobox.com>
---
 Documentation/gitattributes.txt | 2 +-
 attr.c                          | 2 +-
 t/t6037-merge-ours-theirs.sh    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index a85b187..ead7254 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 303751f..3f581b3 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 8d05671..3889eca 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 &&
-- 
1.7.12.322.g2c7d289
Previous: Junio C HamanoNext: Jeff King
Message 5 of 12 in “Binary file-friendly merge -Xours or -Xtheirs?”
  1. Stephen BashSep 7, 2012
  2. Junio C HamanoSep 7, 2012
  3. 0/2 Teaching -Xours/-Xtheirs to binary ll-merge driverJunio C Hamano, Sep 9, 2012
  4. 1/2 merge: teach -Xours/-Xtheirs to binary ll-merge driverJunio C Hamano, Sep 9, 2012
  5. 2/2 attr: "binary" attribute should choose built-in "binary" merge driverJunio C Hamano, Sep 9, 2012
  6. Jeff KingSep 10, 2012
  7. Junio C HamanoSep 12, 2012
  8. Stephen BashSep 12, 2012
  9. Junio C HamanoSep 12, 2012
  10. Stephen BashSep 12, 2012
  11. Jeff KingSep 12, 2012
  12. Stephen BashSep 9, 2012

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.