for-each-ref: explicitly test no matches
The for-each-ref builtin can take a list of ref patterns, but if none match, it still succeeds (but with no output). Add an explicit test that demonstrates that behavior. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
b73dec5530
commit
b2c51b7590
@ -1501,4 +1501,17 @@ test_expect_success 'git for-each-ref --stdin: matches' '
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'git for-each-ref with non-existing refs' '
|
||||
cat >in <<-EOF &&
|
||||
refs/heads/this-ref-does-not-exist
|
||||
refs/tags/bogus
|
||||
EOF
|
||||
|
||||
git for-each-ref --format="%(refname)" --stdin <in >actual &&
|
||||
test_must_be_empty actual &&
|
||||
|
||||
xargs git for-each-ref --format="%(refname)" <in >actual &&
|
||||
test_must_be_empty actual
|
||||
'
|
||||
|
||||
test_done
|
||||
|
Loading…
Reference in New Issue
Block a user