3 test_description='send-pack --stdin tests'
7 tree=$(git write-tree) &&
9 commit=$(echo "$1" | git commit-tree $tree) &&
10 git update-ref "$1" $commit
15 git init --bare remote.git
19 git rev-parse "$1" >expect &&
20 git --git-dir=remote.git rev-parse "${2:-$1}" >actual &&
21 test_cmp expect actual
24 test_expect_success 'setup refs' '
32 for i in $(cat refs); do
33 create_ref $i || return 1
37 # sanity check our setup
38 test_expect_success 'refs on cmdline' '
40 git send-pack remote.git $(cat refs) &&
41 for i in $(cat refs); do
42 verify_push $i || return 1
46 test_expect_success 'refs over stdin' '
48 git send-pack remote.git --stdin <refs &&
49 for i in $(cat refs); do
50 verify_push $i || return 1
54 test_expect_success 'stdin lines are full refspecs' '
56 echo "A:other" >input &&
57 git send-pack remote.git --stdin <input &&
58 verify_push refs/heads/A refs/heads/other
61 test_expect_success 'stdin mixed with cmdline' '
64 git send-pack remote.git --stdin B <input &&
69 test_expect_success 'cmdline refs written in order' '
71 test_must_fail git send-pack remote.git A:foo B:foo &&
75 test_expect_success '--stdin refs come after cmdline' '
78 test_must_fail git send-pack remote.git --stdin B:foo <input &&
82 test_expect_success 'refspecs and --mirror do not mix (cmdline)' '
84 test_must_fail git send-pack remote.git --mirror $(cat refs)
87 test_expect_success 'refspecs and --mirror do not mix (stdin)' '
89 test_must_fail git send-pack remote.git --mirror --stdin <refs