fix branch handling in repo check
This commit is contained in:
parent
a552f751f0
commit
edab8aa9dd
@ -163,6 +163,7 @@ func processConfiguredPushAction(action *common.PushWebhookEvent, config *common
|
|||||||
|
|
||||||
if len(config.Branch) == 0 {
|
if len(config.Branch) == 0 {
|
||||||
config.Branch = action.Repository.Default_Branch
|
config.Branch = action.Repository.Default_Branch
|
||||||
|
log.Println(" + default branch", action.Repository.Default_Branch)
|
||||||
}
|
}
|
||||||
|
|
||||||
prjGitRepo, err := gitea.CreateRepositoryIfNotExist(git, *action.Repository.Owner, prjgit)
|
prjGitRepo, err := gitea.CreateRepositoryIfNotExist(git, *action.Repository.Owner, prjgit)
|
||||||
@ -193,7 +194,7 @@ func processConfiguredPushAction(action *common.PushWebhookEvent, config *common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("push of refs the configured branch", config.Branch, ". ignoring.")
|
log.Println("push of refs not on the configured branch", config.Branch, ". ignoring.")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +317,9 @@ next_repo:
|
|||||||
common.PanicOnError(git.GitExec(config.GitProjectName, "submodule", "--quiet", "add", "--depth", "1", r.SSHURL, r.Name))
|
common.PanicOnError(git.GitExec(config.GitProjectName, "submodule", "--quiet", "add", "--depth", "1", r.SSHURL, r.Name))
|
||||||
|
|
||||||
if len(config.Branch) > 0 {
|
if len(config.Branch) > 0 {
|
||||||
common.PanicOnError(git.GitExec(path.Join(config.GitProjectName, r.Name), "fetch", "--depth", "1", "origin", config.Branch+":"+config.Branch))
|
if err := git.GitExec(path.Join(config.GitProjectName, r.Name), "fetch", "--depth", "1", "origin", config.Branch+":"+config.Branch); err != nil {
|
||||||
|
return fmt.Errorf("Fetching branch %s for %s/%s failed. Ignoring.", config.Branch, repo.Owner.UserName, r.Name)
|
||||||
|
}
|
||||||
common.PanicOnError(git.GitExec(path.Join(config.GitProjectName, r.Name), "checkout", config.Branch))
|
common.PanicOnError(git.GitExec(path.Join(config.GitProjectName, r.Name), "checkout", config.Branch))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user