From ea87207091cd28f9a2a3741600c312d0971a5312 Mon Sep 17 00:00:00 2001 From: ChrisStatham Date: Mon, 15 Jul 2024 15:05:46 +0000 Subject: [PATCH] logging current work --- internal/git/cmdgit/git.go | 12 ++++++++++++ internal/multigitter/run.go | 22 +++------------------- internal/multigitter/shared.go | 3 +++ 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/internal/git/cmdgit/git.go b/internal/git/cmdgit/git.go index 2a13234b..bdac15d8 100644 --- a/internal/git/cmdgit/git.go +++ b/internal/git/cmdgit/git.go @@ -149,3 +149,15 @@ func (g *Git) AddRemote(name, url string) error { _, err := g.run(cmd) return err } + +func (g *Git) Additions() map[string]string { + return make(map[string]string) +} + +func (g *Git) Deletions() []string { + return make([]string, 0) +} + +func (g *Git) OldHash() string { + return "" +} diff --git a/internal/multigitter/run.go b/internal/multigitter/run.go index a49388d8..67d45bc1 100755 --- a/internal/multigitter/run.go +++ b/internal/multigitter/run.go @@ -357,25 +357,9 @@ func (r *Runner) runSingleRepo(ctx context.Context, repo scm.Repository) (scm.Pu array := strings.Split(repo.CloneURL(), "/") repoName := strings.Trim(array[len(array)-1], ".git") input.RepositoryNameWithOwner = strings.TrimSpace(fmt.Sprintf("%v/%v\n", array[len(array)-2], repoName)) - - if git, ok := sourceController.(interface { - Additions() map[string]string - }); ok { - fmt.Printf("%v\n", git.Additions()) - input.Additions = git.Additions() - } - - if git, ok := sourceController.(interface { - Deletions() []string - }); ok { - input.Deletions = git.Deletions() - } - - if git, ok := sourceController.(interface { - OldHash() string - }); ok { - input.ExpectedHeadOid = git.OldHash() - } + input.Additions = sourceController.Additions() + input.Deletions = sourceController.Deletions() + input.ExpectedHeadOid = sourceController.OldHash() err = ghapi.CommitThroughAPI(ctx, input) } else { diff --git a/internal/multigitter/shared.go b/internal/multigitter/shared.go index fde49cf3..10d903e6 100644 --- a/internal/multigitter/shared.go +++ b/internal/multigitter/shared.go @@ -34,6 +34,9 @@ type Git interface { BranchExist(remoteName, branchName string) (bool, error) Push(ctx context.Context, remoteName string, force bool) error AddRemote(name, url string) error + Additions() map[string]string + Deletions() []string + OldHash() string } type stackTracer interface {