github.com/2lambda123/git-lfs@v2.5.2+incompatible/t/t-batch-error-handling.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 "batch error handling" 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="badbatch" # Server looks for the "badbatch" repo, returns a 203 status 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 printf "$contents" > a.dat 33 git add a.dat 34 git add .gitattributes 35 git commit -m "add a.dat" 2>&1 | tee commit.log 36 grep "master (root-commit)" commit.log 37 grep "2 files changed" commit.log 38 grep "create mode 100644 a.dat" commit.log 39 grep "create mode 100644 .gitattributes" commit.log 40 41 [ "a" = "$(cat a.dat)" ] 42 43 # This is a small shell function that runs several git commands together. 44 assert_pointer "master" "a.dat" "$contents_oid" 1 45 46 refute_server_object "$reponame" "$contents_oid" 47 48 # This pushes to the remote repository set up at the top of the test. 49 git push origin master 2>&1 | tee push.log 50 grep "Unable to parse HTTP response" push.log 51 ) 52 end_test