summaryrefslogtreecommitdiff
path: root/builtin-diff-files.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-files.c
parent803527f1d9b284fa848d4a4bad23158c162a5d54 (diff)
downloadgit-41bbf9d58575095234c64df979ee884334469758.tar.gz
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-files.c')
-rw-r--r--builtin-diff-files.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-diff-files.c b/builtin-diff-files.c
index aec8338429..6ba5077a2b 100644
--- a/builtin-diff-files.c
+++ b/builtin-diff-files.c
@@ -17,6 +17,7 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
{
struct rev_info rev;
int nongit = 0;
+ int result;
prefix = setup_git_directory_gently(&nongit);
init_revisions(&rev, prefix);
@@ -29,5 +30,6 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
argc = setup_revisions(argc, argv, &rev, NULL);
if (!rev.diffopt.output_format)
rev.diffopt.output_format = DIFF_FORMAT_RAW;
- return run_diff_files_cmd(&rev, argc, argv);
+ result = run_diff_files_cmd(&rev, argc, argv);
+ return rev.diffopt.exit_with_status ? rev.diffopt.has_changes: result;
}