]> git.ipfire.org Git - thirdparty/git.git/commitdiff
git-diff.txt: document return code of `--no-index`
authorDenton Liu <liu.denton@gmail.com>
Tue, 29 Oct 2019 16:54:32 +0000 (09:54 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 2 Nov 2019 04:16:41 +0000 (13:16 +0900)
Within diff_no_index(), we have the following:

revs->diffopt.flags.exit_with_status = 1;

...

/*
 * The return code for --no-index imitates diff(1):
 * 0 = no changes, 1 = changes, else error
 */
return diff_result_code(&revs->diffopt, 0);

Which means when `git diff` is run in `--no-index` mode, `--exit-code`
is implied. However, the documentation for this is missing in
git-diff.txt.

Add a note about how `--exit-code` is implied in the `--no-index`
documentation to cover this documentation blindspot.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-diff.txt

index 72179d993cb9b68766e2d9093f323cb3720e38f4..37781cf175547c05b8ec3ec97aa2e700196c6471 100644 (file)
@@ -36,7 +36,7 @@ two blob objects, or changes between two files on disk.
        running the command in a working tree controlled by Git and
        at least one of the paths points outside the working tree,
        or when running the command outside a working tree
-       controlled by Git.
+       controlled by Git. This form implies `--exit-code`.
 
 'git diff' [<options>] --cached [<commit>] [--] [<path>...]::