X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diff-index.c;h=12a9418d6bbec35d2e5bc0010aff4366e63d7440;hb=a7cfb4a43fce841cd673057cf4137f85e6f804eb;hp=87e10619830ba71654240d424f15cb6db8ac1d65;hpb=92e802c6ccb96d1b5e8561b0a136d43d82253293;p=git.git diff --git a/diff-index.c b/diff-index.c index 87e10619..12a9418d 100644 --- a/diff-index.c +++ b/diff-index.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "tree.h" #include "diff.h" static int cached_only = 0; @@ -32,7 +33,7 @@ static int get_stat_data(struct cache_entry *ce, } return -1; } - changed = ce_match_stat(ce, &st); + changed = ce_match_stat(ce, &st, 0); if (changed) { mode = create_ce_mode(st.st_mode); if (!trust_executable_bit && @@ -174,8 +175,7 @@ int main(int argc, const char **argv) 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; @@ -201,6 +201,14 @@ int main(int argc, const char **argv) /* 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) @@ -233,10 +241,10 @@ int main(int argc, const char **argv) 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 (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);