summaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2007-03-14 00:17:04 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-03-14 23:21:19 (GMT)
commit41bbf9d58575095234c64df979ee884334469758 (patch)
tree916fb0b719369166e3cea928ec4831482ad4e9fa /diff-lib.c
parent803527f1d9b284fa848d4a4bad23158c162a5d54 (diff)
downloadgit-41bbf9d58575095234c64df979ee884334469758.zip
git-41bbf9d58575095234c64df979ee884334469758.tar.gz
git-41bbf9d58575095234c64df979ee884334469758.tar.bz2
Allow git-diff exit with codes similar to diff(1)
This introduces a new command-line option: --exit-code. The diff programs will return 1 for differences, return 0 for equality, and something else for errors. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 6abb981..f9a1a10 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -170,8 +170,10 @@ static int handle_diff_files_args(struct rev_info *revs,
else if (!strcmp(argv[1], "--theirs"))
revs->max_count = 3;
else if (!strcmp(argv[1], "-n") ||
- !strcmp(argv[1], "--no-index"))
+ !strcmp(argv[1], "--no-index")) {
revs->max_count = -2;
+ revs->diffopt.exit_with_status = 1;
+ }
else if (!strcmp(argv[1], "-q"))
*silent = 1;
else
@@ -237,6 +239,7 @@ int setup_diff_no_index(struct rev_info *revs,
break;
} else if (i < argc - 3 && !strcmp(argv[i], "--no-index")) {
i = argc - 3;
+ revs->diffopt.exit_with_status = 1;
break;
}
if (argc != i + 2 || (!is_outside_repo(argv[i + 1], nongit, prefix) &&