Skip to content

Commit 362bd46

Browse files
committed
all baseline test cases from git's test-suite (#450)
1 parent d406689 commit 362bd46

File tree

4 files changed

+102
-1
lines changed

4 files changed

+102
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:0a85fe0b4d9fb179baab26ea008ddbb48a657d4e92561c42a213269468481a66
3+
size 9308
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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}"

git-refspec/tests/parse/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use git_testtools::scripted_fixture_repo_read_only;
2+
3+
#[test]
4+
#[ignore]
5+
fn baseline() {
6+
let _dir = scripted_fixture_repo_read_only("make_baseline.sh").unwrap();
7+
}

git-refspec/tests/refspec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1+
mod parse;

0 commit comments

Comments
 (0)