From d92f1dc63f0582e7cf8dac54d50a2748119a1ce3 Mon Sep 17 00:00:00 2001 From: Peter Hagervall Date: Sun, 7 May 2006 16:50:47 +0200 Subject: Sparse fix for builtin-diff You gotta love sparse: builtin-diff.c:88:4: error: Just how const do you want this type to be? Signed-off-by: Peter Hagervall Signed-off-by: Junio C Hamano --- builtin-diff.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'builtin-diff.c') diff --git a/builtin-diff.c b/builtin-diff.c index 636edbf2a7..d3ac581f29 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -84,8 +84,7 @@ static void stuff_change(struct diff_options *opt, if (opt->reverse_diff) { unsigned tmp; - const - const unsigned char *tmp_u; + const unsigned char *tmp_u; const char *tmp_c; tmp = old_mode; old_mode = new_mode; new_mode = tmp; tmp_u = old_sha1; old_sha1 = new_sha1; new_sha1 = tmp_u; -- cgit v1.2.1 From e4e23f3a1c7734cdad60ba1274487ee6e2198de3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 15 May 2006 19:05:50 -0700 Subject: 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 --- builtin-diff.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'builtin-diff.c') diff --git a/builtin-diff.c b/builtin-diff.c index d3ac581f29..b0c9cade02 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -132,7 +132,9 @@ static int builtin_diff_blobs(struct rev_info *revs, int argc, const char **argv, struct blobinfo *blob) { - /* Blobs */ + /* Blobs: the arguments are reversed when setup_revisions() + * picked them up. + */ unsigned mode = canon_mode(S_IFREG | 0644); while (1 < argc) { @@ -145,8 +147,8 @@ static int builtin_diff_blobs(struct rev_info *revs, } stuff_change(&revs->diffopt, mode, mode, - blob[0].sha1, blob[1].sha1, - blob[1].name, blob[1].name); + blob[1].sha1, blob[0].sha1, + blob[0].name, blob[0].name); diffcore_std(&revs->diffopt); diff_flush(&revs->diffopt); return 0; -- cgit v1.2.1 From 065e0b126f47e0c280da6830956766ff2ea8cf17 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 18 May 2006 14:35:37 -0700 Subject: builtin-diff: do not say files are renamed when blob and file are given Signed-off-by: Junio C Hamano --- builtin-diff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin-diff.c') diff --git a/builtin-diff.c b/builtin-diff.c index b0c9cade02..de81b05e32 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -122,7 +122,7 @@ static int builtin_diff_b_f(struct rev_info *revs, stuff_change(&revs->diffopt, canon_mode(st.st_mode), canon_mode(st.st_mode), blob[0].sha1, null_sha1, - blob[0].name, path); + path, path); diffcore_std(&revs->diffopt); diff_flush(&revs->diffopt); return 0; -- cgit v1.2.1