mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
rev-list: don't show usage when we see empty ref patterns
If the user gives us no starting point for a traversal, we want to complain with our normal usage message. But if they tried to do so with "--all" or "--glob", but that happened not to match any refs, the usage message isn't helpful. We should just give them the empty output they asked for instead. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
7ba826290a
commit
0159ba3226
|
@ -350,7 +350,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
if ((!revs.commits &&
|
if ((!revs.commits &&
|
||||||
(!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
|
(!(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
|
||||||
!revs.pending.nr)) ||
|
!revs.pending.nr) &&
|
||||||
|
!revs.rev_input_given) ||
|
||||||
revs.diff)
|
revs.diff)
|
||||||
usage(rev_list_usage);
|
usage(rev_list_usage);
|
||||||
|
|
||||||
|
|
|
@ -261,13 +261,13 @@ test_expect_failure 'rev-list should succeed with empty output on empty stdin' '
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'rev-list should succeed with empty output with all refs excluded' '
|
test_expect_success 'rev-list should succeed with empty output with all refs excluded' '
|
||||||
>expect &&
|
>expect &&
|
||||||
git rev-list --exclude=* --all >actual &&
|
git rev-list --exclude=* --all >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'rev-list should succeed with empty output with empty --all' '
|
test_expect_success 'rev-list should succeed with empty output with empty --all' '
|
||||||
(
|
(
|
||||||
test_create_repo empty &&
|
test_create_repo empty &&
|
||||||
cd empty &&
|
cd empty &&
|
||||||
|
@ -277,7 +277,7 @@ test_expect_failure 'rev-list should succeed with empty output with empty --all'
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_failure 'rev-list should succeed with empty output with empty glob' '
|
test_expect_success 'rev-list should succeed with empty output with empty glob' '
|
||||||
>expect &&
|
>expect &&
|
||||||
git rev-list --glob=does-not-match-anything >actual &&
|
git rev-list --glob=does-not-match-anything >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
|
|
Loading…
Reference in a new issue