Windows ANSI - hook write()
[git/mingw/4msysgit/peterh.git] / t / t5511-refspec.sh
blob1baf215af5f1c098e358b499c9e16d2234f9cea0
1 #!/bin/sh
3 test_description='refspec parsing'
5 . ./test-lib.sh
7 test_expect=test_expect_success
9 test_refspec () {
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
17 then
18 title="$kind $refspec"
19 test='git ls-remote frotz'
20 else
21 title="$kind $refspec (invalid)"
22 test='test_must_fail git ls-remote frotz'
24 $test_expect "$title" "$test"
27 test_refspec push '' invalid
28 test_refspec push ':'
29 test_refspec push '::' invalid
30 test_refspec push '+:'
32 test_refspec fetch ''
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'
55 case $(uname -s) in
56 *MINGW*) test_expect=test_expect_failure;;
57 *) test_expect=test_expect_success;;
58 esac
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
84 test_done