t1503: test rev-parse --verify --quiet with deleted reflogs
PATCH v3 1/3 t1503: test rev-parse --verify --quiet with deleted reflogs
Ensure that rev-parse --verify --quiet is silent when asked about deleted reflog entries.
---
Differences since last time:
This goes back to the original approach of using "git update-ref" plumbing instead of "git branch" when testing deleted reflogs.
t/t1503-rev-parse-verify.sh | 9 +++++++++ 1 file changed, 9 insertions(+)
t/t1503-rev-parse-verify.sh +9 -0
@@ -83,6 +83,15 @@ test_expect_success 'fails silently when using -q' ' test -z "$(cat error)" ' +test_expect_success 'fails silently when using -q with deleted reflogs' ' + ref=$(git rev-parse HEAD) && + : >.git/logs/refs/test && + git update-ref -m "reflog message for refs/test" refs/test "$ref" && + git reflog delete --updateref --rewrite refs/test@{0} && + test_must_fail git rev-parse -q --verify refs/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)" &&
Signature · 1 line
2.1.0.30.g05c535b.dirty
PATCH v3 2/3 t1503: use test_must_be_empty
Use test_must_be_be_empty <file> instead of test -z "$(cat <file>)".
---
Unchanged since last time, but rebased for the change in the previous patch.
t/t1503-rev-parse-verify.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
t/t1503-rev-parse-verify.sh +6 -6
@@ -72,15 +72,15 @@ 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' '
@@ -89,7 +89,7 @@ test_expect_success 'fails silently when using -q with deleted reflogs' ' git update-ref -m "reflog message for refs/test" refs/test "$ref" && git reflog delete --updateref --rewrite refs/test@{0} && test_must_fail git rev-parse -q --verify refs/test@{0} >error 2>&1 && - test -z "$(cat error)" + test_must_be_empty error ' test_expect_success 'no stdout output on error' '
Signature · 1 line
2.1.0.30.g05c535b.dirty
PATCH v3 3/3 Documentation: a note about stdout for git rev-parse --verify --quiet
---
This patch is new: we now mention that stdout contains the valid object name when --quiet is used, which may not be clear when reading this paragraph in isolation.
Documentation/git-rev-parse.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/git-rev-parse.txt +1 -0
@@ -114,6 +114,7 @@ can be used. Only meaningful in `--verify` mode. Do not output an error message if the first argument is not a valid object name; instead exit with non-zero status silently. + SHA-1s for valid object names are printed to stdout on success. --sq:: Usually the output is made one line per flag and
Signature · 1 line
2.1.0.30.g05c535b.dirty
Re: [PATCH v3 3/3] Documentation: a note about stdout for git rev-parse --verify --quiet
Quoted 14 lines · David Aguilar
Signed-off-by David Aguilar <[email protected]>---
This patch is new: we now mention that stdout contains the valid object name when --quiet is used, which may not be clear when reading this paragraph in isolation.Documentation/git-rev-parse.txt | 1 + 1 file changed, 1 insertion(+)Documentation/git-rev-parse.txt +0
-0
Documentation/git-rev-parse.txt can be used. · line 117
Quoted 4 lines
Documentation/git-rev-parse.txt +1
-0@@ -114,6 +114,7 @@ can be used. Only meaningful in `--verify` mode. Do not output an error message if the first argument is not a valid object name; instead exit with non-zero status silently. + SHA-1s for valid object names are printed to stdout on success.
OK. Thanks.
Quoted 3 lines
Documentation/git-rev-parse.txt +0
-0--sq:: Usually the output is made one line per flag and
Re: [PATCH v3 2/3] t1503: use test_must_be_empty
In reply to David AguilarQuoted 7 lines · David Aguilar
Use
test_must_be_be_empty <file>instead oftest -z "$(cat <file>)".Suggested-by Fabian Ruch <[email protected]>Signed-off-by David Aguilar <[email protected]>---
Unchanged since last time, but rebased for the change in the previous patch.
It probably makes more sense to have this at the beginning of a series as preliminary clean-up. That way, the more interesting change does not have to have "test -z $(cat ...)" that makes readers go "Huh?".
Quoted 38 lines
t/t1503-rev-parse-verify.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)t/t1503-rev-parse-verify.sh +6
-6@@ -72,15 +72,15 @@ 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' '@@ -89,7 +89,7 @@ test_expect_success 'fails silently when using -q with deleted reflogs' ' git update-ref -m "reflog message for refs/test" refs/test "$ref" && git reflog delete --updateref --rewrite refs/test@{0} && test_must_fail git rev-parse -q --verify refs/test@{0} >error 2>&1 && - test -z "$(cat error)" + test_must_be_empty error ' test_expect_success 'no stdout output on error' '
Quoted 10 lines · David Aguilar
Ensure that rev-parse --verify --quiet is silent when asked about deleted reflog entries.
Helped-by Fabian Ruch <[email protected]>Signed-off-by David Aguilar <[email protected]>---
Differences since last time:This goes back to the original approach of using "git update-ref" plumbing instead of "git branch" when testing deleted reflogs.
Is this 1/3 (the first one in the series) supposed to pass without no other patches, either in the series or something outside?
Quoted 10 lines · Junio C Hamano
Quoted 8 lines · David Aguilar
Ensure that rev-parse --verify --quiet is silent when asked about deleted reflog entries.
Helped-by Fabian Ruch <[email protected]>Signed-off-by David Aguilar <[email protected]>---
Differences since last time:
Quoted 6 lines
Quoted 2 lines
This goes back to the original approach of using "git update-ref" plumbing instead of "git branch" when testing deleted reflogs.
Is this 1/3 (the first one in the series) supposed to pass without no other patches, either in the series or something outside?
It depends on the patch I sent not too long ago that makes rev-parse --quiet actually quiet.
I'll rework this series to do the test_must_be_empty cleanup first and include the prerequisite patch when I re-roll shortly.
Signature · 1 line
David