9 reponame="$(basename "$0" ".sh")"
10 setup_remote_repo "$reponame"
12 clone_repo "$reponame" repo
14 git lfs track "*.dat" 2>&1 | tee track.log
15 grep "Tracking \"\*.dat\"" track.log
17 contents="something something"
19 contents_oid=$(calc_oid "$contents")
21 # Same content everywhere is ok, just one object in lfs db
22 printf "$contents" > file1.dat
23 printf "$contents" > file2.dat
24 printf "$contents" > file3.dat
26 printf "$contents" > folder1/nested.dat
27 printf "$contents" > folder2/nested.dat
28 git add file1.dat file2.dat file3.dat folder1/nested.dat folder2/nested.dat
29 git add .gitattributes
30 git commit -m "add files"
32 [ "$contents" = "$(cat file1.dat)" ]
33 [ "$contents" = "$(cat file2.dat)" ]
34 [ "$contents" = "$(cat file3.dat)" ]
35 [ "$contents" = "$(cat folder1/nested.dat)" ]
36 [ "$contents" = "$(cat folder2/nested.dat)" ]
38 assert_pointer "master" "file1.dat" "$contents_oid" $contentsize
40 # Remove the working directory
41 rm -rf file1.dat file2.dat file3.dat folder1/nested.dat folder2/nested.dat
43 echo "checkout should replace all"
45 [ "$contents" = "$(cat file1.dat)" ]
46 [ "$contents" = "$(cat file2.dat)" ]
47 [ "$contents" = "$(cat file3.dat)" ]
48 [ "$contents" = "$(cat folder1/nested.dat)" ]
49 [ "$contents" = "$(cat folder2/nested.dat)" ]
51 # Remove the working directory
52 rm -rf file1.dat file2.dat file3.dat folder1/nested.dat folder2/nested.dat
54 echo "checkout with filters"
55 git lfs checkout file2.dat
56 [ "$contents" = "$(cat file2.dat)" ]
59 [ ! -f folder1/nested.dat ]
60 [ ! -f folder2/nested.dat ]
62 echo "quotes to avoid shell globbing"
63 git lfs checkout "file*.dat"
64 [ "$contents" = "$(cat file1.dat)" ]
65 [ "$contents" = "$(cat file3.dat)" ]
66 [ ! -f folder1/nested.dat ]
67 [ ! -f folder2/nested.dat ]
69 echo "test subdir context"
71 git lfs checkout nested.dat
72 [ "$contents" = "$(cat nested.dat)" ]
73 [ ! -f ../folder2/nested.dat ]
74 # test '.' in current dir
77 [ "$contents" = "$(cat nested.dat)" ]
80 echo "test folder param"
81 git lfs checkout folder2
82 [ "$contents" = "$(cat folder2/nested.dat)" ]
84 echo "test '.' in current dir"
85 rm -rf file1.dat file2.dat file3.dat folder1/nested.dat folder2/nested.dat
87 [ "$contents" = "$(cat file1.dat)" ]
88 [ "$contents" = "$(cat file2.dat)" ]
89 [ "$contents" = "$(cat file3.dat)" ]
90 [ "$contents" = "$(cat folder1/nested.dat)" ]
91 [ "$contents" = "$(cat folder2/nested.dat)" ]
93 echo "test checkout with missing data doesn't fail"
94 git push origin master
95 rm -rf .git/lfs/objects
98 [ "$(pointer $contents_oid $contentsize)" = "$(cat file1.dat)" ]
99 [ "$(pointer $contents_oid $contentsize)" = "$(cat file2.dat)" ]
100 [ "$(pointer $contents_oid $contentsize)" = "$(cat file3.dat)" ]
101 [ "$contents" = "$(cat folder1/nested.dat)" ]
102 [ "$contents" = "$(cat folder2/nested.dat)" ]
106 begin_test "checkout: without clean filter"
110 reponame="$(basename "$0" ".sh")"
113 git clone "$GITSERVER/$reponame" checkout-without-clean
114 cd checkout-without-clean
116 echo "checkout without clean filter"
118 git config --list > config.txt
119 grep "filter.lfs.clean" config.txt && {
120 echo "clean filter still configured:"
126 git lfs checkout | tee checkout.txt
127 grep "Git LFS is not installed" checkout.txt
128 if [ "0" -ne "${PIPESTATUS[0]}" ]; then
129 echo >&2 "fatal: expected checkout to succeed ..."
134 contents_oid=$(calc_oid "something something")
135 [ "$(pointer $contents_oid $contentsize)" = "$(cat file1.dat)" ]
136 [ "$(pointer $contents_oid $contentsize)" = "$(cat file2.dat)" ]
137 [ "$(pointer $contents_oid $contentsize)" = "$(cat file3.dat)" ]
138 [ "$(pointer $contents_oid $contentsize)" = "$(cat folder1/nested.dat)" ]
139 [ "$(pointer $contents_oid $contentsize)" = "$(cat folder2/nested.dat)" ]
143 begin_test "checkout: outside git repository"
146 git lfs checkout 2>&1 > checkout.log
150 if [ "$res" = "0" ]; then
151 echo "Passes because $GIT_LFS_TEST_DIR is unset."
155 grep "Not in a git repository" checkout.log