Debian Codegraph @

t/t-track-wildcards.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 begin_test "track files using wildcard pattern with leading slash"
6 (
7 set -e
8
9 reponame="track-wildcard-leading-slash"
10 mkdirscip-shell system . . mkdir. -p "$reponame/dir"
11 cd $reponame
12
13 gitscip-shell system . . git. init
14
15 # Adding files before being tracked by LFS
16 printfscip-shell system . . printf. "contents" > a.dat
17 printfscip-shell system . . printf. "contents" > dir/b.dat
18
19 gitscip-shell system . . git. add a.dat dir/b.dat
20 gitscip-shell system . . git. commit -m "initial commit"
21
22 # Track only in the root
23 gitscip-shell system . . git. lfs track "/*.dat"
24 grepscip-shell system . . grep. "/*.dat" .gitattributes
25
26 gitscip-shell system . . git. add .gitattributes a.dat dir/b.dat
27 sleepscip-shell system . . sleep. 1
28 gitscip-shell system . . git. commit -m "convert to LFS"
29
30 gitscip-shell system . . git. lfs ls-files | teescip-shell system . . tee. files.log
31
32 grepscip-shell system . . grep. "a.dat" files.log
33 grepscip-shell system . . grep. "dir/b.dat" files.log && exit 1 # Subdirectories ignored
34
35 # Add files after being tracked by LFS
36 printfscip-shell system . . printf. "contents" > c.dat
37 printfscip-shell system . . printf. "contents" > dir/d.dat
38
39 gitscip-shell system . . git. add c.dat dir/d.dat
40 sleepscip-shell system . . sleep. 1
41 gitscip-shell system . . git. commit -m "more lfs files"
42
43 gitscip-shell system . . git. lfs ls-files | teescip-shell system . . tee. new_files.log
44
45 grepscip-shell system . . grep. "a.dat" new_files.log
46 grepscip-shell system . . grep. "dir/b.dat" new_files.log && exit 1
47 grepscip-shell system . . grep. "c.dat" new_files.log
48 grepscip-shell system . . grep. "dir/d.dat" new_files.log && exit 1
49 truescip-shell system . . true.
50 )
51 end_test
52
53 begin_test "track files using filename pattern with leading slash"
54 (
55 set -e
56
57 reponame="track-absolute-leading-slash"
58 mkdirscip-shell system . . mkdir. -p "$reponame/dir"
59 cd $reponame
60
61 gitscip-shell system . . git. init
62
63 # Adding files before being tracked by LFS
64 printfscip-shell system . . printf. "contents" > a.dat
65 printfscip-shell system . . printf. "contents" > dir/b.dat
66
67 gitscip-shell system . . git. add a.dat dir/b.dat
68 sleepscip-shell system . . sleep. 1
69 gitscip-shell system . . git. commit -m "initial commit"
70
71 # These are added by git.GetTrackedFiles
72 gitscip-shell system . . git. lfs track "/a.datscip-shell filesystem . . `/a.dat`." | teescip-shell system . . tee. track.log
73 grepscip-shell system . . grep. "Tracking \"/a.dat\"" track.log
74 gitscip-shell system . . git. lfs track "/dir/b.datscip-shell filesystem . . `/dir/b.dat`." | teescip-shell system . . tee. track.log
75 grepscip-shell system . . grep. "Tracking \"/dir/b.dat\"" track.log
76
77 # These are added by Git's `clean` filter
78 gitscip-shell system . . git. lfs track "/c.datscip-shell filesystem . . `/c.dat`." | teescip-shell system . . tee. track.log
79 grepscip-shell system . . grep. "Tracking \"/c.dat\"" track.log
80 gitscip-shell system . . git. lfs track "/dir/d.datscip-shell filesystem . . `/dir/d.dat`." | teescip-shell system . . tee. track.log
81 grepscip-shell system . . grep. "Tracking \"/dir/d.dat\"" track.log
82
83 catscip-shell system . . cat. .gitattributes
84
85 gitscip-shell system . . git. add .gitattributes a.dat dir/b.dat
86 sleepscip-shell system . . sleep. 1
87 gitscip-shell system . . git. commit -m "convert to LFS"
88
89 gitscip-shell system . . git. lfs ls-files | teescip-shell system . . tee. files.log
90
91 grepscip-shell system . . grep. "a.dat" files.log
92 grepscip-shell system . . grep. "dir/b.dat" files.log
93
94 # Add files after being tracked by LFS
95 printfscip-shell system . . printf. "contents" > c.dat
96 printfscip-shell system . . printf. "contents" > dir/d.dat
97
98 gitscip-shell system . . git. add c.dat dir/d.dat
99 gitscip-shell system . . git. commit -m "more lfs files"
100
101 gitscip-shell system . . git. lfs ls-files | teescip-shell system . . tee. new_files.log
102
103 grepscip-shell system . . grep. "a.dat" new_files.log
104 grepscip-shell system . . grep. "dir/b.dat" new_files.log
105 grepscip-shell system . . grep. "c.dat" new_files.log
106 grepscip-shell system . . grep. "dir/d.dat" new_files.log
107 )
108 end_test