summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-02-10 19:47:36 +0100
committerStefan Haller <stefan@haller-berlin.de>2024-03-07 20:16:28 +0100
commitea87912a740464d1c69f4acad9c79efe6588d532 (patch)
tree3ee5bb52dcaf15593e36b7e6be78cf5cf953e82d
parentddcd9163018e264321046023d49ab176f71733c7 (diff)
Fix deleting submodule where name and path are different
-rw-r--r--pkg/commands/git_commands/submodule.go2
-rw-r--r--pkg/integration/tests/submodule/remove.go3
2 files changed, 1 insertions, 4 deletions
diff --git a/pkg/commands/git_commands/submodule.go b/pkg/commands/git_commands/submodule.go
index d9d1ccd20..3f69ce875 100644
--- a/pkg/commands/git_commands/submodule.go
+++ b/pkg/commands/git_commands/submodule.go
@@ -141,7 +141,7 @@ func (self *SubmoduleCommands) Delete(submodule *models.SubmoduleConfig) error {
// We may in fact want to use the repo's git dir path but git docs say not to
// mix submodules and worktrees anyway.
- return os.RemoveAll(filepath.Join(self.repoPaths.WorktreeGitDirPath(), "modules", submodule.Path))
+ return os.RemoveAll(filepath.Join(self.repoPaths.WorktreeGitDirPath(), "modules", submodule.Name))
}
func (self *SubmoduleCommands) Add(name string, path string, url string) error {
diff --git a/pkg/integration/tests/submodule/remove.go b/pkg/integration/tests/submodule/remove.go
index f4f1cd04f..22fb83f30 100644
--- a/pkg/integration/tests/submodule/remove.go
+++ b/pkg/integration/tests/submodule/remove.go
@@ -45,9 +45,6 @@ var Remove = NewIntegrationTest(NewIntegrationTestArgs{
Contains("- url = ../other_repo"),
)
- /* EXPECTED:
t.FileSystem().PathNotPresent(gitDirSubmodulePath)
- ACTUAL: */
- t.FileSystem().PathPresent(gitDirSubmodulePath)
},
})