@matheusbsbs / matheus-bagliano / commits / e4e23f3a1c
Fork 0

builtin-diff: fix comparison between two blobs.

The code forgot that setup_revisions() leaves parsed object names in reverse in the list. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed May 15, 2006 at 19:05 UTC e4e23f3a1c7734cdad60ba1274487ee6e2198de3
1 file changed +5 -3
builtin-diff.c
+5 -3
@@ -132,7 +132,9 @@ static int builtin_diff_blobs(struct rev_info *revs,
132 int argc, const char **argv,
133 struct blobinfo *blob)
134 {
135 - /* Blobs */
135 + /* Blobs: the arguments are reversed when setup_revisions()
136 + * picked them up.
137 + */
138 unsigned mode = canon_mode(S_IFREG | 0644);
139
140 while (1 < argc) {
@@ -145,8 +147,8 @@ static int builtin_diff_blobs(struct rev_info *revs,
147 }
148 stuff_change(&revs->diffopt,
149 mode, mode,
148 - blob[0].sha1, blob[1].sha1,
149 - blob[1].name, blob[1].name);
150 + blob[1].sha1, blob[0].sha1,
151 + blob[0].name, blob[0].name);
152 diffcore_std(&revs->diffopt);
153 diff_flush(&revs->diffopt);
154 return 0;