PR: check pending changes, pushed changes
This commit is contained in:
@@ -441,7 +441,7 @@ func (pr *PRProcessor) Process(req *models.PullRequest) error {
|
||||
common.LogDebug("Submodule parse begin")
|
||||
orig_subs, err := git.GitSubmoduleList(common.DefaultGitPrj, pr.PR.MergeBase)
|
||||
common.PanicOnError(err)
|
||||
new_subs, err := git.GitSubmoduleList(common.DefaultGitPrj, pr.PR.Head.Sha)
|
||||
new_subs, err := git.GitSubmoduleList(common.DefaultGitPrj, "HEAD")
|
||||
common.PanicOnError(err)
|
||||
common.LogDebug("Submodule parse done")
|
||||
|
||||
@@ -449,6 +449,7 @@ func (pr *PRProcessor) Process(req *models.PullRequest) error {
|
||||
updateSubmoduleInPR(submodule, sha, git)
|
||||
}
|
||||
|
||||
common.LogDebug("Checking we only change linked commits")
|
||||
for path, commit := range new_subs {
|
||||
if old, ok := orig_subs[path]; ok && old != commit {
|
||||
found := false
|
||||
@@ -456,6 +457,8 @@ func (pr *PRProcessor) Process(req *models.PullRequest) error {
|
||||
if pr.PR.Base.Repo.Name == path && commit == pr.PR.Head.Sha {
|
||||
found = true
|
||||
break
|
||||
} else if pr.PR.Base.Repo.Name == path {
|
||||
common.LogError(path, "-- commits not match", commit, pr.PR.Head.Sha)
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
@@ -465,6 +468,7 @@ func (pr *PRProcessor) Process(req *models.PullRequest) error {
|
||||
}
|
||||
|
||||
stats, err := git.GitStatus(common.DefaultGitPrj)
|
||||
common.LogDebug("Check Done", len(stats), "changes")
|
||||
common.PanicOnError(err)
|
||||
if len(stats) > 0 {
|
||||
git.GitExecOrPanic(common.DefaultGitPrj, "commit", "-a", "-m", "Sync submodule updates with PR-set")
|
||||
|
||||
Reference in New Issue
Block a user