summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 921df15)
raw | patch | inline | side by side (parent: 921df15)
author | Christian Couder <chriscool@tuxfamily.org> | |
Sun, 11 May 2008 16:27:36 +0000 (18:27 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 11 May 2008 18:36:07 +0000 (11:36 -0700) |
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>
$ 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>
builtin-rev-parse.c | patch | blob | history | |
t/t1503-rev-parse-verify.sh | patch | blob | history |
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 0e597073239c97160582fbb7047794796f67987f..7dbf282f5e3bbec829bdfcf84d793e5dca85bfaa 100644 (file)
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
continue;
verify_filename(prefix, arg);
}
+ if (verify && revs_count == 1)
+ return 0;
show_default();
if (verify && revs_count != 1)
die_no_single_rev(quiet);
index a0d14cb9c382d840f16f0c661d79ef04336dc63a..e93f1b38ef5a1af47fb962078d86f3a1cc35b10d 100755 (executable)
test -z "$(git rev-parse --verify $HASH2 HEAD)"
'
-test_expect_success '1 with --default' '
+test_expect_success 'use --default' '
git rev-parse --verify --default master &&
git rev-parse --verify --default master HEAD &&
git rev-parse --default master --verify &&
git rev-parse --default master --verify HEAD &&
+ git rev-parse --verify HEAD --default master &&
test_must_fail git rev-parse --verify foo --default master &&
test_must_fail git rev-parse --default HEAD --verify bar &&
- test_must_fail git rev-parse --verify --default HEAD baz
-'
-
-test_expect_failure '2 with --default' '
- git rev-parse --verify HEAD --default master
+ test_must_fail git rev-parse --verify --default HEAD baz &&
+ test_must_fail git rev-parse --default foo --verify &&
+ test_must_fail git rev-parse --verify --default bar
'
test_done