mirror of
https://github.com/git/git
synced 2024-10-30 14:03:28 +00:00
27d7c8599b
Prepare tests not to be affected by the name of the default branch "git init" creates. * js/default-branch-name-tests-final-stretch: (28 commits) tests: drop prereq `PREPARE_FOR_MAIN_BRANCH` where no longer needed t99*: adjust the references to the default branch name "main" tests(git-p4): transition to the default branch name `main` t9[5-7]*: adjust the references to the default branch name "main" t9[0-4]*: adjust the references to the default branch name "main" t8*: adjust the references to the default branch name "main" t7[5-9]*: adjust the references to the default branch name "main" t7[0-4]*: adjust the references to the default branch name "main" t6[4-9]*: adjust the references to the default branch name "main" t64*: preemptively adjust alignment to prepare for `master` -> `main` t6[0-3]*: adjust the references to the default branch name "main" t5[6-9]*: adjust the references to the default branch name "main" t55[4-9]*: adjust the references to the default branch name "main" t55[23]*: adjust the references to the default branch name "main" t551*: adjust the references to the default branch name "main" t550*: adjust the references to the default branch name "main" t5503: prepare aligned comment for replacing `master` with `main` t5[0-4]*: adjust the references to the default branch name "main" t5323: prepare centered comment for `master` -> `main` t4*: adjust the references to the default branch name "main" ...
96 lines
3.3 KiB
Bash
Executable file
96 lines
3.3 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
test_description='refspec parsing'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_refspec () {
|
|
kind=$1 refspec=$2 expect=$3
|
|
git config remote.frotz.url "." &&
|
|
git config --remove-section remote.frotz &&
|
|
git config remote.frotz.url "." &&
|
|
git config "remote.frotz.$kind" "$refspec" &&
|
|
if test "$expect" != invalid
|
|
then
|
|
title="$kind $refspec"
|
|
test='git ls-remote frotz'
|
|
else
|
|
title="$kind $refspec (invalid)"
|
|
test='test_must_fail git ls-remote frotz'
|
|
fi
|
|
test_expect_success "$title" "$test"
|
|
}
|
|
|
|
test_refspec push '' invalid
|
|
test_refspec push ':'
|
|
test_refspec push '::' invalid
|
|
test_refspec push '+:'
|
|
|
|
test_refspec fetch ''
|
|
test_refspec fetch ':'
|
|
test_refspec fetch '::' invalid
|
|
|
|
test_refspec push 'refs/heads/*:refs/remotes/frotz/*'
|
|
test_refspec push 'refs/heads/*:refs/remotes/frotz' invalid
|
|
test_refspec push 'refs/heads:refs/remotes/frotz/*' invalid
|
|
test_refspec push 'refs/heads/main:refs/remotes/frotz/xyzzy'
|
|
|
|
|
|
# These have invalid LHS, but we do not have a formal "valid sha-1
|
|
# expression syntax checker" so they are not checked with the current
|
|
# code. They will be caught downstream anyway, but we may want to
|
|
# have tighter check later...
|
|
|
|
: test_refspec push 'refs/heads/main::refs/remotes/frotz/xyzzy' invalid
|
|
: test_refspec push 'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid
|
|
|
|
test_refspec fetch 'refs/heads/*:refs/remotes/frotz/*'
|
|
test_refspec fetch 'refs/heads/*:refs/remotes/frotz' invalid
|
|
test_refspec fetch 'refs/heads:refs/remotes/frotz/*' invalid
|
|
test_refspec fetch 'refs/heads/main:refs/remotes/frotz/xyzzy'
|
|
test_refspec fetch 'refs/heads/main::refs/remotes/frotz/xyzzy' invalid
|
|
test_refspec fetch 'refs/heads/maste :refs/remotes/frotz/xyzzy' invalid
|
|
|
|
test_refspec push 'main~1:refs/remotes/frotz/backup'
|
|
test_refspec fetch 'main~1:refs/remotes/frotz/backup' invalid
|
|
test_refspec push 'HEAD~4:refs/remotes/frotz/new'
|
|
test_refspec fetch 'HEAD~4:refs/remotes/frotz/new' invalid
|
|
|
|
test_refspec push 'HEAD'
|
|
test_refspec fetch 'HEAD'
|
|
test_refspec push '@'
|
|
test_refspec fetch '@'
|
|
test_refspec push 'refs/heads/ nitfol' invalid
|
|
test_refspec fetch 'refs/heads/ nitfol' invalid
|
|
|
|
test_refspec push 'HEAD:' invalid
|
|
test_refspec fetch 'HEAD:'
|
|
test_refspec push 'refs/heads/ nitfol:' invalid
|
|
test_refspec fetch 'refs/heads/ nitfol:' invalid
|
|
|
|
test_refspec push ':refs/remotes/frotz/deleteme'
|
|
test_refspec fetch ':refs/remotes/frotz/HEAD-to-me'
|
|
test_refspec push ':refs/remotes/frotz/delete me' invalid
|
|
test_refspec fetch ':refs/remotes/frotz/HEAD to me' invalid
|
|
|
|
test_refspec fetch 'refs/heads/*/for-linus:refs/remotes/mine/*-blah'
|
|
test_refspec push 'refs/heads/*/for-linus:refs/remotes/mine/*-blah'
|
|
|
|
test_refspec fetch 'refs/heads*/for-linus:refs/remotes/mine/*'
|
|
test_refspec push 'refs/heads*/for-linus:refs/remotes/mine/*'
|
|
|
|
test_refspec fetch 'refs/heads/*/*/for-linus:refs/remotes/mine/*' invalid
|
|
test_refspec push 'refs/heads/*/*/for-linus:refs/remotes/mine/*' invalid
|
|
|
|
test_refspec fetch 'refs/heads/*g*/for-linus:refs/remotes/mine/*' invalid
|
|
test_refspec push 'refs/heads/*g*/for-linus:refs/remotes/mine/*' invalid
|
|
|
|
test_refspec fetch 'refs/heads/*/for-linus:refs/remotes/mine/*'
|
|
test_refspec push 'refs/heads/*/for-linus:refs/remotes/mine/*'
|
|
|
|
good=$(printf '\303\204')
|
|
test_refspec fetch "refs/heads/${good}"
|
|
bad=$(printf '\011tab')
|
|
test_refspec fetch "refs/heads/${bad}" invalid
|
|
|
|
test_done
|