unique org_repo remote names
This commit is contained in:
@@ -86,13 +86,12 @@ type GitHandlerGenerator interface {
|
||||
}
|
||||
|
||||
type gitHandlerGeneratorImpl struct {
|
||||
// TODO: add mutex to lock paths so only one workflow per path and others wait
|
||||
path string
|
||||
git_author string
|
||||
email string
|
||||
|
||||
lock_lock sync.Mutex
|
||||
lock map[string]sync.Mutex
|
||||
lock map[string]*sync.Mutex // per org
|
||||
}
|
||||
|
||||
func AllocateGitWorkTree(basePath, gitAuthor, email string) (GitHandlerGenerator, error) {
|
||||
@@ -117,7 +116,7 @@ func AllocateGitWorkTree(basePath, gitAuthor, email string) (GitHandlerGenerator
|
||||
git_author: gitAuthor,
|
||||
email: email,
|
||||
|
||||
lock: make(map[string]sync.Mutex),
|
||||
lock: make(map[string]*sync.Mutex),
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -193,7 +192,11 @@ func (e *GitHandlerImpl) GitClone(repo, branch, remoteUrl string) error {
|
||||
return fmt.Errorf("Clone location not a directory or Stat error: %w", err)
|
||||
}
|
||||
|
||||
remoteName := ""
|
||||
remoteUrlComp, err := ParseGitRemoteUrl(remoteUrl)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Cannot parse remote URL: %w", err)
|
||||
}
|
||||
remoteName := remoteUrlComp.RemoteName()
|
||||
clonedRemote := strings.TrimSpace(e.GitExecWithOutputOrPanic(repo, "remote", "get-url", remoteName))
|
||||
if clonedRemote != remoteUrl {
|
||||
e.GitExecOrPanic(repo, "remote", "set-url", remoteName, remoteUrl)
|
||||
|
||||
Reference in New Issue
Block a user