From b0b39726b852314d43d7a45b2d201ba0166a0d7b5710bc16acdd51faf466f1c8 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Thu, 12 Sep 2024 14:34:05 +0200 Subject: [PATCH] Do not remove git work directory in debug mode --- prjgit-updater/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/prjgit-updater/main.go b/prjgit-updater/main.go index 16004e0..92e45eb 100644 --- a/prjgit-updater/main.go +++ b/prjgit-updater/main.go @@ -84,7 +84,9 @@ func processConfiguredRepositoryAction(h *common.RequestHandler, action *common. prjgit := config.GitProjectName git, err := common.CreateGitHandler(GitAuthor, GitEmail, AppName) common.PanicOnError(err) - // defer git.Close() + if !debugMode { + defer git.Close() + } prjGitRepo, err := gitea.CreateRepositoryIfNotExist(git, *action.Organization, prjgit) if err != nil { @@ -145,7 +147,9 @@ func processConfiguredPushAction(h *common.RequestHandler, action *common.PushWe prjgit := config.GitProjectName git, err := common.CreateGitHandler(GitAuthor, GitEmail, AppName) common.PanicOnError(err) - defer git.Close() + if !debugMode { + defer git.Close() + } prjGitRepo, err := gitea.CreateRepositoryIfNotExist(git, *action.Repository.Owner, prjgit) if err != nil {