Debian Codegraph @

t/t-fetch-include.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 . "$(dirname "$0")/testlib.sh"
4
5 reponame="$(basename "$0" ".sh")"
6 contents="big file"
7 contents_oid=$(calc_oid "$contents")
8
9 begin_test "fetch: setup for include test"
10 (
11 set -e
12
13 setup_remote_repo "$reponame"
14 clone_repo "$reponame" repo
15
16 git lfs track "*.big"
17 mkdir -p big/a
18 mkdir -p big/b
19
20 printf "%s" "$contents" > big/a/a1.big
21 printf "%s" "$contents" > big/b/b1.big
22
23 contents2="big file 2"
24 printf "%s" "$contents2" > big/big1.big
25 printf "%s" "$contents2" > big/big2.big
26 printf "%s" "$contents2" > big/big3.big
27
28 git add .gitattributes big
29 git commit -m "commit" | tee commit.log
30 grep "6 files changed" commit.log
31 grep "create mode 100644 .gitattributes" commit.log
32 grep "create mode 100644 big/a/a1.big" commit.log
33 grep "create mode 100644 big/b/b1.big" commit.log
34 grep "create mode 100644 big/big1.big" commit.log
35 grep "create mode 100644 big/big2.big" commit.log
36 grep "create mode 100644 big/big3.big" commit.log
37
38 git push origin main | tee push.log
39 grep "Uploading LFS objects: 100% (2/2), 18 B" push.log
40
41 assert_server_object "$reponame" "$contents_oid"
42 )
43 end_test
44
45 begin_test "fetch: include first matching file"
46 (
47 set -e
48
49 mkdir clone-1
50 cd clone-1
51 git init
52 git lfs install --local --skip-smudge
53 git remote add origin $GITSERVER/$reponame
54 git pull origin main
55
56 refute_local_object "$contents_oid"
57
58 git lfs ls-files
59
60 git lfs fetch --include=big/a
61
62 assert_local_object "$contents_oid" "8"
63 )
64 end_test
65
66 begin_test "fetch: include second matching file"
67 (
68 set -e
69
70 mkdir clone-2
71 cd clone-2
72 git init
73 git lfs install --local --skip-smudge
74 git remote add origin $GITSERVER/$reponame
75 git pull origin main
76
77 refute_local_object "$contents_oid"
78
79 git lfs ls-files
80
81 git lfs fetch --include=big/b
82
83 assert_local_object "$contents_oid" "8"
84 )
85 end_test