pr: use correct prjgit repo name
This commit is contained in:
@@ -627,7 +627,7 @@ func (e *GitHandlerImpl) GitParseCommits(cwd string, commitIDs []string) (parsed
|
|||||||
var done sync.Mutex
|
var done sync.Mutex
|
||||||
|
|
||||||
done.Lock()
|
done.Lock()
|
||||||
data_in, data_out := ChanIO{make(chan byte, 256)}, ChanIO{make(chan byte, 70)}
|
data_in, data_out := ChanIO{make(chan byte)}, ChanIO{make(chan byte)}
|
||||||
parsedCommits = make([]GitCommit, 0, len(commitIDs))
|
parsedCommits = make([]GitCommit, 0, len(commitIDs))
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
@@ -661,7 +661,12 @@ func (e *GitHandlerImpl) GitParseCommits(cwd string, commitIDs []string) (parsed
|
|||||||
return len(data), nil
|
return len(data), nil
|
||||||
})
|
})
|
||||||
LogDebug("command run:", cmd.Args)
|
LogDebug("command run:", cmd.Args)
|
||||||
err = cmd.Run()
|
if e := cmd.Run(); e != nil {
|
||||||
|
LogError(e)
|
||||||
|
close(data_in.ch)
|
||||||
|
close(data_out.ch)
|
||||||
|
return nil, e
|
||||||
|
}
|
||||||
|
|
||||||
done.Lock()
|
done.Lock()
|
||||||
return
|
return
|
||||||
@@ -672,7 +677,7 @@ func (e *GitHandlerImpl) GitCatFile(cwd, commitId, filename string) (data []byte
|
|||||||
var done sync.Mutex
|
var done sync.Mutex
|
||||||
|
|
||||||
done.Lock()
|
done.Lock()
|
||||||
data_in, data_out := ChanIO{make(chan byte, 256)}, ChanIO{make(chan byte, 70)}
|
data_in, data_out := ChanIO{make(chan byte)}, ChanIO{make(chan byte)}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer done.Unlock()
|
defer done.Unlock()
|
||||||
@@ -726,6 +731,7 @@ func (e *GitHandlerImpl) GitCatFile(cwd, commitId, filename string) (data []byte
|
|||||||
})
|
})
|
||||||
LogDebug("command run:", cmd.Args)
|
LogDebug("command run:", cmd.Args)
|
||||||
if e := cmd.Run(); e != nil {
|
if e := cmd.Run(); e != nil {
|
||||||
|
LogError(e)
|
||||||
close(data_in.ch)
|
close(data_in.ch)
|
||||||
close(data_out.ch)
|
close(data_out.ch)
|
||||||
return nil, e
|
return nil, e
|
||||||
@@ -740,7 +746,7 @@ func (e *GitHandlerImpl) GitSubmoduleList(gitPath, commitId string) (submoduleLi
|
|||||||
submoduleList = make(map[string]string)
|
submoduleList = make(map[string]string)
|
||||||
|
|
||||||
done.Lock()
|
done.Lock()
|
||||||
data_in, data_out := ChanIO{make(chan byte, 256)}, ChanIO{make(chan byte, 70)}
|
data_in, data_out := ChanIO{make(chan byte)}, ChanIO{make(chan byte)}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer done.Unlock()
|
defer done.Unlock()
|
||||||
@@ -798,14 +804,19 @@ func (e *GitHandlerImpl) GitSubmoduleList(gitPath, commitId string) (submoduleLi
|
|||||||
return len(data), nil
|
return len(data), nil
|
||||||
})
|
})
|
||||||
LogDebug("command run:", cmd.Args)
|
LogDebug("command run:", cmd.Args)
|
||||||
err = cmd.Run()
|
if e := cmd.Run(); e != nil {
|
||||||
|
LogError(e)
|
||||||
|
close(data_in.ch)
|
||||||
|
close(data_out.ch)
|
||||||
|
return submoduleList, e
|
||||||
|
}
|
||||||
|
|
||||||
done.Lock()
|
done.Lock()
|
||||||
return submoduleList, err
|
return submoduleList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *GitHandlerImpl) GitSubmoduleCommitId(cwd, packageName, commitId string) (subCommitId string, valid bool) {
|
func (e *GitHandlerImpl) GitSubmoduleCommitId(cwd, packageName, commitId string) (subCommitId string, valid bool) {
|
||||||
data_in, data_out := ChanIO{make(chan byte, 256)}, ChanIO{make(chan byte, 70)}
|
data_in, data_out := ChanIO{make(chan byte)}, ChanIO{make(chan byte)}
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
@@ -861,8 +872,11 @@ func (e *GitHandlerImpl) GitSubmoduleCommitId(cwd, packageName, commitId string)
|
|||||||
return len(data), nil
|
return len(data), nil
|
||||||
})
|
})
|
||||||
LogDebug("command run:", cmd.Args)
|
LogDebug("command run:", cmd.Args)
|
||||||
if err := cmd.Run(); err != nil {
|
if e := cmd.Run(); e != nil {
|
||||||
LogError("Error running command:", cmd.Args, err)
|
LogError(e)
|
||||||
|
close(data_in.ch)
|
||||||
|
close(data_out.ch)
|
||||||
|
return subCommitId, false
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ func (w *RequestProcessor) ProcessFunc(request *common.Request) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error allocating GitHandler. Err: %w", err)
|
return fmt.Errorf("Error allocating GitHandler. Err: %w", err)
|
||||||
}
|
}
|
||||||
|
common.LogDebug("git path:", git.GetPath())
|
||||||
defer git.Close()
|
defer git.Close()
|
||||||
|
|
||||||
switch req.Action {
|
switch req.Action {
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ func (s *DefaultStateChecker) VerifyProjectState(config *common.AutogitConfig) e
|
|||||||
common.LogInfo(" checking", prjGitOrg+"/"+prjGitRepo+"#"+prjGitBranch)
|
common.LogInfo(" checking", prjGitOrg+"/"+prjGitRepo+"#"+prjGitBranch)
|
||||||
|
|
||||||
git, err := GitHandler.CreateGitHandler(config.Organization)
|
git, err := GitHandler.CreateGitHandler(config.Organization)
|
||||||
|
common.LogDebug("Git Path:", git.GetPath())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Cannot create git handler: %w", err)
|
return fmt.Errorf("Cannot create git handler: %w", err)
|
||||||
}
|
}
|
||||||
@@ -91,7 +92,7 @@ func (s *DefaultStateChecker) VerifyProjectState(config *common.AutogitConfig) e
|
|||||||
return fmt.Errorf("Error fetching or creating '%s/%s#%s' -- aborting verifyProjectState(). Err: %w", prjGitBranch, prjGitRepo, prjGitBranch, err)
|
return fmt.Errorf("Error fetching or creating '%s/%s#%s' -- aborting verifyProjectState(). Err: %w", prjGitBranch, prjGitRepo, prjGitBranch, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = git.GitClone(config.GitProjectName, prjGitBranch, repo.SSHURL)
|
_, err = git.GitClone(prjGitRepo, prjGitBranch, repo.SSHURL)
|
||||||
common.PanicOnError(err)
|
common.PanicOnError(err)
|
||||||
prs, err := Gitea.GetRecentPullRequests(prjGitOrg, prjGitRepo, prjGitBranch)
|
prs, err := Gitea.GetRecentPullRequests(prjGitOrg, prjGitRepo, prjGitBranch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -103,7 +104,7 @@ func (s *DefaultStateChecker) VerifyProjectState(config *common.AutogitConfig) e
|
|||||||
}
|
}
|
||||||
|
|
||||||
common.LogDebug(" - # of PRs to check in PrjGit:", len(prs))
|
common.LogDebug(" - # of PRs to check in PrjGit:", len(prs))
|
||||||
submodules, err := git.GitSubmoduleList(config.GitProjectName, "HEAD")
|
submodules, err := git.GitSubmoduleList(prjGitRepo, "HEAD")
|
||||||
|
|
||||||
nextSubmodule:
|
nextSubmodule:
|
||||||
for sub, commitID := range submodules {
|
for sub, commitID := range submodules {
|
||||||
@@ -150,8 +151,8 @@ nextSubmodule:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// not found in past, check if we should advance the branch label ... pull the submodule
|
// not found in past, check if we should advance the branch label ... pull the submodule
|
||||||
git.GitExecOrPanic(config.GitProjectName, "submodule", "update", "--init", "--filter", "blob:none", "--", sub)
|
git.GitExecOrPanic(prjGitRepo, "submodule", "update", "--init", "--filter", "blob:none", "--", sub)
|
||||||
subDir := path.Join(config.GitProjectName, sub)
|
subDir := path.Join(prjGitRepo, sub)
|
||||||
newCommits := common.SplitStringNoEmpty(git.GitExecWithOutputOrPanic(subDir, "rev-list", "^origin/"+branch, commitID), "\n")
|
newCommits := common.SplitStringNoEmpty(git.GitExecWithOutputOrPanic(subDir, "rev-list", "^origin/"+branch, commitID), "\n")
|
||||||
|
|
||||||
if len(newCommits) >= 1 {
|
if len(newCommits) >= 1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user