2015-07-31 13:45:42 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
. "test/testlib.sh"
|
|
|
|
|
2015-07-31 16:31:26 +00:00
|
|
|
ensure_git_version_isnt $VERSION_LOWER "2.5.0"
|
2016-03-17 21:25:33 +00:00
|
|
|
envInitConfig='git config filter.lfs.smudge = "git-lfs smudge -- %f"
|
|
|
|
git config filter.lfs.clean = "git-lfs clean -- %f"'
|
2015-07-31 13:45:42 +00:00
|
|
|
|
2015-07-31 15:50:50 +00:00
|
|
|
begin_test "git worktree"
|
|
|
|
(
|
|
|
|
set -e
|
|
|
|
reponame="worktree-main"
|
|
|
|
mkdir $reponame
|
|
|
|
cd $reponame
|
|
|
|
git init
|
2015-07-31 13:45:42 +00:00
|
|
|
|
2015-07-31 15:50:50 +00:00
|
|
|
# can't create a worktree until there's 1 commit at least
|
|
|
|
echo "a" > tmp.txt
|
|
|
|
git add tmp.txt
|
|
|
|
git commit -m "Initial commit"
|
|
|
|
|
|
|
|
expected=$(printf "%s\n%s\n
|
2015-10-22 14:56:34 +00:00
|
|
|
LocalWorkingDir=$(native_path_escaped "$TRASHDIR/$reponame")
|
|
|
|
LocalGitDir=$(native_path_escaped "$TRASHDIR/$reponame/.git")
|
|
|
|
LocalGitStorageDir=$(native_path_escaped "$TRASHDIR/$reponame/.git")
|
|
|
|
LocalMediaDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/lfs/objects")
|
2016-01-31 21:06:40 +00:00
|
|
|
LocalReferenceDir=
|
2015-10-22 14:56:34 +00:00
|
|
|
TempDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/lfs/tmp")
|
2015-07-31 13:45:42 +00:00
|
|
|
ConcurrentTransfers=3
|
2016-06-09 10:45:24 +00:00
|
|
|
BasicTransfersOnly=false
|
2015-09-03 14:20:38 +00:00
|
|
|
BatchTransfer=true
|
2016-05-10 10:39:09 +00:00
|
|
|
SkipDownloadErrors=false
|
2016-05-12 15:03:03 +00:00
|
|
|
FetchRecentAlways=false
|
|
|
|
FetchRecentRefsDays=7
|
|
|
|
FetchRecentCommitsDays=0
|
|
|
|
FetchRecentRefsIncludeRemotes=true
|
|
|
|
PruneOffsetDays=3
|
|
|
|
PruneVerifyRemoteAlways=false
|
|
|
|
PruneRemoteName=origin
|
|
|
|
AccessDownload=none
|
|
|
|
AccessUpload=none
|
2015-10-23 08:21:49 +00:00
|
|
|
$(escape_path "$(env | grep "^GIT")")
|
2015-09-30 22:27:58 +00:00
|
|
|
%s
|
|
|
|
" "$(git lfs version)" "$(git version)" "$envInitConfig")
|
2015-07-31 15:50:50 +00:00
|
|
|
actual=$(git lfs env)
|
2015-10-22 14:56:34 +00:00
|
|
|
contains_same_elements "$expected" "$actual"
|
2015-07-31 13:45:42 +00:00
|
|
|
|
2015-07-31 15:50:50 +00:00
|
|
|
worktreename="worktree-2"
|
|
|
|
git worktree add "$TRASHDIR/$worktreename"
|
|
|
|
cd "$TRASHDIR/$worktreename"
|
2015-07-31 13:45:42 +00:00
|
|
|
|
2015-07-31 15:50:50 +00:00
|
|
|
# git dir in worktree is like submodules (except path is worktrees) but this
|
|
|
|
# is only for index, temp etc
|
|
|
|
# storage of git objects and lfs objects is in the original .git
|
|
|
|
expected=$(printf "%s\n%s\n
|
2015-10-22 14:56:34 +00:00
|
|
|
LocalWorkingDir=$(native_path_escaped "$TRASHDIR/$worktreename")
|
|
|
|
LocalGitDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/worktrees/$worktreename")
|
|
|
|
LocalGitStorageDir=$(native_path_escaped "$TRASHDIR/$reponame/.git")
|
|
|
|
LocalMediaDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/lfs/objects")
|
2016-01-31 21:06:40 +00:00
|
|
|
LocalReferenceDir=
|
2015-10-22 14:56:34 +00:00
|
|
|
TempDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/worktrees/$worktreename/lfs/tmp")
|
2015-07-31 13:45:42 +00:00
|
|
|
ConcurrentTransfers=3
|
2016-06-09 10:45:24 +00:00
|
|
|
BasicTransfersOnly=false
|
2015-09-03 14:20:38 +00:00
|
|
|
BatchTransfer=true
|
2016-05-10 10:39:09 +00:00
|
|
|
SkipDownloadErrors=false
|
2016-05-12 15:03:03 +00:00
|
|
|
FetchRecentAlways=false
|
|
|
|
FetchRecentRefsDays=7
|
|
|
|
FetchRecentCommitsDays=0
|
|
|
|
FetchRecentRefsIncludeRemotes=true
|
|
|
|
PruneOffsetDays=3
|
|
|
|
PruneVerifyRemoteAlways=false
|
|
|
|
PruneRemoteName=origin
|
|
|
|
AccessDownload=none
|
|
|
|
AccessUpload=none
|
2015-10-23 08:21:49 +00:00
|
|
|
$(escape_path "$(env | grep "^GIT")")
|
2015-09-30 22:27:58 +00:00
|
|
|
%s
|
|
|
|
" "$(git lfs version)" "$(git version)" "$envInitConfig")
|
2015-07-31 15:50:50 +00:00
|
|
|
actual=$(git lfs env)
|
2015-10-22 14:56:34 +00:00
|
|
|
contains_same_elements "$expected" "$actual"
|
2015-07-31 15:50:50 +00:00
|
|
|
)
|
|
|
|
end_test
|