3 . "$(dirname "$0")/testlib.sh"
5 reponame="$(basename "$0" ".sh")"
7 begin_test "push zero len file"
11 setup_remote_repo "$reponame"
13 clone_repo "$reponame" repo
19 contents_oid=$(calc_oid "$contents")
20 printf "$contents" > full.dat
21 git add .gitattributes *.dat
22 git commit -m "add files" | tee commit.log
24 # cut from commit output
25 # $ git cat-file -p master
26 # tree 2d67d025fb1f9df9fa349412b4b130e982314e92
27 tree="$(git cat-file -p master | cut -f 2 -d " " | head -n 1)"
29 # cut from tree output
30 # $ git cat-file -p "$tree"
31 # 100644 blob 1e9f8f7cafb6af3a6f6ddf211fa39c45fccea7ab .gitattributes
32 # 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 empty.dat
33 # 100644 blob c5de5ac7dec1c40bafe60d24da9b498937640332 full.dat
34 emptyblob="$(git cat-file -p "$tree" | cut -f 3 -d " " | grep "empty.dat" | cut -f 1 -d$'\t')"
36 # look for lfs pointer in git blob
37 [ "0" = "$(git cat-file -p "$emptyblob" | grep "lfs" -c)" ]
39 assert_pointer "master" "full.dat" "$contents_oid" 4
41 git push origin master | tee push.log
42 grep "Uploading LFS objects: 100% (1/1), 4 B" push.log
46 begin_test "pull zero len file"
50 clone_repo "$reponame" clone
53 git status | grep -E "working (directory|tree) clean"
56 if [ -s "empty.dat" ]; then
57 echo "empty.dat has content:"
62 [ "full" = "$(cat full.dat)" ]