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