Debian Codegraph @

t/t-batch-error-handling.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 . "$(dirname "$0")/testlib.sh"
4
5 begin_test "batch error handling"
6 (
7 set -e
8
9 # This initializes a new bare git repository in test/remote.
10 # These remote repositories are global to every test, so keep the names
11 # unique.
12 reponame="badbatch" # Server looks for the "badbatch" repo, returns a 203 status
13 setup_remote_repo "$reponame"
14
15 # Clone the repository from the test Git server. This is empty, and will be
16 # used to test a "git pull" below. The repo is cloned to $TRASHDIR/clone
17 clone_repo "$reponame" clone
18
19 # Clone the repository again to $TRASHDIR/repo. This will be used to commit
20 # and push objects.
21 clone_repo "$reponame" repo
22
23 # This executes Git LFS from the local repo that was just cloned.
24 git lfs track "*.dat" 2>&1 | tee track.log
25 grep "Tracking \"\*.dat\"" track.log
26
27 contents="a"
28 contents_oid=$(calc_oid "$contents")
29
30 printf "%s" "$contents" > a.dat
31 git add a.dat
32 git add .gitattributes
33 git commit -m "add a.dat" 2>&1 | tee commit.log
34 grep "main (root-commit)" commit.log
35 grep "2 files changed" commit.log
36 grep "create mode 100644 a.dat" commit.log
37 grep "create mode 100644 .gitattributes" commit.log
38
39 [ "a" = "$(cat a.dat)" ]
40
41 # This is a small shell function that runs several git commands together.
42 assert_pointer "main" "a.dat" "$contents_oid" 1
43
44 refute_server_object "$reponame" "$contents_oid"
45
46 # This pushes to the remote repository set up at the top of the test.
47 git push origin main 2>&1 | tee push.log
48 grep "Unable to parse HTTP response" push.log
49 )
50 end_test