diff --git a/diff-index.c b/diff-index.c
index 62b36cc8ee2bad8e4c37c4c7e2a99d6d4abc2f88..f8a102ec1665753e078798eaaac7aca48b845995 100644 (file)
--- a/diff-index.c
+++ b/diff-index.c
#include "cache.h"
#include "cache.h"
+#include "tree.h"
#include "diff.h"
static int cached_only = 0;
#include "diff.h"
static int cached_only = 0;
}
static int get_stat_data(struct cache_entry *ce,
}
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;
{
unsigned char *sha1 = ce->sha1;
unsigned int mode = ce->ce_mode;
changed = ce_match_stat(ce, &st);
if (changed) {
mode = create_ce_mode(st.st_mode);
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;
}
}
sha1 = no_sha1;
}
}
unsigned char *sha1;
unsigned int mode;
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;
if (get_stat_data(new, &sha1, &mode) < 0)
return;
@@ -110,7 +117,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
/* 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.
* file is deleted but reports true if work
* tree does not have it, in which case we
* fall through to report the unmerged state.
unsigned char sha1[20];
const char *prefix = setup_git_directory();
const char **pathspec = NULL;
unsigned char sha1[20];
const char *prefix = setup_git_directory();
const char **pathspec = NULL;
- void *tree;
- unsigned long size;
+ struct tree *tree;
int ret;
int allow_options = 1;
int i;
int ret;
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];
diff_setup(&diff_options);
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
/* We accept the -r flag just to look like git-diff-tree */
continue;
}
/* We accept the -r flag just to look like git-diff-tree */
continue;
}
+ if (!strcmp(arg, "--cc"))
+ /*
+ * I _think_ "diff-index --cached HEAD" with an
+ * unmerged index could show something else
+ * later, but pretend --cc is the same as -p for
+ * now. "git diff" uses --cc by default.
+ */
+ argv[i] = arg = "-p";
diff_opt_cnt = diff_opt_parse(&diff_options, argv + i,
argc - i);
if (diff_opt_cnt < 0)
diff_opt_cnt = diff_opt_parse(&diff_options, argv + i,
argc - i);
if (diff_opt_cnt < 0)
mark_merge_entries();
mark_merge_entries();
- tree = read_object_with_reference(sha1, "tree", &size, NULL);
+ tree = parse_tree_indirect(sha1);
if (!tree)
die("bad tree object %s", tree_name);
if (!tree)
die("bad tree object %s", tree_name);
- if (read_tree(tree, size, 1, pathspec))
+ if (read_tree(tree, 1, pathspec))
die("unable to read tree object %s", tree_name);
ret = diff_cache(active_cache, active_nr, pathspec);
die("unable to read tree object %s", tree_name);
ret = diff_cache(active_cache, active_nr, pathspec);