github.com/2lambda123/git-lfs@v2.5.2+incompatible/t/t-worktree.sh (about) 1 #!/usr/bin/env bash 2 3 . "$(dirname "$0")/testlib.sh" 4 5 ensure_git_version_isnt $VERSION_LOWER "2.5.0" 6 envInitConfig='git config filter.lfs.process = "git-lfs filter-process" 7 git config filter.lfs.smudge = "git-lfs smudge -- %f" 8 git config filter.lfs.clean = "git-lfs clean -- %f"' 9 10 begin_test "git worktree" 11 ( 12 set -e 13 reponame="worktree-main" 14 mkdir $reponame 15 cd $reponame 16 git init 17 18 # can't create a worktree until there's 1 commit at least 19 echo "a" > tmp.txt 20 git add tmp.txt 21 git commit -m "Initial commit" 22 23 expected=$(printf "%s\n%s\n 24 LocalWorkingDir=$(native_path_escaped "$TRASHDIR/$reponame") 25 LocalGitDir=$(native_path_escaped "$TRASHDIR/$reponame/.git") 26 LocalGitStorageDir=$(native_path_escaped "$TRASHDIR/$reponame/.git") 27 LocalMediaDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/lfs/objects") 28 LocalReferenceDirs= 29 TempDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/lfs/tmp") 30 ConcurrentTransfers=3 31 TusTransfers=false 32 BasicTransfersOnly=false 33 SkipDownloadErrors=false 34 FetchRecentAlways=false 35 FetchRecentRefsDays=7 36 FetchRecentCommitsDays=0 37 FetchRecentRefsIncludeRemotes=true 38 PruneOffsetDays=3 39 PruneVerifyRemoteAlways=false 40 PruneRemoteName=origin 41 LfsStorageDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/lfs") 42 AccessDownload=none 43 AccessUpload=none 44 DownloadTransfers=basic 45 UploadTransfers=basic 46 $(escape_path "$(env | grep "^GIT")") 47 %s 48 " "$(git lfs version)" "$(git version)" "$envInitConfig") 49 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=") 50 contains_same_elements "$expected" "$actual" 51 52 worktreename="worktree-2" 53 git worktree add "$TRASHDIR/$worktreename" 54 cd "$TRASHDIR/$worktreename" 55 56 # git dir in worktree is like submodules (except path is worktrees) but this 57 # is only for index, temp etc 58 # storage of git objects and lfs objects is in the original .git 59 expected=$(printf "%s\n%s\n 60 LocalWorkingDir=$(native_path_escaped "$TRASHDIR/$worktreename") 61 LocalGitDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/worktrees/$worktreename") 62 LocalGitStorageDir=$(native_path_escaped "$TRASHDIR/$reponame/.git") 63 LocalMediaDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/lfs/objects") 64 LocalReferenceDirs= 65 TempDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/lfs/tmp") 66 ConcurrentTransfers=3 67 TusTransfers=false 68 BasicTransfersOnly=false 69 SkipDownloadErrors=false 70 FetchRecentAlways=false 71 FetchRecentRefsDays=7 72 FetchRecentCommitsDays=0 73 FetchRecentRefsIncludeRemotes=true 74 PruneOffsetDays=3 75 PruneVerifyRemoteAlways=false 76 PruneRemoteName=origin 77 LfsStorageDir=$(native_path_escaped "$TRASHDIR/$reponame/.git/lfs") 78 AccessDownload=none 79 AccessUpload=none 80 DownloadTransfers=basic 81 UploadTransfers=basic 82 $(escape_path "$(env | grep "^GIT")") 83 %s 84 " "$(git lfs version)" "$(git version)" "$envInitConfig") 85 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=") 86 contains_same_elements "$expected" "$actual" 87 ) 88 end_test