3 test_description
='send-pack --stdin tests'
5 TEST_PASSES_SANITIZE_LEAK
=true
9 tree
=$
(git write-tree
) &&
11 commit
=$
(echo "$1" | git commit-tree
$tree) &&
12 git update-ref
"$1" $commit
17 git init
--bare remote.git
21 git rev-parse
"$1" >expect
&&
22 git
--git-dir=remote.git rev-parse
"${2:-$1}" >actual
&&
23 test_cmp expect actual
26 test_expect_success
'setup refs' '
34 for i in $(cat refs); do
35 create_ref $i || return 1
39 # sanity check our setup
40 test_expect_success
'refs on cmdline' '
42 git send-pack remote.git $(cat refs) &&
43 for i in $(cat refs); do
44 verify_push $i || return 1
48 test_expect_success
'refs over stdin' '
50 git send-pack remote.git --stdin <refs &&
51 for i in $(cat refs); do
52 verify_push $i || return 1
56 test_expect_success
'stdin lines are full refspecs' '
58 echo "A:other" >input &&
59 git send-pack remote.git --stdin <input &&
60 verify_push refs/heads/A refs/heads/other
63 test_expect_success
'stdin mixed with cmdline' '
66 git send-pack remote.git --stdin B <input &&
71 test_expect_success
'cmdline refs written in order' '
73 test_must_fail git send-pack remote.git A:foo B:foo &&
77 test_expect_success
'--stdin refs come after cmdline' '
80 test_must_fail git send-pack remote.git --stdin B:foo <input &&
84 test_expect_success
'refspecs and --mirror do not mix (cmdline)' '
86 test_must_fail git send-pack remote.git --mirror $(cat refs)
89 test_expect_success
'refspecs and --mirror do not mix (stdin)' '
91 test_must_fail git send-pack remote.git --mirror --stdin <refs