Debian Codegraph @

t/t-submodule-lfsconfig.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3 . "$(dirname "$0")/testlib.sh"
4 lfsname="submodule-config-test-lfs"
5 reponame="submodule-config-test-repo"
6 submodname="submodule-config-test-submodule"
7
8 begin_test "submodule env with .lfsconfig"
9 (
10 set -e
11
12 # setup dummy repo with lfs store
13 # no git data will be pushed, just lfs objects
14 setup_remote_repo "$lfsname"
15 echo $GITSERVER/$lfsname.git/info/lfs
16
17 # setup submodule
18 setup_remote_repo "$submodname"
19 clone_repo "$submodname" submod
20 mkdir dir
21 git config -f .lfsconfig lfs.url "$GITSERVER/$lfsname.git/info/lfs"
22 git lfs track "*.dat"
23 submodcontent="submodule lfs file"
24 submodoid=$(calc_oid "$submodcontent")
25 printf "%s" "$submodcontent" > dir/test.dat
26 git add .lfsconfig .gitattributes dir
27 git commit -m "create submodule"
28 git push origin main
29
30 assert_server_object "$lfsname" "$submodoid"
31
32 # setup repo with submodule
33 setup_remote_repo "$reponame"
34 clone_repo "$reponame" repo
35 git config -f .lfsconfig lfs.url "$GITSERVER/$lfsname.git/info/lfs"
36 git submodule add -b main "$GITSERVER/$submodname" sub
37 git submodule update
38 git lfs track "*.dat"
39 mkdir dir
40 repocontent="repository lfs file"
41 repooid=$(calc_oid "$repocontent")
42 printf "%s" "$repocontent" > dir/test.dat
43 git add .gitattributes .lfsconfig .gitmodules dir sub
44 git commit -m "create repo"
45 git push origin main
46
47 assert_server_object "$lfsname" "$repooid"
48
49 echo "repo"
50 git lfs env | tee env.log
51 grep "Endpoint=$GITSERVER/$lfsname.git/info/lfs (auth=basic)$" env.log
52
53 cd sub
54 echo "./sub"
55 git lfs env | tee env.log
56 grep "Endpoint=$GITSERVER/$lfsname.git/info/lfs (auth=basic)$" env.log
57
58 cd dir
59 echo "./sub/dir"
60 git lfs env | tee env.log
61 grep "Endpoint=$GITSERVER/$lfsname.git/info/lfs (auth=basic)$" env.log
62 )
63 end_test
64
65 begin_test "submodule update --init --remote with .lfsconfig"
66 (
67 set -e
68 clone_repo "$reponame" clone
69 grep "$repocontent" dir/test.dat
70
71 git submodule update --init --remote
72
73 grep "$submodcontent" sub/dir/test.dat
74 )
75 end_test