diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2024-03-07 20:20:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-07 20:20:42 +0100 |
commit | 44f553b6093c69d09718f617e0a7659c64f51015 (patch) | |
tree | 26216cd44d46ea6fcd21313541d39292c2c1b17e /pkg/integration/tests/submodule/shared.go | |
parent | ad017459d2d3475c18182c6629b6e282c5c558cb (diff) | |
parent | 3b723282cbe98063523e22f9dd71000d20dc5e20 (diff) |
Show all submodules recursively (#3341)
- **PR Description**
Extend the submodules tab to show not only the top-level submodules, but
also their nested submodules, recursively.
Fixes #3306.
Diffstat (limited to 'pkg/integration/tests/submodule/shared.go')
-rw-r--r-- | pkg/integration/tests/submodule/shared.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/pkg/integration/tests/submodule/shared.go b/pkg/integration/tests/submodule/shared.go new file mode 100644 index 000000000..43e0144ab --- /dev/null +++ b/pkg/integration/tests/submodule/shared.go @@ -0,0 +1,39 @@ +package submodule + +import ( + . "github.com/jesseduffield/lazygit/pkg/integration/components" +) + +func setupNestedSubmodules(shell *Shell) { + // we're going to have a directory structure like this: + // project + // - repo/modules/outerSubName/modules/innerSubName/ + // + shell.CreateFileAndAdd("rootFile", "rootStuff") + shell.Commit("initial repo commit") + + shell.Chdir("..") + shell.CreateDir("innerSubmodule") + shell.Chdir("innerSubmodule") + shell.Init() + shell.CreateFileAndAdd("inner", "inner") + shell.Commit("initial inner commit") + + shell.Chdir("..") + shell.CreateDir("outerSubmodule") + shell.Chdir("outerSubmodule") + shell.Init() + shell.CreateFileAndAdd("outer", "outer") + shell.Commit("initial outer commit") + shell.CreateDir("modules") + // the git config (-c) parameter below is required + // to let git create a file-protocol/path submodule + shell.RunCommand([]string{"git", "-c", "protocol.file.allow=always", "submodule", "add", "--name", "innerSubName", "../innerSubmodule", "modules/innerSubPath"}) + shell.Commit("add dependency as innerSubmodule") + + shell.Chdir("../repo") + shell.CreateDir("modules") + shell.RunCommand([]string{"git", "-c", "protocol.file.allow=always", "submodule", "add", "--name", "outerSubName", "../outerSubmodule", "modules/outerSubPath"}) + shell.Commit("add dependency as outerSubmodule") + shell.RunCommand([]string{"git", "-c", "protocol.file.allow=always", "submodule", "update", "--init", "--recursive"}) +} |