diff options
author | Tim Henigan <tim.henigan@gmail.com> | 2012-06-21 20:09:51 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-06-22 19:26:13 +0200 |
commit | 304970dd5d9e542e70eca98932c1e9f26770678e (patch) | |
tree | 2bc20aad574aa22b6d41dd9c797eb5b1ef474a7a /diff-no-index.c | |
parent | diff: handle relative paths in no-index (diff) | |
download | git-304970dd5d9e542e70eca98932c1e9f26770678e.tar.xz git-304970dd5d9e542e70eca98932c1e9f26770678e.zip |
diff-no-index: exit(1) if 'diff --quiet <repo file> <external file>' finds changes
When running 'git diff --quiet <file1> <file2>', if file1 or file2
is outside the repository, it will exit(0) even if the files differ.
It should exit(1) when they differ.
This happens because 'diff_no_index' looks at the 'found_changes'
member from 'diff_options' to determine if changes were made. This
is the wrong thing to do, since it is only set if xdiff is actually
run and it finds a change (the diff machinery will optimize out the
xdiff call when it is not necessary) and in that case HAS_CHANGED
flag needs to be taken into account.
Use diff_result_code() that knows all these details for the correct
exit value instead.
Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-no-index.c')
-rw-r--r-- | diff-no-index.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/diff-no-index.c b/diff-no-index.c index e6b9952b34..63c31cc4de 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -256,5 +256,5 @@ void diff_no_index(struct rev_info *revs, * The return code for --no-index imitates diff(1): * 0 = no changes, 1 = changes, else error */ - exit(revs->diffopt.found_changes); + exit(diff_result_code(&revs->diffopt, 0)); } |