Skip to content

Commit

Permalink
all baseline test cases from git's test-suite (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 5, 2022
1 parent d406689 commit 362bd46
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 1 deletion.
Git LFS file not shown
91 changes: 91 additions & 0 deletions git-refspec/tests/fixtures/make_baseline.sh
@@ -0,0 +1,91 @@
#!/bin/bash
set -eu -o pipefail

git init;

function baseline() {
local kind=$1
local refspec=$2

cat <<EOF >.git/config
[remote "test"]
url = .
$kind = "$refspec"
EOF

git ls-remote "test" && status=0 || status=$?
{
echo "$kind" "$refspec"
echo "$status"
} >> baseline.git
}


# invalid

baseline push ''
baseline push '::'
baseline fetch '::'

baseline push 'refs/heads/*:refs/remotes/frotz'
baseline push 'refs/heads:refs/remotes/frotz/*'

baseline fetch 'refs/heads/*:refs/remotes/frotz'
baseline fetch 'refs/heads:refs/remotes/frotz/*'
baseline fetch 'refs/heads/main::refs/remotes/frotz/xyzzy'
baseline fetch 'refs/heads/maste :refs/remotes/frotz/xyzzy'
baseline fetch 'main~1:refs/remotes/frotz/backup'
baseline fetch 'HEAD~4:refs/remotes/frotz/new'
baseline push 'refs/heads/ nitfol'
baseline fetch 'refs/heads/ nitfol'
baseline push 'HEAD:'
baseline push 'refs/heads/ nitfol:'
baseline fetch 'refs/heads/ nitfol:'
baseline push ':refs/remotes/frotz/delete me'
baseline fetch ':refs/remotes/frotz/HEAD to me'
baseline fetch 'refs/heads/*/*/for-linus:refs/remotes/mine/*'
baseline push 'refs/heads/*/*/for-linus:refs/remotes/mine/*'

baseline fetch 'refs/heads/*g*/for-linus:refs/remotes/mine/*'
baseline push 'refs/heads/*g*/for-linus:refs/remotes/mine/*'
bad=$(printf '\011tab')
baseline fetch "refs/heads/${bad}"

# valid
baseline push '+:'
baseline push ':'

baseline fetch ''
baseline fetch ':'
baseline push 'refs/heads/main:refs/remotes/frotz/xyzzy'
baseline push 'refs/heads/*:refs/remotes/frotz/*'


baseline fetch 'refs/heads/*:refs/remotes/frotz/*'
baseline fetch 'refs/heads/main:refs/remotes/frotz/xyzzy'

baseline push 'main~1:refs/remotes/frotz/backup'
baseline push 'HEAD~4:refs/remotes/frotz/new'

baseline push 'HEAD'
baseline fetch 'HEAD'
baseline push '@'
baseline fetch '@'

baseline fetch 'HEAD:'

baseline push ':refs/remotes/frotz/deleteme'
baseline fetch ':refs/remotes/frotz/HEAD-to-me'

baseline fetch 'refs/heads/*/for-linus:refs/remotes/mine/*-blah'
baseline push 'refs/heads/*/for-linus:refs/remotes/mine/*-blah'

baseline fetch 'refs/heads*/for-linus:refs/remotes/mine/*'
baseline push 'refs/heads*/for-linus:refs/remotes/mine/*'


baseline fetch 'refs/heads/*/for-linus:refs/remotes/mine/*'
baseline push 'refs/heads/*/for-linus:refs/remotes/mine/*'

good=$(printf '\303\204')
baseline fetch "refs/heads/${good}"
7 changes: 7 additions & 0 deletions git-refspec/tests/parse/mod.rs
@@ -0,0 +1,7 @@
use git_testtools::scripted_fixture_repo_read_only;

#[test]
#[ignore]
fn baseline() {
let _dir = scripted_fixture_repo_read_only("make_baseline.sh").unwrap();
}
2 changes: 1 addition & 1 deletion git-refspec/tests/refspec.rs
@@ -1 +1 @@

mod parse;

0 comments on commit 362bd46

Please sign in to comment.