diff --no-index: clarify operation when not inside a repository
Clarify documentation for "diff --no-index". State that when not inside a repository, --no-index is implied and two arguments are mandatory. Clarify error message from diff-no-index to inform user that CWD is not inside a repository and thus two arguments are mandatory. Signed-off-by: Dale Worley <worley@ariadne.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
a3bc3d070c
commit
b214eddfb2
@ -215,9 +215,21 @@ void diff_no_index(struct rev_info *revs,
|
||||
path_inside_repo(prefix, argv[i+1])))
|
||||
return;
|
||||
}
|
||||
if (argc != i + 2)
|
||||
if (argc != i + 2) {
|
||||
if (!no_index) {
|
||||
/*
|
||||
* 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 ? "--no-index" : "[--no-index]");
|
||||
}
|
||||
|
||||
diff_setup(&revs->diffopt);
|
||||
for (i = 1; i < argc - 2; ) {
|
||||
|
Reference in New Issue
Block a user