forked from git-lfs/git-lfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht-submodule.sh
executable file
·85 lines (70 loc) · 2.98 KB
/
t-submodule.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env bash
. "$(dirname "$0")/testlib.sh"
reponame="submodule-test-repo"
submodname="submodule-test-submodule"
begin_test "submodule local git dir"
(
set -e
setup_remote_repo "$reponame"
setup_remote_repo "$submodname"
clone_repo "$submodname" submod
mkdir dir
echo "sub module" > dir/README
git add dir/README
git commit -a -m "submodule readme"
git push origin main
clone_repo "$reponame" repo
git submodule add "$GITSERVER/$submodname" sub
git submodule update
git add .gitmodules sub
git commit -m "add submodule"
git push origin main
grep "sub module" sub/dir/README || {
echo "submodule not setup correctly?"
cat sub/dir/README
exit 1
}
)
end_test
begin_test "submodule env"
(
set -e
# using the local clone from the above test
cd repo
git lfs env | tee env.log
grep "Endpoint=$GITSERVER/$reponame.git/info/lfs (auth=none)$" env.log
grep "LocalWorkingDir=$(canonical_path_escaped "$TRASHDIR/repo$")" env.log
grep "LocalGitDir=$(canonical_path_escaped "$TRASHDIR/repo/.git$")" env.log
grep "LocalGitStorageDir=$(canonical_path_escaped "$TRASHDIR/repo/.git$")" env.log
grep "LocalMediaDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/lfs/objects$")" env.log
grep "TempDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/lfs/tmp$")" env.log
cd .git
echo "./.git"
git lfs env | tee env.log
cat env.log
grep "Endpoint=$GITSERVER/$reponame.git/info/lfs (auth=none)$" env.log
grep "LocalWorkingDir=$" env.log
grep "LocalGitDir=$(canonical_path_escaped "$TRASHDIR/repo/.git$")" env.log
grep "LocalGitStorageDir=$(canonical_path_escaped "$TRASHDIR/repo/.git$")" env.log
grep "LocalMediaDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/lfs/objects$")" env.log
grep "TempDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/lfs/tmp$")" env.log
cd ../sub
echo "./sub"
git lfs env | tee env.log
grep "Endpoint=$GITSERVER/$submodname.git/info/lfs (auth=none)$" env.log
grep "LocalWorkingDir=$(canonical_path_escaped "$TRASHDIR/repo/sub$")" env.log
grep "LocalGitDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/modules/sub$")" env.log
grep "LocalGitStorageDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/modules/sub$")" env.log
grep "LocalMediaDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/modules/sub/lfs/objects$")" env.log
grep "TempDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/modules/sub/lfs/tmp$")" env.log
cd dir
echo "./sub/dir"
git lfs env | tee env.log
grep "Endpoint=$GITSERVER/$submodname.git/info/lfs (auth=none)$" env.log
grep "LocalWorkingDir=$(canonical_path_escaped "$TRASHDIR/repo/sub$")" env.log
grep "LocalGitDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/modules/sub$")" env.log
grep "LocalGitStorageDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/modules/sub$")" env.log
grep "LocalMediaDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/modules/sub/lfs/objects$")" env.log
grep "TempDir=$(canonical_path_escaped "$TRASHDIR/repo/.git/modules/sub/lfs/tmp$")" env.log
)
end_test