diff options
author | Petr Baudis <pasky@suse.cz> | 2005-07-29 14:53:38 +0200 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-08-01 15:20:14 -0700 |
commit | bbd14cb0113ca26d679970f4db9ad953fb273e36 (patch) | |
tree | 2e95edc112e7e6254ba6f817887dc94acbcdf370 /merge-cache.c | |
parent | 4d8fa916c9ff89613234f41b9222a2b679bce5c3 (diff) | |
download | git-bbd14cb0113ca26d679970f4db9ad953fb273e36.tar.gz |
[PATCH] git-merge-cache -q doesn't complain about failing merge program
git-merge-cache reporting failed merge program is undesirable for
Cogito, since it emits its own more appropriate error message in that
case. However, I want to show other possible git-merge-cache error
messages. So -q will just silence this particular error.
Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'merge-cache.c')
-rw-r--r-- | merge-cache.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/merge-cache.c b/merge-cache.c index 37c72d26ca..b2893e6e2d 100644 --- a/merge-cache.c +++ b/merge-cache.c @@ -5,7 +5,7 @@ static const char *pgm = NULL; static const char *arguments[8]; -static int one_shot; +static int one_shot, quiet; static int err; static void run_program(void) @@ -27,10 +27,13 @@ static void run_program(void) die("unable to execute '%s'", pgm); } if (waitpid(pid, &status, 0) < 0 || !WIFEXITED(status) || WEXITSTATUS(status)) { - if (one_shot) + if (one_shot) { err++; - else - die("merge program failed"); + } else { + if (quiet) + die("merge program failed"); + exit(1); + } } } @@ -97,15 +100,19 @@ int main(int argc, char **argv) int i, force_file = 0; if (argc < 3) - usage("git-merge-cache [-o] <merge-program> (-a | <filename>*)"); + usage("git-merge-cache [-o] [-q] <merge-program> (-a | <filename>*)"); read_cache(); i = 1; - if (!strcmp(argv[1], "-o")) { + if (!strcmp(argv[i], "-o")) { one_shot = 1; i++; } + if (!strcmp(argv[i], "-q")) { + quiet = 1; + i++; + } pgm = argv[i++]; for (; i < argc; i++) { char *arg = argv[i]; @@ -122,7 +129,7 @@ int main(int argc, char **argv) } merge_file(arg); } - if (err) + if (err && quiet) die("merge program failed"); - return 0; + return err; } |