summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-02-22 12:28:27 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-02-22 12:28:27 -0800
commitdcc883dcbc25276784bb98dce5927d76d2ed5c6c (patch)
tree1a82bed606b8489f6b8a7d2c4219582db6d777b2
parentMerge branch 'ps/submodule-sanitize-path-upon-add' (diff)
parentrun_diff_files(): clarify computation of sha1 validity (diff)
downloadtgif-dcc883dcbc25276784bb98dce5927d76d2ed5c6c.tar.xz
Merge branch 'jc/diff-files-ita'
Code cleanup. * jc/diff-files-ita: run_diff_files(): clarify computation of sha1 validity
-rw-r--r--diff-lib.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 875aff8643..a85c4971ac 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -101,6 +101,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
struct cache_entry *ce = active_cache[i];
int changed;
unsigned dirty_submodule = 0;
+ const unsigned char *old_sha1, *new_sha1;
if (diff_can_quit_early(&revs->diffopt))
break;
@@ -224,9 +225,12 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
continue;
}
oldmode = ce->ce_mode;
+ old_sha1 = ce->sha1;
+ new_sha1 = changed ? null_sha1 : ce->sha1;
diff_change(&revs->diffopt, oldmode, newmode,
- ce->sha1, (changed ? null_sha1 : ce->sha1),
- !is_null_sha1(ce->sha1), (changed ? 0 : !is_null_sha1(ce->sha1)),
+ old_sha1, new_sha1,
+ !is_null_sha1(old_sha1),
+ !is_null_sha1(new_sha1),
ce->name, 0, dirty_submodule);
}