summaryrefslogtreecommitdiff
path: root/diff-index.c
diff options
context:
space:
mode:
Diffstat (limited to 'diff-index.c')
-rw-r--r--diff-index.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/diff-index.c b/diff-index.c
index 62b36cc..c9a9f4c 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;
@@ -174,6 +180,7 @@ int main(int argc, const char **argv)
int allow_options = 1;
int i;
+ git_config(git_default_config);
diff_setup(&diff_options);
for (i = 1; i < argc; i++) {
const char *arg = argv[i];