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

[PATCH] array index mixup

From
MLMatthias Lederhofer <matled@gmx.net>
Date
Jul 15, 2006, 12:59 UTC
Message-ID
<E1G1jje-0007ey-OA@moooo.ath.cx>
In-Reply-To
<e9aff7$nk1$1@sea.gmane.org>

--- Jakub Narebski <jnareb@gmail.com> wrote:

Show 12 quoted lines
> git diff output for files specified by revision is somewhat unexpected. 
> 
>   $ git diff <revision_1>:<file> <revision_2>:<file>
> 
> outputs the following diff metainfo
> 
>   diff --git a/<revision_2>:<file> b/<revision_2>:<file>
>   index 5eabe06..2e87de4 100644
>   --- a/<revision_2>:<file>
>   +++ b/<revision_2>:<file>
> 
> Is it intended, or is it a bug? Looks like a bug to me...
I dunno if this is really an index mixup or was intended.  If this is
intended please add a comment what it's for.  (Without this you get
rename information, perhaps this is the reason.)
---
 builtin-diff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-diff.c b/builtin-diff.c
index cb38f44..4d43a5c 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -136,7 +136,7 @@ static int builtin_diff_blobs(struct rev
 	stuff_change(&revs->diffopt,
 		     mode, mode,
 		     blob[1].sha1, blob[0].sha1,
-		     blob[0].name, blob[0].name);
+		     blob[1].name, blob[0].name);
 	diffcore_std(&revs->diffopt);
 	diff_flush(&revs->diffopt);
 	return 0;
-- 
1.4.1.ga3e6
Previous: Matthias LederhoferNext: Junio C Hamano
Message 3 of 4 in “Strange output of 'git diff <revision1>:<file> <revision2>:<file>'”
  1. Jakub NarebskiJul 15, 2006
  2. use the path as name from the revision:path syntax in setup_revisionsMatthias Lederhofer, Jul 15, 2006
  3. array index mixupMatthias Lederhofer, Jul 15, 2006
  4. Junio C HamanoJul 16, 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.