When the conversion filter for a file is changed, the file may get listed as modified even though the user has not made any changes to it. This patch makes the index ignore such changes. It also makes git-diff compare with the normalized content rather than the original content. Signed-off-by: Henrik Grubbström <grubba@xxxxxxxxxx> --- diff-lib.c | 9 ++++++--- read-cache.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/diff-lib.c b/diff-lib.c index c9f6e05..ae6118d 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -95,6 +95,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 *norm_sha1; if (DIFF_OPT_TST(&revs->diffopt, QUICK) && DIFF_OPT_TST(&revs->diffopt, HAS_CHANGES)) @@ -147,7 +148,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option) if (2 <= stage) { int mode = nce->ce_mode; num_compare_stages++; - hashcpy(dpath->parent[stage-2].sha1, nce->sha1); + hashcpy(dpath->parent[stage-2].sha1, + ce_norm_sha1(nce)); dpath->parent[stage-2].mode = ce_mode_from_stat(nce, mode); dpath->parent[stage-2].status = DIFF_STATUS_MODIFIED; @@ -195,7 +197,7 @@ int run_diff_files(struct rev_info *revs, unsigned int option) if (silent_on_removed) continue; diff_addremove(&revs->diffopt, '-', ce->ce_mode, - ce->sha1, ce->name, 0); + ce_norm_sha1(ce), ce->name, 0); continue; } changed = match_stat_with_submodule(&revs->diffopt, ce, &st, @@ -207,8 +209,9 @@ int run_diff_files(struct rev_info *revs, unsigned int option) } oldmode = ce->ce_mode; newmode = ce_mode_from_stat(ce, st.st_mode); + norm_sha1 = ce_norm_sha1(ce); diff_change(&revs->diffopt, oldmode, newmode, - ce->sha1, (changed ? null_sha1 : ce->sha1), + norm_sha1, (changed ? null_sha1 : norm_sha1), ce->name, 0, dirty_submodule); } diff --git a/read-cache.c b/read-cache.c index 002160e..b631de9 100644 --- a/read-cache.c +++ b/read-cache.c @@ -94,7 +94,7 @@ static int ce_compare_data(struct cache_entry *ce, struct stat *st) if (fd >= 0) { unsigned char sha1[20]; if (!index_fd(sha1, fd, st, 0, OBJ_BLOB, ce->name)) - match = hashcmp(sha1, ce->sha1); + match = hashcmp(sha1, ce_norm_sha1(ce)); /* index_fd() closed the file descriptor already */ } return match; -- 1.7.0.4.369.g81e89 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html