aboutsummaryrefslogtreecommitdiff
path: root/builtin-diff-index.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2007-03-14 01:17:04 +0100
committerJunio C Hamano <junkio@cox.net>2007-03-14 16:21:19 -0700
commit41bbf9d58575095234c64df979ee884334469758 (patch)
tree916fb0b719369166e3cea928ec4831482ad4e9fa /builtin-diff-index.c
parent803527f1d9b284fa848d4a4bad23158c162a5d54 (diff)
downloadgit-41bbf9d58575095234c64df979ee884334469758.tar.gz
git-41bbf9d58575095234c64df979ee884334469758.tar.xz
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 'builtin-diff-index.c')
-rw-r--r--builtin-diff-index.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-diff-index.c b/builtin-diff-index.c
index 083599d5c..d90eba95a 100644
--- a/builtin-diff-index.c
+++ b/builtin-diff-index.c
@@ -14,6 +14,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
struct rev_info rev;
int cached = 0;
int i;
+ int result;
init_revisions(&rev, prefix);
git_config(git_default_config); /* no "diff" UI options */
@@ -42,5 +43,6 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
perror("read_cache");
return -1;
}
- return run_diff_index(&rev, cached);
+ result = run_diff_index(&rev, cached);
+ return rev.diffopt.exit_with_status ? rev.diffopt.has_changes: result;
}