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

[PATCH 1/2] combine-diff: Honour --full-index.

From
MWMark Wooding <mdw@distorted.org.uk>
Date
Feb 27, 2006, 12:52 UTC
Message-ID
<20060227125250.25144.28246.stgit@metalzone.distorted.org.uk>
In-Reply-To
<20060227124815.25144.83101.stgit@metalzone.distorted.org.uk>
From: Mark Wooding <mdw@distorted.org.uk>

For some reason, combined diffs don't honour the --full-index flag when emitting patches. Fix this.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
---
 combine-diff.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/combine-diff.c b/combine-diff.c
index d812600..984103e 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -621,7 +621,8 @@ static void reuse_combine_diff(struct sl
 }
 
 static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
-			   int dense, const char *header)
+			   int dense, const char *header,
+			   struct diff_options *opt)
 {
 	unsigned long size, cnt, lno;
 	char *result, *cp, *ep;
@@ -631,6 +632,7 @@ static int show_patch_diff(struct combin
 	char ourtmp_buf[TMPPATHLEN];
 	char *ourtmp = ourtmp_buf;
 	int working_tree_file = !memcmp(elem->sha1, null_sha1, 20);
+	int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV;
 
 	/* Read the result of merge first */
 	if (!working_tree_file) {
@@ -735,10 +737,10 @@ static int show_patch_diff(struct combin
 		printf("index ");
 		for (i = 0; i < num_parent; i++) {
 			abb = find_unique_abbrev(elem->parent[i].sha1,
-						 DEFAULT_ABBREV);
+						 abbrev);
 			printf("%s%s", i ? "," : "", abb);
 		}
-		abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV);
+		abb = find_unique_abbrev(elem->sha1, abbrev);
 		printf("..%s\n", abb);
 
 		if (mode_differs) {
@@ -862,7 +864,7 @@ int show_combined_diff(struct combine_di
 
 	default:
 	case DIFF_FORMAT_PATCH:
-		return show_patch_diff(p, num_parent, dense, header);
+		return show_patch_diff(p, num_parent, dense, header, opt);
 	}
 }
 
Previous: Mark WoodingNext: Mark Wooding
Message 2 of 3 in “combine-diff consistency fixes”
  1. 0/2 combine-diff consistency fixesMark Wooding, Feb 27, 2006
  2. 1/2 combine-diff: Honour --full-index.Mark Wooding, Feb 27, 2006
  3. 2/2 combine-diff: Honour -z option correctly.Mark Wooding, Feb 27, 2006

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.