github.com/git-lfs/git-lfs@v2.5.2+incompatible/t/t-chunked-transfer-encoding.sh (about) 1 #!/usr/bin/env bash 2 # This is a sample Git LFS test. See test/README.md and testhelpers.sh for 3 # more documentation. 4 5 . "$(dirname "$0")/testlib.sh" 6 7 begin_test "chunked transfer encoding" 8 ( 9 set -e 10 11 # This initializes a new bare git repository in test/remote. 12 # These remote repositories are global to every test, so keep the names 13 # unique. 14 reponame="$(basename "$0" ".sh")" 15 setup_remote_repo "$reponame" 16 17 # Clone the repository from the test Git server. This is empty, and will be 18 # used to test a "git pull" below. The repo is cloned to $TRASHDIR/clone 19 clone_repo "$reponame" clone 20 21 # Clone the repository again to $TRASHDIR/repo. This will be used to commit 22 # and push objects. 23 clone_repo "$reponame" repo 24 25 # This executes Git LFS from the local repo that was just cloned. 26 git lfs track "*.dat" 2>&1 | tee track.log 27 grep "Tracking \"\*.dat\"" track.log 28 29 contents="a" 30 contents_oid=$(calc_oid "$contents") 31 32 # Regular Git commands can be used. 33 printf "$contents" > a.dat 34 git add a.dat 35 git add .gitattributes 36 git commit -m "add a.dat" 2>&1 | tee commit.log 37 grep "master (root-commit)" commit.log 38 grep "2 files changed" commit.log 39 grep "create mode 100644 a.dat" commit.log 40 grep "create mode 100644 .gitattributes" commit.log 41 42 [ "a" = "$(cat a.dat)" ] 43 44 # This is a small shell function that runs several git commands together. 45 assert_pointer "master" "a.dat" "$contents_oid" 1 46 47 refute_server_object "$reponame" "$contents_oid" 48 49 # This pushes to the remote repository set up at the top of the test. 50 git push origin master 2>&1 | tee push.log 51 grep "Uploading LFS objects: 100% (1/1), 1 B" push.log 52 grep "master -> master" push.log 53 54 assert_server_object "$reponame" "$contents_oid" 55 56 # change to the clone's working directory 57 cd ../clone 58 59 git pull 2>&1 60 61 [ "a" = "$(cat a.dat)" ] 62 63 assert_pointer "master" "a.dat" "$contents_oid" 1 64 ) 65 end_test