3 . "$(dirname "$0")/testlib.sh"
5 envInitConfig='git config filter.lfs.process = "git-lfs filter-process"
6 git config filter.lfs.smudge = "git-lfs smudge -- %f"
7 git config filter.lfs.clean = "git-lfs clean -- %f"'
9 begin_test "env with no remote"
12 reponame="env-no-remote"
17 localwd=$(native_path "$TRASHDIR/$reponame")
18 localgit=$(native_path "$TRASHDIR/$reponame/.git")
19 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
20 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
21 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
22 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
23 envVars=$(printf "%s" "$(env | grep "^GIT")")
36 BasicTransfersOnly=false
37 SkipDownloadErrors=false
38 FetchRecentAlways=false
40 FetchRecentCommitsDays=0
41 FetchRecentRefsIncludeRemotes=true
43 PruneVerifyRemoteAlways=false
44 PruneRemoteName=origin
48 DownloadTransfers=basic
52 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
53 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
55 contains_same_elements "$expected" "$actual"
59 begin_test "env with origin remote"
62 reponame="env-origin-remote"
66 git remote add origin "$GITSERVER/env-origin-remote"
68 endpoint="$GITSERVER/$reponame.git/info/lfs (auth=none)"
69 localwd=$(native_path "$TRASHDIR/$reponame")
70 localgit=$(native_path "$TRASHDIR/$reponame/.git")
71 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
72 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
73 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
74 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
75 envVars=$(printf "%s" "$(env | grep "^GIT")")
88 BasicTransfersOnly=false
89 SkipDownloadErrors=false
90 FetchRecentAlways=false
92 FetchRecentCommitsDays=0
93 FetchRecentRefsIncludeRemotes=true
95 PruneVerifyRemoteAlways=false
96 PruneRemoteName=origin
100 DownloadTransfers=basic
101 UploadTransfers=basic
104 ' "$(git lfs version)" "$(git version)" "$endpoint" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
105 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
106 contains_same_elements "$expected" "$actual"
109 expected2=$(echo "$expected" | sed -e 's/LocalWorkingDir=.*/LocalWorkingDir=/')
110 actual2=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
111 contains_same_elements "$expected2" "$actual2"
115 begin_test "env with multiple remotes"
118 reponame="env-multiple-remotes"
122 git remote add origin "$GITSERVER/env-origin-remote"
123 git remote add other "$GITSERVER/env-other-remote"
125 endpoint="$GITSERVER/env-origin-remote.git/info/lfs (auth=none)"
126 endpoint2="$GITSERVER/env-other-remote.git/info/lfs (auth=none)"
127 localwd=$(native_path "$TRASHDIR/$reponame")
128 localgit=$(native_path "$TRASHDIR/$reponame/.git")
129 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
130 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
131 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
132 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
133 envVars=$(printf "%s" "$(env | grep "^GIT")")
134 expected=$(printf '%s
141 LocalGitStorageDir=%s
145 ConcurrentTransfers=3
147 BasicTransfersOnly=false
148 SkipDownloadErrors=false
149 FetchRecentAlways=false
150 FetchRecentRefsDays=7
151 FetchRecentCommitsDays=0
152 FetchRecentRefsIncludeRemotes=true
154 PruneVerifyRemoteAlways=false
155 PruneRemoteName=origin
159 DownloadTransfers=basic
160 UploadTransfers=basic
163 ' "$(git lfs version)" "$(git version)" "$endpoint" "$endpoint2" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
164 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
165 contains_same_elements "$expected" "$actual"
168 expected2=$(echo "$expected" | sed -e 's/LocalWorkingDir=.*/LocalWorkingDir=/')
169 actual2=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
170 contains_same_elements "$expected2" "$actual2"
174 begin_test "env with other remote"
177 reponame="env-other-remote"
181 git remote add other "$GITSERVER/env-other-remote"
183 endpoint="$GITSERVER/env-other-remote.git/info/lfs (auth=none)"
184 localwd=$(native_path "$TRASHDIR/$reponame")
185 localgit=$(native_path "$TRASHDIR/$reponame/.git")
186 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
187 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
188 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
189 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
190 envVars=$(printf "%s" "$(env | grep "^GIT")")
192 expected=$(printf '%s
198 LocalGitStorageDir=%s
202 ConcurrentTransfers=3
204 BasicTransfersOnly=false
205 SkipDownloadErrors=false
206 FetchRecentAlways=false
207 FetchRecentRefsDays=7
208 FetchRecentCommitsDays=0
209 FetchRecentRefsIncludeRemotes=true
211 PruneVerifyRemoteAlways=false
212 PruneRemoteName=origin
216 DownloadTransfers=basic
217 UploadTransfers=basic
220 ' "$(git lfs version)" "$(git version)" "$endpoint" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
221 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
222 contains_same_elements "$expected" "$actual"
225 expected2=$(echo "$expected" | sed -e 's/LocalWorkingDir=.*/LocalWorkingDir=/')
226 actual2=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
227 contains_same_elements "$expected2" "$actual2"
231 begin_test "env with multiple remotes and lfs.url config"
234 reponame="env-multiple-remotes-with-lfs-url"
238 git remote add origin "$GITSERVER/env-origin-remote"
239 git remote add other "$GITSERVER/env-other-remote"
240 git config lfs.url "http://foo/bar"
242 endpoint="$GITSERVER/env-other-remote.git/info/lfs (auth=none)"
243 localwd=$(native_path "$TRASHDIR/$reponame")
244 localgit=$(native_path "$TRASHDIR/$reponame/.git")
245 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
246 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
247 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
248 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
249 envVars=$(printf "%s" "$(env | grep "^GIT")")
250 expected=$(printf '%s
253 Endpoint=http://foo/bar (auth=none)
257 LocalGitStorageDir=%s
261 ConcurrentTransfers=3
263 BasicTransfersOnly=false
264 SkipDownloadErrors=false
265 FetchRecentAlways=false
266 FetchRecentRefsDays=7
267 FetchRecentCommitsDays=0
268 FetchRecentRefsIncludeRemotes=true
270 PruneVerifyRemoteAlways=false
271 PruneRemoteName=origin
275 DownloadTransfers=basic
276 UploadTransfers=basic
279 ' "$(git lfs version)" "$(git version)" "$endpoint" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
280 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
281 contains_same_elements "$expected" "$actual"
284 expected2=$(echo "$expected" | sed -e 's/LocalWorkingDir=.*/LocalWorkingDir=/')
285 actual2=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
286 contains_same_elements "$expected2" "$actual2"
290 begin_test "env with multiple remotes and lfs configs"
293 reponame="env-multiple-remotes-lfs-configs"
297 git remote add origin "$GITSERVER/env-origin-remote"
298 git remote add other "$GITSERVER/env-other-remote"
299 git config lfs.url "http://foo/bar"
300 git config remote.origin.lfsurl "http://custom/origin"
301 git config remote.other.lfsurl "http://custom/other"
303 localwd=$(native_path "$TRASHDIR/$reponame")
304 localgit=$(native_path "$TRASHDIR/$reponame/.git")
305 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
306 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
307 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
308 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
309 envVars=$(printf "%s" "$(env | grep "^GIT")")
310 expected=$(printf '%s
313 Endpoint=http://foo/bar (auth=none)
314 Endpoint (other)=http://custom/other (auth=none)
317 LocalGitStorageDir=%s
321 ConcurrentTransfers=3
323 BasicTransfersOnly=false
324 SkipDownloadErrors=false
325 FetchRecentAlways=false
326 FetchRecentRefsDays=7
327 FetchRecentCommitsDays=0
328 FetchRecentRefsIncludeRemotes=true
330 PruneVerifyRemoteAlways=false
331 PruneRemoteName=origin
335 DownloadTransfers=basic
336 UploadTransfers=basic
339 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
340 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
341 contains_same_elements "$expected" "$actual"
344 expected2=$(echo "$expected" | sed -e 's/LocalWorkingDir=.*/LocalWorkingDir=/')
345 actual2=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
346 contains_same_elements "$expected2" "$actual2"
350 begin_test "env with multiple remotes and lfs url and batch configs"
353 reponame="env-multiple-remotes-lfs-batch-configs"
357 git remote add origin "$GITSERVER/env-origin-remote"
358 git remote add other "$GITSERVER/env-other-remote"
359 git config lfs.url "http://foo/bar"
360 git config lfs.concurrenttransfers 5
361 git config remote.origin.lfsurl "http://custom/origin"
362 git config remote.other.lfsurl "http://custom/other"
364 localwd=$(native_path "$TRASHDIR/$reponame")
365 localgit=$(native_path "$TRASHDIR/$reponame/.git")
366 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
367 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
368 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
369 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
370 envVars=$(printf "%s" "$(env | grep "^GIT")")
371 expected=$(printf '%s
374 Endpoint=http://foo/bar (auth=none)
375 Endpoint (other)=http://custom/other (auth=none)
378 LocalGitStorageDir=%s
382 ConcurrentTransfers=5
384 BasicTransfersOnly=false
385 SkipDownloadErrors=false
386 FetchRecentAlways=false
387 FetchRecentRefsDays=7
388 FetchRecentCommitsDays=0
389 FetchRecentRefsIncludeRemotes=true
391 PruneVerifyRemoteAlways=false
392 PruneRemoteName=origin
396 DownloadTransfers=basic
397 UploadTransfers=basic
400 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
401 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
402 contains_same_elements "$expected" "$actual"
405 expected2=$(echo "$expected" | sed -e 's/LocalWorkingDir=.*/LocalWorkingDir=/')
406 actual2=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
407 contains_same_elements "$expected2" "$actual2"
411 begin_test "env with .lfsconfig"
414 reponame="env-with-lfsconfig"
419 git remote add origin "$GITSERVER/env-origin-remote"
420 echo '[remote "origin"]
421 lfsurl = http://foobar:8080/
424 concurrenttransfers = 5
426 echo '[remote "origin"]
427 lfsurl = http://foobar:5050/
430 concurrenttransfers = 50
433 localwd=$(native_path "$TRASHDIR/$reponame")
434 localgit=$(native_path "$TRASHDIR/$reponame/.git")
435 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
436 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
437 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
438 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
439 envVars=$(printf "%s" "$(env | grep "^GIT")")
440 expected=$(printf '%s
443 Endpoint=http://foobar:8080/ (auth=none)
446 LocalGitStorageDir=%s
450 ConcurrentTransfers=3
452 BasicTransfersOnly=false
453 SkipDownloadErrors=false
454 FetchRecentAlways=false
455 FetchRecentRefsDays=7
456 FetchRecentCommitsDays=0
457 FetchRecentRefsIncludeRemotes=true
459 PruneVerifyRemoteAlways=false
460 PruneRemoteName=origin
464 DownloadTransfers=basic
465 UploadTransfers=basic
468 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
469 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
470 contains_same_elements "$expected" "$actual"
474 actual2=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
475 contains_same_elements "$expected" "$actual2"
479 begin_test "env with environment variables"
482 reponame="env-with-envvars"
484 mkdir -p $reponame/a/b/c
486 gitDir=$(native_path "$TRASHDIR/$reponame/.git")
487 workTree=$(native_path "$TRASHDIR/$reponame/a/b")
489 localwd=$(native_path "$TRASHDIR/$reponame/a/b")
490 localgit=$(native_path "$TRASHDIR/$reponame/.git")
491 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
492 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
493 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
494 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
495 envVars="$(GIT_DIR=$gitDir GIT_WORK_TREE=$workTree env | grep "^GIT" | sort)"
496 expected=$(printf '%s
501 LocalGitStorageDir=%s
505 ConcurrentTransfers=3
507 BasicTransfersOnly=false
508 SkipDownloadErrors=false
509 FetchRecentAlways=false
510 FetchRecentRefsDays=7
511 FetchRecentCommitsDays=0
512 FetchRecentRefsIncludeRemotes=true
514 PruneVerifyRemoteAlways=false
515 PruneRemoteName=origin
519 DownloadTransfers=basic
520 UploadTransfers=basic
523 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
525 actual=$(GIT_DIR=$gitDir GIT_WORK_TREE=$workTree git lfs env \
526 | grep -v "^GIT_EXEC_PATH=")
527 contains_same_elements "$expected" "$actual"
529 cd $TRASHDIR/$reponame
530 actual2=$(GIT_DIR=$gitDir GIT_WORK_TREE=$workTree git lfs env \
531 | grep -v "^GIT_EXEC_PATH=")
532 contains_same_elements "$expected" "$actual2"
534 cd $TRASHDIR/$reponame/.git
535 actual3=$(GIT_DIR=$gitDir GIT_WORK_TREE=$workTree git lfs env \
536 | grep -v "^GIT_EXEC_PATH=")
537 contains_same_elements "$expected" "$actual3"
539 cd $TRASHDIR/$reponame/a/b/c
540 actual4=$(GIT_DIR=$gitDir GIT_WORK_TREE=$workTree git lfs env \
541 | grep -v "^GIT_EXEC_PATH=")
542 contains_same_elements "$expected" "$actual4"
544 envVars="$(GIT_DIR=$gitDir GIT_WORK_TREE=a/b env | grep "^GIT" | sort)"
546 # `a/b` is an invalid relative path from where we are now and results in an
547 # error, so resulting output will have many fields blank or invalid
548 mediaDir5=$(native_path "lfs/objects")
549 tempDir5=$(native_path "lfs/tmp")
550 expected5=$(printf '%s
559 ConcurrentTransfers=3
561 BasicTransfersOnly=false
562 SkipDownloadErrors=false
563 FetchRecentAlways=false
564 FetchRecentRefsDays=7
565 FetchRecentCommitsDays=0
566 FetchRecentRefsIncludeRemotes=true
568 PruneVerifyRemoteAlways=false
569 PruneRemoteName=origin
573 DownloadTransfers=basic
574 UploadTransfers=basic
576 git config filter.lfs.process = ""
577 git config filter.lfs.smudge = ""
578 git config filter.lfs.clean = ""
579 ' "$(git lfs version)" "$(git version)" "$mediaDir5" "$tempDir5" "$envVars")
580 actual5=$(GIT_DIR=$gitDir GIT_WORK_TREE=a/b git lfs env \
581 | grep -v "^GIT_EXEC_PATH=")
582 contains_same_elements "$expected5" "$actual5"
584 cd $TRASHDIR/$reponame/a/b
585 envVars="$(GIT_DIR=$gitDir env | grep "^GIT" | sort)"
586 expected7=$(printf '%s
591 LocalGitStorageDir=%s
595 ConcurrentTransfers=3
597 BasicTransfersOnly=false
598 SkipDownloadErrors=false
599 FetchRecentAlways=false
600 FetchRecentRefsDays=7
601 FetchRecentCommitsDays=0
602 FetchRecentRefsIncludeRemotes=true
604 PruneVerifyRemoteAlways=false
605 PruneRemoteName=origin
609 DownloadTransfers=basic
610 UploadTransfers=basic
613 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
614 actual7=$(GIT_DIR=$gitDir git lfs env | grep -v "^GIT_EXEC_PATH=")
615 contains_same_elements "$expected7" "$actual7"
617 cd $TRASHDIR/$reponame/a
618 envVars="$(GIT_WORK_TREE=$workTree env | grep "^GIT" | sort)"
619 expected8=$(printf '%s
624 LocalGitStorageDir=%s
628 ConcurrentTransfers=3
630 BasicTransfersOnly=false
631 SkipDownloadErrors=false
632 FetchRecentAlways=false
633 FetchRecentRefsDays=7
634 FetchRecentCommitsDays=0
635 FetchRecentRefsIncludeRemotes=true
637 PruneVerifyRemoteAlways=false
638 PruneRemoteName=origin
642 DownloadTransfers=basic
643 UploadTransfers=basic
646 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
647 actual8=$(GIT_WORK_TREE=$workTree git lfs env | grep -v "^GIT_EXEC_PATH=")
648 contains_same_elements "$expected8" "$actual8"
652 begin_test "env with bare repo"
655 reponame="env-with-bare-repo"
656 git init --bare $reponame
659 localgit=$(native_path "$TRASHDIR/$reponame")
660 localgitstore=$(native_path "$TRASHDIR/$reponame")
661 lfsstorage=$(native_path "$TRASHDIR/$reponame/lfs")
662 localmedia=$(native_path "$TRASHDIR/$reponame/lfs/objects")
663 tempdir=$(native_path "$TRASHDIR/$reponame/lfs/tmp")
664 envVars=$(printf "%s" "$(env | grep "^GIT")")
666 expected=$(printf "%s\n%s\n
669 LocalGitStorageDir=%s
673 ConcurrentTransfers=3
675 BasicTransfersOnly=false
676 SkipDownloadErrors=false
677 FetchRecentAlways=false
678 FetchRecentRefsDays=7
679 FetchRecentCommitsDays=0
680 FetchRecentRefsIncludeRemotes=true
682 PruneVerifyRemoteAlways=false
683 PruneRemoteName=origin
687 DownloadTransfers=basic
688 UploadTransfers=basic
691 " "$(git lfs version)" "$(git version)" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
692 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
693 contains_same_elements "$expected" "$actual"
698 begin_test "env with multiple ssh remotes"
701 reponame="env-with-ssh"
705 git remote add origin git@git-server.com:user/repo.git
706 git remote add other git@other-git-server.com:user/repo.git
708 expected='Endpoint=https://git-server.com/user/repo.git/info/lfs (auth=none)
709 SSH=git@git-server.com:user/repo.git
710 Endpoint (other)=https://other-git-server.com/user/repo.git/info/lfs (auth=none)
711 SSH=git@other-git-server.com:user/repo.git
712 GIT_SSH=lfs-ssh-echo'
714 contains_same_elements "$expected" "$(git lfs env \
715 | grep -v "^GIT_EXEC_PATH=" | grep -e "Endpoint" -e "SSH=")"
719 begin_test "env with skip download errors"
722 reponame="env-with-skip-dl"
726 git config lfs.skipdownloaderrors 1
728 localgit=$(native_path "$TRASHDIR/$reponame")
729 localgitstore=$(native_path "$TRASHDIR/$reponame")
730 lfsstorage=$(native_path "$TRASHDIR/$reponame/lfs")
731 localmedia=$(native_path "$TRASHDIR/$reponame/lfs/objects")
732 tempdir=$(native_path "$TRASHDIR/$reponame/lfs/tmp")
733 envVars=$(printf "%s" "$(env | grep "^GIT")")
735 localwd=$(native_path "$TRASHDIR/$reponame")
736 localgit=$(native_path "$TRASHDIR/$reponame/.git")
737 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
738 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
739 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
740 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
741 envVars=$(printf "%s" "$(env | grep "^GIT")")
743 expectedenabled=$(printf '%s
748 LocalGitStorageDir=%s
752 ConcurrentTransfers=3
754 BasicTransfersOnly=false
755 SkipDownloadErrors=true
756 FetchRecentAlways=false
757 FetchRecentRefsDays=7
758 FetchRecentCommitsDays=0
759 FetchRecentRefsIncludeRemotes=true
761 PruneVerifyRemoteAlways=false
762 PruneRemoteName=origin
766 DownloadTransfers=basic
767 UploadTransfers=basic
770 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
771 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
772 contains_same_elements "$expectedenabled" "$actual"
774 git config --unset lfs.skipdownloaderrors
775 # prove it's usually off
776 expecteddisabled=$(printf '%s
781 LocalGitStorageDir=%s
785 ConcurrentTransfers=3
787 BasicTransfersOnly=false
788 SkipDownloadErrors=false
789 FetchRecentAlways=false
790 FetchRecentRefsDays=7
791 FetchRecentCommitsDays=0
792 FetchRecentRefsIncludeRemotes=true
794 PruneVerifyRemoteAlways=false
795 PruneRemoteName=origin
799 DownloadTransfers=basic
800 UploadTransfers=basic
803 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
804 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
805 contains_same_elements "$expecteddisabled" "$actual"
807 # now enable via env var
808 envVarsEnabled=$(printf "%s" "$(GIT_LFS_SKIP_DOWNLOAD_ERRORS=1 env | grep "^GIT")")
809 expectedenabled2=$(printf '%s
814 LocalGitStorageDir=%s
818 ConcurrentTransfers=3
820 BasicTransfersOnly=false
821 SkipDownloadErrors=true
822 FetchRecentAlways=false
823 FetchRecentRefsDays=7
824 FetchRecentCommitsDays=0
825 FetchRecentRefsIncludeRemotes=true
827 PruneVerifyRemoteAlways=false
828 PruneRemoteName=origin
832 DownloadTransfers=basic
833 UploadTransfers=basic
836 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVarsEnabled" "$envInitConfig")
837 actual=$(GIT_LFS_SKIP_DOWNLOAD_ERRORS=1 git lfs env | grep -v "^GIT_EXEC_PATH=")
838 contains_same_elements "$expectedenabled2" "$actual"
846 begin_test "env with extra transfer methods"
849 reponame="env-with-transfers"
853 git config lfs.tustransfers true
854 git config lfs.customtransfer.supertransfer.path /path/to/something
856 localgit=$(native_path "$TRASHDIR/$reponame")
857 localgitstore=$(native_path "$TRASHDIR/$reponame")
858 lfsstorage=$(native_path "$TRASHDIR/$reponame/lfs")
859 localmedia=$(native_path "$TRASHDIR/$reponame/lfs/objects")
860 tempdir=$(native_path "$TRASHDIR/$reponame/lfs/tmp")
861 envVars=$(printf "%s" "$(env | grep "^GIT")")
863 localwd=$(native_path "$TRASHDIR/$reponame")
864 localgit=$(native_path "$TRASHDIR/$reponame/.git")
865 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
866 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
867 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
868 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
869 envVars=$(printf "%s" "$(env | grep "^GIT")")
871 expectedenabled=$(printf '%s
876 LocalGitStorageDir=%s
880 ConcurrentTransfers=3
882 BasicTransfersOnly=false
883 SkipDownloadErrors=false
884 FetchRecentAlways=false
885 FetchRecentRefsDays=7
886 FetchRecentCommitsDays=0
887 FetchRecentRefsIncludeRemotes=true
889 PruneVerifyRemoteAlways=false
890 PruneRemoteName=origin
894 DownloadTransfers=basic,supertransfer
895 UploadTransfers=basic,supertransfer,tus
898 ' "$(git lfs version)" "$(git version)" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
899 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
900 contains_same_elements "$expectedenabled" "$actual"
905 begin_test "env with multiple remotes and ref"
908 reponame="env-multiple-remotes-ref"
912 git remote add origin "$GITSERVER/env-origin-remote"
913 git remote add other "$GITSERVER/env-other-remote"
917 git commit -m "initial commit"
919 endpoint="$GITSERVER/env-origin-remote.git/info/lfs (auth=none)"
920 endpoint2="$GITSERVER/env-other-remote.git/info/lfs (auth=none)"
921 localwd=$(native_path "$TRASHDIR/$reponame")
922 localgit=$(native_path "$TRASHDIR/$reponame/.git")
923 localgitstore=$(native_path "$TRASHDIR/$reponame/.git")
924 lfsstorage=$(native_path "$TRASHDIR/$reponame/.git/lfs")
925 localmedia=$(native_path "$TRASHDIR/$reponame/.git/lfs/objects")
926 tempdir=$(native_path "$TRASHDIR/$reponame/.git/lfs/tmp")
927 envVars=$(printf "%s" "$(env | grep "^GIT")")
928 expected=$(printf '%s
935 LocalGitStorageDir=%s
939 ConcurrentTransfers=3
941 BasicTransfersOnly=false
942 SkipDownloadErrors=false
943 FetchRecentAlways=false
944 FetchRecentRefsDays=7
945 FetchRecentCommitsDays=0
946 FetchRecentRefsIncludeRemotes=true
948 PruneVerifyRemoteAlways=false
949 PruneRemoteName=origin
953 DownloadTransfers=basic
954 UploadTransfers=basic
957 ' "$(git lfs version)" "$(git version)" "$endpoint" "$endpoint2" "$localwd" "$localgit" "$localgitstore" "$localmedia" "$tempdir" "$lfsstorage" "$envVars" "$envInitConfig")
958 actual=$(git lfs env | grep -v "^GIT_EXEC_PATH=")
959 contains_same_elements "$expected" "$actual"