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