3 test_description
='refspec parsing'
7 test_expect
=test_expect_success
11 kind
=$1 refspec
=$2 expect
=$3
12 git config remote.frotz.url
"." &&
13 git config
--remove-section remote.frotz
&&
14 git config remote.frotz.url
"." &&
15 git config
"remote.frotz.$kind" "$refspec" &&
16 if test "$expect" != invalid
18 title
="$kind $refspec"
19 test='git ls-remote frotz'
21 title
="$kind $refspec (invalid)"
22 test='test_must_fail git ls-remote frotz'
24 $test_expect "$title" "$test"
27 test_refspec push
'' invalid
29 test_refspec push
'::' invalid
30 test_refspec push
'+:'
33 test_refspec fetch
':'
34 test_refspec fetch
'::' invalid
36 test_refspec push
'refs/heads/*:refs/remotes/frotz/*'
37 test_refspec push
'refs/heads/*:refs/remotes/frotz' invalid
38 test_refspec push
'refs/heads:refs/remotes/frotz/*' invalid
39 test_refspec push
'refs/heads/master:refs/remotes/frotz/xyzzy'
42 # These have invalid LHS, but we do not have a formal "valid sha-1
43 # expression syntax checker" so they are not checked with the current
44 # code. They will be caught downstream anyway, but we may want to
45 # have tighter check later...
47 : test_refspec push
'refs/heads/master::refs/remotes/frotz/xyzzy' invalid
48 : test_refspec push
'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid
50 test_refspec fetch
'refs/heads/*:refs/remotes/frotz/*'
51 test_refspec fetch
'refs/heads/*:refs/remotes/frotz' invalid
52 test_refspec fetch
'refs/heads:refs/remotes/frotz/*' invalid
53 test_refspec fetch
'refs/heads/master:refs/remotes/frotz/xyzzy'
56 *MINGW
*) test_expect
=test_expect_failure
;;
57 *) test_expect
=test_expect_success
;;
59 test_refspec fetch
'refs/heads/master::refs/remotes/frotz/xyzzy' invalid
60 test_expect
=test_expect_success
62 test_refspec fetch
'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid
64 test_refspec push
'master~1:refs/remotes/frotz/backup'
65 test_refspec fetch
'master~1:refs/remotes/frotz/backup' invalid
66 test_refspec push
'HEAD~4:refs/remotes/frotz/new'
67 test_refspec fetch
'HEAD~4:refs/remotes/frotz/new' invalid
69 test_refspec push
'HEAD'
70 test_refspec fetch
'HEAD'
71 test_refspec push
'refs/heads/ nitfol' invalid
72 test_refspec fetch
'refs/heads/ nitfol' invalid
74 test_refspec push
'HEAD:' invalid
75 test_refspec fetch
'HEAD:'
76 test_refspec push
'refs/heads/ nitfol:' invalid
77 test_refspec fetch
'refs/heads/ nitfol:' invalid
79 test_refspec push
':refs/remotes/frotz/deleteme'
80 test_refspec fetch
':refs/remotes/frotz/HEAD-to-me'
81 test_refspec push
':refs/remotes/frotz/delete me' invalid
82 test_refspec fetch
':refs/remotes/frotz/HEAD to me' invalid