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

[PATCH 4/4] use the mode information of the tree, if <SHA1>:file name syntax is used

From
MKMartin Koegler <mkoegler@auto.tuwien.ac.at>
Date
Apr 21, 2007, 12:26 UTC
Message-ID
<11771583802608-git-send-email-mkoegler@auto.tuwien.ac.at>
In-Reply-To
<11771583803353-git-send-email-mkoegler@auto.tuwien.ac.at>
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
 builtin-diff.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/builtin-diff.c b/builtin-diff.c
index a427358..f1886ec 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -20,6 +20,7 @@
 struct blobinfo {
 	unsigned char sha1[20];
 	const char *name;
+	unsigned mode;
 };
 
 static const char builtin_diff_usage[] =
@@ -88,8 +89,14 @@ static int builtin_diff_blobs(struct rev_info *revs,
 	if (argc > 1)
 		usage(builtin_diff_usage);
 
+	if (blob[0].mode == S_IFINVALID)
+		blob[0].mode = mode;
+
+	if (blob[1].mode == S_IFINVALID)
+		blob[1].mode = mode;
+
 	stuff_change(&revs->diffopt,
-		     mode, mode,
+		     blob[0].mode, blob[1].mode,
 		     blob[0].sha1, blob[1].sha1,
 		     blob[0].name, blob[1].name);
 	diffcore_std(&revs->diffopt);
@@ -271,6 +278,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 				die("more than two blobs given: '%s'", name);
 			hashcpy(blob[blobs].sha1, obj->sha1);
 			blob[blobs].name = name;
+			blob[blobs].mode = list->mode;
 			blobs++;
 			continue;
 
-- 
1.4.4.4
Previous: Martin KoeglerNext: Junio C Hamano
Message 4 of 6 in “add mode parameter to get_sha1”
  1. 1/4 add mode parameter to get_sha1Martin Koegler, Apr 21, 2007
  2. 2/4 add support for storing the mode in object_arrayMartin Koegler, Apr 21, 2007
  3. 3/4 add mode to add_pending_objectMartin Koegler, Apr 21, 2007
  4. 4/4 use the mode information of the tree, if <SHA1>:file name syntax is usedMartin Koegler, Apr 21, 2007
  5. Junio C HamanoApr 21, 2007
  6. Alex RiesenApr 21, 2007

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.