Debian Codegraph @

t/t-fetch-paths.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 . "$(dirnamescip-shell system . . dirname. "$0")/testlib.sh"
4
5 reponame="$(basenamescip-shell system . . basename. "$0" ".sh")"
6 contents="a"
7 contents_oid=$(calc_oid "$contents")
8
9 begin_test "init fetch unclean paths"
10 (
11 set -e
12
13 setup_remote_repo $reponame
14 clone_repo $reponame repo
15
16 gitscip-shell system . . git. lfs track "*.dat" 2>&1 | teescip-shell system . . tee. track.log
17 grepscip-shell system . . grep. "Tracking \"\*.dat\"" track.log
18
19 mkdirscip-shell system . . mkdir. dir
20 printfscip-shell system . . printf. "%s" "$contents" > dir/a.dat
21
22 gitscip-shell system . . git. add dir/a.dat
23 gitscip-shell system . . git. add .gitattributes
24 gitscip-shell system . . git. commit -m "add dir/a.dat" 2>&1 | teescip-shell system . . tee. commit.log
25 grepscip-shell system . . grep. "main (root-commit)" commit.log
26 grepscip-shell system . . grep. "2 files changed" commit.log
27 grepscip-shell system . . grep. "create mode 100644 dir/a.dat" commit.log
28 grepscip-shell system . . grep. "create mode 100644 .gitattributes" commit.log
29
30 [scip-shell system . . `[`. "a" = "$(catscip-shell system . . cat. dir/a.dat)" ]
31
32 assert_local_object "$contents_oid" 1
33 refute_server_object "$reponame" "$contents_oid"
34
35 gitscip-shell system . . git. push origin main 2>&1 | teescip-shell system . . tee. push.log
36 grepscip-shell system . . grep. "Uploading LFS objects: 100% (1/1), 1 B" push.log
37 grepscip-shell system . . grep. "main -> main" push.log
38
39 assert_server_object "$reponame" "$contents_oid"
40
41 # This clone is used for subsequent tests
42 clone_repo "$reponame" clone
43 )
44 end_test
45
46 begin_test "fetch unclean paths with include filter in gitconfig"
47 (
48 set -e
49 cd clone
50 rmscip-shell system . . rm. -rf .git/lfs/objects
51
52 gitscip-shell system . . git. config "lfs.fetchinclude" "dir/"
53 gitscip-shell system . . git. lfs fetch
54 assert_local_object "$contents_oid" 1
55 )
56 end_test
57
58 begin_test "fetch unclean paths with exclude filter in gitconfig"
59 (
60 set -e
61 cd clone
62 rmscip-shell system . . rm. -rf .git/lfs/objects
63 gitscip-shell system . . git. config --unset "lfs.fetchinclude"
64
65 gitscip-shell system . . git. config "lfs.fetchexclude" "dir/"
66 gitscip-shell system . . git. lfs fetch
67 refute_local_object "$contents_oid"
68 )
69 end_test
70
71 begin_test "fetch unclean paths with include filter in cli"
72 (
73 set -e
74 cd clone
75 rmscip-shell system . . rm. -rf .git/lfs/objects
76
77 gitscip-shell system . . git. config --unset "lfs.fetchexclude"
78
79 rmscip-shell system . . rm. -rf .git/lfs/objects
80 gitscip-shell system . . git. lfs fetch -I="dir/"
81 assert_local_object "$contents_oid" 1
82 )
83 end_test
84
85 begin_test "fetch unclean paths with exclude filter in cli"
86 (
87 set -e
88 cd clone
89 rmscip-shell system . . rm. -rf .git/lfs/objects
90
91 gitscip-shell system . . git. lfs fetch -X="dir/"
92 refute_local_object "$contents_oid"
93 )
94 end_test