X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=diff-files.c;h=6dca9e0e2b58728f4f13c899a513fbd3fb766808;hb=d6db01075b65da2b8584a0450619390893aae103;hp=414b36ec909fbded2972cbb08ac6c1e307058f23;hpb=57fe64a40d95dd99d798c6d7c81c1a76d24a8e7c;p=git.git diff --git a/diff-files.c b/diff-files.c index 414b36ec..6dca9e0e 100644 --- a/diff-files.c +++ b/diff-files.c @@ -7,13 +7,14 @@ #include "diff.h" static const char *diff_files_usage = -"git-diff-files [-p] [-q] [-r] [-z] [-M] [-R] [paths...]"; +"git-diff-files [-p] [-q] [-r] [-z] [-M] [-C] [-R] [-S] [paths...]"; static int generate_patch = 0; static int line_termination = '\n'; static int detect_rename = 0; static int reverse_diff = 0; static int diff_score_opt = 0; +static const char *pickaxe = NULL; static int silent = 0; static int matches_pathspec(struct cache_entry *ce, char **spec, int cnt) @@ -67,10 +68,17 @@ int main(int argc, char **argv) line_termination = 0; else if (!strcmp(argv[1], "-R")) reverse_diff = 1; + else if (!strcmp(argv[1], "-S")) + pickaxe = argv[1] + 2; else if (!strncmp(argv[1], "-M", 2)) { diff_score_opt = diff_scoreopt_parse(argv[1]); detect_rename = generate_patch = 1; } + else if (!strncmp(argv[1], "-C", 2)) { + diff_score_opt = diff_scoreopt_parse(argv[1]); + detect_rename = 2; + generate_patch = 1; + } else usage(diff_files_usage); argv++; argc--; @@ -84,9 +92,9 @@ int main(int argc, char **argv) exit(1); } - diff_setup(detect_rename, diff_score_opt, reverse_diff, - (generate_patch ? -1 : line_termination), - 0, 0); + diff_setup(detect_rename, diff_score_opt, pickaxe, + reverse_diff, (generate_patch ? -1 : line_termination), + NULL, 0); for (i = 0; i < entries; i++) { struct stat st; @@ -108,7 +116,7 @@ int main(int argc, char **argv) } if (lstat(ce->name, &st) < 0) { - if (errno != ENOENT) { + if (errno != ENOENT && errno != ENOTDIR) { perror(ce->name); continue; } @@ -118,7 +126,7 @@ int main(int argc, char **argv) continue; } changed = ce_match_stat(ce, &st); - if (!changed) + if (!changed && detect_rename < 2) continue; oldmode = ntohl(ce->ce_mode);