diff options
author | Alex Riesen <raa.lkml@gmail.com> | 2007-03-14 01:17:04 +0100 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-03-14 16:21:19 -0700 |
commit | 41bbf9d58575095234c64df979ee884334469758 (patch) | |
tree | 916fb0b719369166e3cea928ec4831482ad4e9fa /builtin-diff-tree.c | |
parent | 803527f1d9b284fa848d4a4bad23158c162a5d54 (diff) | |
download | git-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-tree.c')
-rw-r--r-- | builtin-diff-tree.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin-diff-tree.c b/builtin-diff-tree.c index 24cb2d7f8..0b591c871 100644 --- a/builtin-diff-tree.c +++ b/builtin-diff-tree.c @@ -118,7 +118,8 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix) } if (!read_stdin) - return 0; + return opt->diffopt.exit_with_status ? + opt->diffopt.has_changes: 0; if (opt->diffopt.detect_rename) opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE | @@ -133,5 +134,5 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix) else diff_tree_stdin(line); } - return 0; + return opt->diffopt.exit_with_status ? opt->diffopt.has_changes: 0; } |