3 . "$(dirname "$0")/testlib.sh"
5 begin_test "malformed pointers"
9 reponame="malformed-pointers"
10 setup_remote_repo "$reponame"
11 clone_repo "$reponame" "$reponame"
14 git add .gitattributes
15 git commit -m "initial commit"
17 base64 /dev/urandom | head -c 1023 > malformed_small.dat
18 base64 /dev/urandom | head -c 1024 > malformed_exact.dat
19 base64 /dev/urandom | head -c 1025 > malformed_large.dat
20 base64 /dev/urandom | head -c 1048576 > malformed_xxl.dat
23 -c "filter.lfs.process=" \
24 -c "filter.lfs.clean=cat" \
25 -c "filter.lfs.required=false" \
27 git commit -m "add malformed pointer"
29 git push origin master
32 clone_repo "$reponame" "$reponame-assert"
34 grep "malformed_small.dat" clone.log
35 grep "malformed_exact.dat" clone.log
36 grep "malformed_large.dat" clone.log
37 grep "malformed_xxl.dat" clone.log
39 expected_small="$(cat ../$reponame/malformed_small.dat)"
40 expected_exact="$(cat ../$reponame/malformed_exact.dat)"
41 expected_large="$(cat ../$reponame/malformed_large.dat)"
42 expected_xxl="$(cat ../$reponame/malformed_xxl.dat)"
44 actual_small="$(cat malformed_small.dat)"
45 actual_exact="$(cat malformed_exact.dat)"
46 actual_large="$(cat malformed_large.dat)"
47 actual_xxl="$(cat malformed_xxl.dat)"
49 [ "$expected_small" = "$actual_small" ]
50 [ "$expected_exact" = "$actual_exact" ]
51 [ "$expected_large" = "$actual_large" ]
52 [ "$expected_xxl" = "$actual_xxl" ]
57 begin_test "empty pointers"
61 reponame="empty-pointers"
62 setup_remote_repo "$reponame"
63 clone_repo "$reponame" "$reponame"
66 git add .gitattributes
67 git commit -m "initial commit"
72 -c "filter.lfs.process=" \
73 -c "filter.lfs.clean=cat" \
74 -c "filter.lfs.required=false" \
76 git commit -m "add empty pointer"
78 [ "0" -eq "$(git cat-file -p :empty.dat | wc -c)" ]
79 [ "0" -eq "$(wc -c < empty.dat)" ]
81 git push origin master
84 clone_repo "$reponame" "$reponame-assert"
86 [ "0" -eq "$(grep -c "empty.dat" clone.log)" ]
88 [ "0" -eq "$(git cat-file -p :empty.dat | wc -c)" ]
89 [ "0" -eq "$(wc -c < empty.dat)" ]