summaryrefslogtreecommitdiff
path: root/builtin-rev-parse.c
diff options
context:
space:
mode:
authorLibravatar Christian Couder <chriscool@tuxfamily.org>2008-05-11 18:27:36 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-05-11 11:36:07 -0700
commit28bfa145e4dedad9b2c81857b77ca13871c77853 (patch)
tree56bb50b80e3977dc9f28f3fa5d2b5853876c634b /builtin-rev-parse.c
parentrev-parse: add test script for "--verify" (diff)
downloadtgif-28bfa145e4dedad9b2c81857b77ca13871c77853.tar.xz
rev-parse: fix using "--default" with "--verify"
Before this patch, something like: $ git rev-parse --verify HEAD --default master did not work, while: $ git rev-parse --default master --verify HEAD worked. This patch fixes that, so that they both work (assuming HEAD and master can be parsed). Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-rev-parse.c')
-rw-r--r--builtin-rev-parse.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 0e59707323..7dbf282f5e 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -583,6 +583,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
continue;
verify_filename(prefix, arg);
}
+ if (verify && revs_count == 1)
+ return 0;
show_default();
if (verify && revs_count != 1)
die_no_single_rev(quiet);