Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-07-05 02:08:18 +0300
committerJunio C Hamano <gitster@pobox.com>2023-07-05 02:08:18 +0300
commit812907d16fb46181d6eb17309dde697edfd06add (patch)
treeccc8403444c57cc8266b62b46b3487668bfa54bc /t
parent9748a6820043d5815bee770ffa51647e0adc2cf0 (diff)
parentc40f0b78771ecc8696014e2e0aa37e78417b4723 (diff)
Merge branch 'ps/revision-stdin-with-options'
The set-up code for the get_revision() API now allows feeding options like --all and --not in the --stdin mode. * ps/revision-stdin-with-options: revision: handle pseudo-opts in `--stdin` mode revision: small readability improvement for reading from stdin revision: reorder `read_revisions_from_stdin()`
Diffstat (limited to 't')
-rwxr-xr-xt/t6017-rev-list-stdin.sh51
1 files changed, 50 insertions, 1 deletions
diff --git a/t/t6017-rev-list-stdin.sh b/t/t6017-rev-list-stdin.sh
index 05162512a0..a57f1ae2ba 100755
--- a/t/t6017-rev-list-stdin.sh
+++ b/t/t6017-rev-list-stdin.sh
@@ -48,7 +48,9 @@ test_expect_success setup '
git add file-$i &&
test_tick &&
git commit -m side-$i || exit
- done
+ done &&
+
+ git update-ref refs/heads/-dashed-branch HEAD
)
'
@@ -60,6 +62,12 @@ check side-1 ^side-7 -- file-2
check side-3 ^side-4 -- file-3
check side-3 ^side-2
check side-3 ^side-2 -- file-1
+check --all
+check --all --not --branches
+check --glob=refs/heads
+check --glob=refs/heads --
+check --glob=refs/heads -- file-1
+check --end-of-options -dashed-branch
test_expect_success 'not only --stdin' '
cat >expect <<-EOF &&
@@ -78,4 +86,45 @@ test_expect_success 'not only --stdin' '
test_cmp expect actual
'
+test_expect_success 'pseudo-opt with missing value' '
+ cat >input <<-EOF &&
+ --glob
+ refs/heads
+ EOF
+
+ cat >expect <<-EOF &&
+ fatal: Option ${SQ}--glob${SQ} requires a value
+ EOF
+
+ test_must_fail git rev-list --stdin <input 2>error &&
+ test_cmp expect error
+'
+
+test_expect_success 'pseudo-opt with invalid value' '
+ cat >input <<-EOF &&
+ --no-walk=garbage
+ EOF
+
+ cat >expect <<-EOF &&
+ error: invalid argument to --no-walk
+ fatal: invalid option ${SQ}--no-walk=garbage${SQ} in --stdin mode
+ EOF
+
+ test_must_fail git rev-list --stdin <input 2>error &&
+ test_cmp expect error
+'
+
+test_expect_success 'unknown option without --end-of-options' '
+ cat >input <<-EOF &&
+ -dashed-branch
+ EOF
+
+ cat >expect <<-EOF &&
+ fatal: invalid option ${SQ}-dashed-branch${SQ} in --stdin mode
+ EOF
+
+ test_must_fail git rev-list --stdin <input 2>error &&
+ test_cmp expect error
+'
+
test_done