Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-04-25 10:41:12 +0300
committerJunio C Hamano <gitster@pobox.com>2019-04-25 10:41:12 +0300
commitdcd6a8c09a36a500c4e612a52eba1c6c5e298951 (patch)
tree79ed79645190bf1c49996f2b9aec5e349eb96400 /builtin/diff.c
parent4284497396eb52b2c096c2f442b70a52138b6e1b (diff)
parentcdb5330a9baa64c28473fb0f446ca2242d6971fb (diff)
Merge branch 'nd/diff-parseopt-4'
Fourth batch to teach the diff machinery to use the parse-options API. * nd/diff-parseopt-4: am: avoid diff_opt_parse() diff --no-index: use parse_options() instead of diff_opt_parse() range-diff: use parse_options() instead of diff_opt_parse() diff.c: allow --no-color-moved-ws diff-parseopt: convert --color-moved-ws diff-parseopt: convert --[no-]color-moved diff-parseopt: convert --inter-hunk-context diff-parseopt: convert --no-prefix diff-parseopt: convert --line-prefix diff-parseopt: convert --[src|dst]-prefix diff-parseopt: convert --[no-]abbrev diff-parseopt: convert --diff-filter diff-parseopt: convert --find-object diff-parseopt: convert -O diff-parseopt: convert --pickaxe-all|--pickaxe-regex diff-parseopt: convert -S|-G diff-parseopt: convert -l diff-parseopt: convert -z diff-parseopt: convert --ita-[in]visible-in-index diff-parseopt: convert --ws-error-highlight
Diffstat (limited to 'builtin/diff.c')
-rw-r--r--builtin/diff.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/builtin/diff.c b/builtin/diff.c
index 53d4234ff48..42ac803091e 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -321,24 +321,6 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
repo_init_revisions(the_repository, &rev, prefix);
- if (no_index && argc != i + 2) {
- if (no_index == DIFF_NO_INDEX_IMPLICIT) {
- /*
- * There was no --no-index and there were not two
- * paths. It is possible that the user intended
- * to do an inside-repository operation.
- */
- fprintf(stderr, "Not a git repository\n");
- fprintf(stderr,
- "To compare two paths outside a working tree:\n");
- }
- /* Give the usage message for non-repository usage and exit. */
- usagef("git diff %s <path> <path>",
- no_index == DIFF_NO_INDEX_EXPLICIT ?
- "--no-index" : "[--no-index]");
-
- }
-
/* Set up defaults that will apply to both no-index and regular diffs. */
rev.diffopt.stat_width = -1;
rev.diffopt.stat_graph_width = -1;
@@ -347,7 +329,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
/* If this is a no-index diff, just run it and exit there. */
if (no_index)
- diff_no_index(&rev, argc, argv);
+ exit(diff_no_index(&rev, no_index == DIFF_NO_INDEX_IMPLICIT,
+ argc, argv));
+
/*
* Otherwise, we are doing the usual "git" diff; set up any