t6018: flesh out empty input/output rev-list tests
In 751a2ac6e (rev-list --exclude: tests, 2013-11-01), we added a few tests for handling "empty" inputs with rev-list (i.e., where the user gave us some pattern but it turned out not to queue any objects for traversal), all of which were marked as failing. In preparation for working on this area of the code, let's give each test a more descriptive name. Let's also include one more case which we should cover: feeding a --glob pattern that doesn't match anything. We can also drop the explanatory comment; we'll be converting these to expect_success in the next few patches, so the discussion isn't necessary. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Aug 2, 2017 at 18:24 UTC
0c5dc7431a01d325e815ce722d80ad549a41e632
1 file changed
+9
-11
t/t6018-rev-list-glob.sh
+9
-11
@@ -255,27 +255,19 @@ test_expect_success 'rev-list accumulates multiple --exclude' '
255
compare rev-list "--exclude=refs/remotes/* --exclude=refs/tags/* --all" --branches
256
'
257
258
-
259
-# "git rev-list<ENTER>" is likely to be a bug in the calling script and may
260
-# deserve an error message, but do cases where set of refs programmatically
261
-# given using globbing and/or --stdin need to fail with the same error, or
262
-# are we better off reporting a success with no output? The following few
263
-# tests document the current behaviour to remind us that we might want to
264
-# think about this issue.
265
-
266
-test_expect_failure 'rev-list may want to succeed with empty output on no input (1)' '
258
+test_expect_failure 'rev-list should succeed with empty output on empty stdin' '
259
>expect &&
260
git rev-list --stdin <expect >actual &&
261
test_cmp expect actual
262
'
263
272
-test_expect_failure 'rev-list may want to succeed with empty output on no input (2)' '
264
+test_expect_failure 'rev-list should succeed with empty output with all refs excluded' '
265
>expect &&
266
git rev-list --exclude=* --all >actual &&
267
test_cmp expect actual
268
'
269
278
-test_expect_failure 'rev-list may want to succeed with empty output on no input (3)' '
270
+test_expect_failure 'rev-list should succeed with empty output with empty --all' '
271
(
272
test_create_repo empty &&
273
cd empty &&
@@ -285,6 +277,12 @@ test_expect_failure 'rev-list may want to succeed with empty output on no input
277
)
278
'
279
280
+test_expect_failure 'rev-list should succeed with empty output with empty glob' '
281
+ >expect &&
282
+ git rev-list --glob=does-not-match-anything >actual &&
283
+ test_cmp expect actual
284
+'
285
+
286
test_expect_success 'shortlog accepts --glob/--tags/--remotes' '
287
288
compare shortlog "subspace/one subspace/two" --branches=subspace &&