Skip to content

Commit

Permalink
logging current work
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisStatham committed Jul 15, 2024
1 parent da6ac1d commit ea87207
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
12 changes: 12 additions & 0 deletions internal/git/cmdgit/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
}
22 changes: 3 additions & 19 deletions internal/multigitter/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions internal/multigitter/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ea87207

Please sign in to comment.