X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=diff-files.c;h=6dca9e0e2b58728f4f13c899a513fbd3fb766808;hb=d6db01075b65da2b8584a0450619390893aae103;hp=c36bcf25bcd3b10079d8a2f97c67dea101d79880;hpb=e99d59ff0bff349ef205cef1076e0354c8130680;p=git.git diff --git a/diff-files.c b/diff-files.c index c36bcf25..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,8 +92,8 @@ int main(int argc, char **argv) exit(1); } - diff_setup(detect_rename, diff_score_opt, reverse_diff, - (generate_patch ? -1 : line_termination), + diff_setup(detect_rename, diff_score_opt, pickaxe, + reverse_diff, (generate_patch ? -1 : line_termination), NULL, 0); for (i = 0; i < entries; i++) { @@ -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);