X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diff-index.c;h=87e10619830ba71654240d424f15cb6db8ac1d65;hb=927a503cd07718ea0f700052043f383253904a56;hp=62b36cc8ee2bad8e4c37c4c7e2a99d6d4abc2f88;hpb=6b5ee137e56af8093391411389dd4b18416707ec;p=git.git diff --git a/diff-index.c b/diff-index.c index 62b36cc8..87e10619 100644 --- a/diff-index.c +++ b/diff-index.c @@ -15,7 +15,7 @@ static void show_file(const char *prefix, } static int get_stat_data(struct cache_entry *ce, - unsigned char **sha1p, unsigned int *modep) + unsigned char ** sha1p, unsigned int *modep) { unsigned char *sha1 = ce->sha1; unsigned int mode = ce->ce_mode; @@ -35,6 +35,10 @@ static int get_stat_data(struct cache_entry *ce, changed = ce_match_stat(ce, &st); if (changed) { mode = create_ce_mode(st.st_mode); + if (!trust_executable_bit && + S_ISREG(mode) && S_ISREG(ce->ce_mode) && + ((mode ^ ce->ce_mode) == 0111)) + mode = ce->ce_mode; sha1 = no_sha1; } } @@ -49,7 +53,9 @@ static void show_new_file(struct cache_entry *new) unsigned char *sha1; unsigned int mode; - /* New file in the index: it might actually be different in the working copy */ + /* New file in the index: it might actually be different in + * the working copy. + */ if (get_stat_data(new, &sha1, &mode) < 0) return; @@ -110,7 +116,7 @@ static int diff_cache(struct cache_entry **ac, int entries, const char **pathspe /* We come here with ce pointing at stage 1 * (original tree) and ac[1] pointing at stage * 3 (unmerged). show-modified with - * report-mising set to false does not say the + * report-missing set to false does not say the * file is deleted but reports true if work * tree does not have it, in which case we * fall through to report the unmerged state. @@ -174,6 +180,7 @@ int main(int argc, const char **argv) int allow_options = 1; int i; + git_config(git_diff_config); diff_setup(&diff_options); for (i = 1; i < argc; i++) { const char *arg = argv[i];