MCPcopy Index your code
hub / github.com/git/git / cmd_diff_files

Function cmd_diff_files

builtin/diff-files.c:23–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21COMMON_DIFF_OPTIONS_HELP;
22
23int cmd_diff_files(int argc,
24 const char **argv,
25 const char *prefix,
26 struct repository *repo UNUSED)
27{
28 struct rev_info rev;
29 int result;
30 unsigned options = 0;
31
32 show_usage_if_asked(argc, argv, diff_files_usage);
33
34 repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
35
36 prepare_repo_settings(the_repository);
37 the_repository->settings.command_requires_full_index = 0;
38
39 repo_init_revisions(the_repository, &rev, prefix);
40 rev.abbrev = 0;
41
42 /*
43 * Consider "intent-to-add" files as new by default, unless
44 * explicitly specified in the command line or anywhere else.
45 */
46 rev.diffopt.ita_invisible_in_index = 1;
47
48 prefix = precompose_argv_prefix(argc, argv, prefix);
49
50 argc = setup_revisions(argc, argv, &rev, NULL);
51 while (1 < argc && argv[1][0] == '-') {
52 if (!strcmp(argv[1], "--base"))
53 rev.max_count = 1;
54 else if (!strcmp(argv[1], "--ours"))
55 rev.max_count = 2;
56 else if (!strcmp(argv[1], "--theirs"))
57 rev.max_count = 3;
58 else if (!strcmp(argv[1], "-q"))
59 options |= DIFF_SILENT_ON_REMOVED;
60 else
61 usage(diff_files_usage);
62 argv++; argc--;
63 }
64 if (!rev.diffopt.output_format)
65 rev.diffopt.output_format = DIFF_FORMAT_RAW;
66 rev.diffopt.rotate_to_strict = 1;
67
68 /*
69 * Make sure there are NO revision (i.e. pending object) parameter,
70 * rev.max_count is reasonable (0 <= n <= 3), and
71 * there is no other revision filtering parameters.
72 */
73 if (rev.pending.nr ||
74 rev.min_age != -1 || rev.max_age != -1 ||
75 3 < rev.max_count)
76 usage(diff_files_usage);
77
78 /*
79 * "diff-files --base -p" should not combine merges because it
80 * was not asked to. "diff-files -c -p" should not densify

Callers

nothing calls this directly

Calls 13

show_usage_if_askedFunction · 0.85
prepare_repo_settingsFunction · 0.85
repo_init_revisionsFunction · 0.85
setup_revisionsFunction · 0.85
repo_read_index_preloadFunction · 0.85
die_errnoFunction · 0.85
run_diff_filesFunction · 0.85
diff_result_codeFunction · 0.85
release_revisionsFunction · 0.85
repo_configFunction · 0.50
precompose_argv_prefixFunction · 0.50

Tested by

no test coverage detected