2 * GIT - The information manager from hell
4 * Copyright (C) Linus Torvalds, 2005
11 static const char diff_files_usage[] =
12 "git-diff-files [-q] [-0/-1/2/3 |-c|--cc] [<common diff options>] [<path>...]"
13 COMMON_DIFF_OPTIONS_HELP;
15 int main(int argc, const char **argv)
20 git_config(git_diff_config);
24 argc = setup_revisions(argc, argv, &rev, NULL);
25 while (1 < argc && argv[1][0] == '-') {
26 if (!strcmp(argv[1], "--base"))
28 else if (!strcmp(argv[1], "--ours"))
30 else if (!strcmp(argv[1], "--theirs"))
32 else if (!strcmp(argv[1], "-q"))
35 usage(diff_files_usage);
39 * Make sure there are NO revision (i.e. pending object) parameter,
40 * rev.max_count is reasonable (0 <= n <= 3),
41 * there is no other revision filtering parameters.
43 if (rev.pending_objects ||
44 rev.min_age != -1 || rev.max_age != -1)
45 usage(diff_files_usage);
47 * Backward compatibility wart - "diff-files -s" used to
48 * defeat the common diff option "-s" which asked for
49 * DIFF_FORMAT_NO_OUTPUT.
51 if (rev.diffopt.output_format == DIFF_FORMAT_NO_OUTPUT)
52 rev.diffopt.output_format = DIFF_FORMAT_RAW;
53 return run_diff_files(&rev, silent);