|
| 1 | +#!/bin/bash |
| 2 | +set -eu -o pipefail |
| 3 | + |
| 4 | +git init; |
| 5 | + |
| 6 | +function baseline() { |
| 7 | + local kind=$1 |
| 8 | + local refspec=$2 |
| 9 | + |
| 10 | + cat <<EOF >.git/config |
| 11 | +[remote "test"] |
| 12 | + url = . |
| 13 | + $kind = "$refspec" |
| 14 | +EOF |
| 15 | + |
| 16 | + git ls-remote "test" && status=0 || status=$? |
| 17 | + { |
| 18 | + echo "$kind" "$refspec" |
| 19 | + echo "$status" |
| 20 | + } >> baseline.git |
| 21 | +} |
| 22 | + |
| 23 | + |
| 24 | +# invalid |
| 25 | + |
| 26 | +baseline push '' |
| 27 | +baseline push '::' |
| 28 | +baseline fetch '::' |
| 29 | + |
| 30 | +baseline push 'refs/heads/*:refs/remotes/frotz' |
| 31 | +baseline push 'refs/heads:refs/remotes/frotz/*' |
| 32 | + |
| 33 | +baseline fetch 'refs/heads/*:refs/remotes/frotz' |
| 34 | +baseline fetch 'refs/heads:refs/remotes/frotz/*' |
| 35 | +baseline fetch 'refs/heads/main::refs/remotes/frotz/xyzzy' |
| 36 | +baseline fetch 'refs/heads/maste :refs/remotes/frotz/xyzzy' |
| 37 | +baseline fetch 'main~1:refs/remotes/frotz/backup' |
| 38 | +baseline fetch 'HEAD~4:refs/remotes/frotz/new' |
| 39 | +baseline push 'refs/heads/ nitfol' |
| 40 | +baseline fetch 'refs/heads/ nitfol' |
| 41 | +baseline push 'HEAD:' |
| 42 | +baseline push 'refs/heads/ nitfol:' |
| 43 | +baseline fetch 'refs/heads/ nitfol:' |
| 44 | +baseline push ':refs/remotes/frotz/delete me' |
| 45 | +baseline fetch ':refs/remotes/frotz/HEAD to me' |
| 46 | +baseline fetch 'refs/heads/*/*/for-linus:refs/remotes/mine/*' |
| 47 | +baseline push 'refs/heads/*/*/for-linus:refs/remotes/mine/*' |
| 48 | + |
| 49 | +baseline fetch 'refs/heads/*g*/for-linus:refs/remotes/mine/*' |
| 50 | +baseline push 'refs/heads/*g*/for-linus:refs/remotes/mine/*' |
| 51 | +bad=$(printf '\011tab') |
| 52 | +baseline fetch "refs/heads/${bad}" |
| 53 | + |
| 54 | +# valid |
| 55 | +baseline push '+:' |
| 56 | +baseline push ':' |
| 57 | + |
| 58 | +baseline fetch '' |
| 59 | +baseline fetch ':' |
| 60 | +baseline push 'refs/heads/main:refs/remotes/frotz/xyzzy' |
| 61 | +baseline push 'refs/heads/*:refs/remotes/frotz/*' |
| 62 | + |
| 63 | + |
| 64 | +baseline fetch 'refs/heads/*:refs/remotes/frotz/*' |
| 65 | +baseline fetch 'refs/heads/main:refs/remotes/frotz/xyzzy' |
| 66 | + |
| 67 | +baseline push 'main~1:refs/remotes/frotz/backup' |
| 68 | +baseline push 'HEAD~4:refs/remotes/frotz/new' |
| 69 | + |
| 70 | +baseline push 'HEAD' |
| 71 | +baseline fetch 'HEAD' |
| 72 | +baseline push '@' |
| 73 | +baseline fetch '@' |
| 74 | + |
| 75 | +baseline fetch 'HEAD:' |
| 76 | + |
| 77 | +baseline push ':refs/remotes/frotz/deleteme' |
| 78 | +baseline fetch ':refs/remotes/frotz/HEAD-to-me' |
| 79 | + |
| 80 | +baseline fetch 'refs/heads/*/for-linus:refs/remotes/mine/*-blah' |
| 81 | +baseline push 'refs/heads/*/for-linus:refs/remotes/mine/*-blah' |
| 82 | + |
| 83 | +baseline fetch 'refs/heads*/for-linus:refs/remotes/mine/*' |
| 84 | +baseline push 'refs/heads*/for-linus:refs/remotes/mine/*' |
| 85 | + |
| 86 | + |
| 87 | +baseline fetch 'refs/heads/*/for-linus:refs/remotes/mine/*' |
| 88 | +baseline push 'refs/heads/*/for-linus:refs/remotes/mine/*' |
| 89 | + |
| 90 | +good=$(printf '\303\204') |
| 91 | +baseline fetch "refs/heads/${good}" |
0 commit comments