* [PATCH v2 1/2] t1503: test rev-parse --verify --quiet with deleted reflogs
@ 2014-09-14 19:03 David Aguilar
2014-09-14 19:03 ` [PATCH v2 2/2] t1503: use test_must_be_empty David Aguilar
0 siblings, 1 reply; 2+ messages in thread
From: David Aguilar @ 2014-09-14 19:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Fabian Ruch
Ensure that rev-parse --verify --quiet is silent when asked
about deleted reflog entries.
Helped-by: Fabian Ruch <bafain@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
Changes since last time:
Use "git branch test" instead of low-level plumbing commands.
Capture both stdout and stderr in the test.
t/t1503-rev-parse-verify.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh
index 813cc1b..ab9878d 100755
--- a/t/t1503-rev-parse-verify.sh
+++ b/t/t1503-rev-parse-verify.sh
@@ -83,6 +83,13 @@ test_expect_success 'fails silently when using -q' '
test -z "$(cat error)"
'
+test_expect_success 'fails silently when using -q with deleted reflogs' '
+ git branch test &&
+ git reflog delete --updateref --rewrite test@{0} &&
+ test_must_fail git rev-parse -q --verify test@{0} >error 2>&1 &&
+ test -z "$(cat error)"
+'
+
test_expect_success 'no stdout output on error' '
test -z "$(git rev-parse --verify)" &&
test -z "$(git rev-parse --verify foo)" &&
--
2.1.0.30.g05c535b.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v2 2/2] t1503: use test_must_be_empty
2014-09-14 19:03 [PATCH v2 1/2] t1503: test rev-parse --verify --quiet with deleted reflogs David Aguilar
@ 2014-09-14 19:03 ` David Aguilar
0 siblings, 0 replies; 2+ messages in thread
From: David Aguilar @ 2014-09-14 19:03 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Fabian Ruch
Use `test_must_be_be_empty <file>` instead of `test -z "$(cat <file>)"`.
Suggested-by: Fabian Ruch <bafain@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
---
t/t1503-rev-parse-verify.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh
index ab9878d..9ac4627 100755
--- a/t/t1503-rev-parse-verify.sh
+++ b/t/t1503-rev-parse-verify.sh
@@ -72,22 +72,22 @@ test_expect_success 'fails with any bad rev or many good revs' '
test_expect_success 'fails silently when using -q' '
test_must_fail git rev-parse --verify --quiet 2>error &&
- test -z "$(cat error)" &&
+ test_must_be_empty error &&
test_must_fail git rev-parse -q --verify foo 2>error &&
- test -z "$(cat error)" &&
+ test_must_be_empty error &&
test_must_fail git rev-parse --verify -q HEAD bar 2>error &&
- test -z "$(cat error)" &&
+ test_must_be_empty error &&
test_must_fail git rev-parse --quiet --verify baz HEAD 2>error &&
- test -z "$(cat error)" &&
+ test_must_be_empty error &&
test_must_fail git rev-parse -q --verify $HASH2 HEAD 2>error &&
- test -z "$(cat error)"
+ test_must_be_empty error
'
test_expect_success 'fails silently when using -q with deleted reflogs' '
git branch test &&
git reflog delete --updateref --rewrite test@{0} &&
test_must_fail git rev-parse -q --verify test@{0} >error 2>&1 &&
- test -z "$(cat error)"
+ test_must_be_empty error
'
test_expect_success 'no stdout output on error' '
--
2.1.0.30.g05c535b.dirty
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-14 19:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-14 19:03 [PATCH v2 1/2] t1503: test rev-parse --verify --quiet with deleted reflogs David Aguilar
2014-09-14 19:03 ` [PATCH v2 2/2] t1503: use test_must_be_empty David Aguilar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).