Add tests for cloning with flags
This commit is contained in:
parent
f906e064d1
commit
2000c7a017
@ -138,3 +138,88 @@ begin_test "cloneSSL"
|
||||
)
|
||||
end_test
|
||||
|
||||
|
||||
begin_test "clone with flags"
|
||||
(
|
||||
set -e
|
||||
|
||||
reponame="$(basename "$0" ".sh")-flags"
|
||||
setup_remote_repo "$reponame"
|
||||
clone_repo "$reponame" "$reponame"
|
||||
|
||||
git lfs track "*.dat" 2>&1 | tee track.log
|
||||
grep "Tracking \*.dat" track.log
|
||||
|
||||
# generate some test data & commits with random LFS data
|
||||
echo "[
|
||||
{
|
||||
\"CommitDate\":\"$(get_date -10d)\",
|
||||
\"Files\":[
|
||||
{\"Filename\":\"file1.dat\",\"Size\":100},
|
||||
{\"Filename\":\"file2.dat\",\"Size\":75}]
|
||||
},
|
||||
{
|
||||
\"CommitDate\":\"$(get_date -7d)\",
|
||||
\"NewBranch\":\"branch2\",
|
||||
\"Files\":[
|
||||
{\"Filename\":\"fileonbranch2.dat\",\"Size\":66}]
|
||||
},
|
||||
{
|
||||
\"CommitDate\":\"$(get_date -3d)\",
|
||||
\"ParentBranches\":[\"master\"],
|
||||
\"Files\":[
|
||||
{\"Filename\":\"file3.dat\",\"Size\":120},
|
||||
{\"Filename\":\"file4.dat\",\"Size\":30}]
|
||||
}
|
||||
]" | lfstest-testutils addcommits
|
||||
|
||||
git push origin master branch2
|
||||
|
||||
# Now clone again, test specific clone dir
|
||||
cd "$TRASHDIR"
|
||||
mkdir "$TRASHDIR/templatedir"
|
||||
|
||||
newclonedir="testflagsclone1"
|
||||
# many of these flags won't do anything but make sure they're not rejected
|
||||
git lfs clone --template "$TRASHDIR/templatedir" --local --no-hardlinks --shared --verbose --progress --recursive "$GITSERVER/$reponame" "$newclonedir"
|
||||
rm -rf "$newclonedir"
|
||||
|
||||
# specific test for --no-checkout
|
||||
git lfs clone --quiet --no-checkout "$GITSERVER/$reponame" "$newclonedir"
|
||||
if [ -e "$newclonedir/file1.dat" ]; then
|
||||
exit 1
|
||||
fi
|
||||
rm -rf "$newclonedir"
|
||||
|
||||
# specific test for --branch and --origin
|
||||
git lfs clone --branch branch2 --recurse-submodules --origin differentorigin "$GITSERVER/$reponame" "$newclonedir"
|
||||
pushd "$newclonedir"
|
||||
# this file is only on branch2
|
||||
[ -e "fileonbranch2.dat" ]
|
||||
# confirm remote is called differentorigin
|
||||
git remote get-url differentorigin
|
||||
popd
|
||||
rm -rf "$newclonedir"
|
||||
|
||||
# specific test for --separate-git-dir
|
||||
gitdir="$TRASHDIR/separategitdir"
|
||||
git lfs clone --separate-git-dir "$gitdir" "$GITSERVER/$reponame" "$newclonedir"
|
||||
# .git should be a file not dir
|
||||
if [ -d "$newclonedir/.git" ]; then
|
||||
exit 1
|
||||
fi
|
||||
[ -e "$newclonedir/.git" ]
|
||||
[ -d "$gitdir/objects" ]
|
||||
rm -rf "$newclonedir"
|
||||
rm -rf "$gitdir"
|
||||
|
||||
# specific test for --bare
|
||||
git lfs clone --bare "$GITSERVER/$reponame" "$newclonedir"
|
||||
[ -d "$newclonedir/objects" ]
|
||||
|
||||
# short flags
|
||||
git lfs clone -l -v -n -s -b branch2 "$GITSERVER/$reponame" "$newclonedir"
|
||||
rm -rf "$newclonedir"
|
||||
|
||||
)
|
||||
end_test
|
||||
|
Loading…
Reference in New Issue
Block a user