* Fix 500 Error with branch and tag sharing the same name #15592
Fixed 500 error while create Pull request when there are more
than one sources (branch, tag) with the same name
Fix#15592
Signed-off-by: Viktor Yakovchuk <viktor@yakovchuk.net>
* fix logging
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
log.Info("Unable to push PR head for %s#%d (%-v:%s) due to rejection:\nStdout: %s\nStderr: %s\nError: %v",pr.BaseRepo.FullName(),pr.Index,pr.BaseRepo,gitRefName,rejectErr.StdOut,rejectErr.StdErr,rejectErr.Err)
log.Info("Unable to push PR head for %s#%d (%-v:%s) due to rejection:\nStdout: %s\nStderr: %s\nError: %v",pr.BaseRepo.FullName(),pr.Index,pr.BaseRepo,gitRefName,rejectErr.StdOut,rejectErr.StdErr,rejectErr.Err)
returnerr
returnerr
}elseifgit.IsErrMoreThanOne(err){
ifprefixHeadBranch!=""{
log.Info("Can't push with %s%s",prefixHeadBranch,pr.HeadBranch)
returnerr
}
log.Info("Retrying to push with refs/heads/%s",pr.HeadBranch)
err=pushToBaseRepoHelper(pr,"refs/heads/")
returnerr
}
}
log.Error("Unable to push PR head for %s#%d (%-v:%s) due to Error: %v",pr.BaseRepo.FullName(),pr.Index,pr.BaseRepo,gitRefName,err)
log.Error("Unable to push PR head for %s#%d (%-v:%s) due to Error: %v",pr.BaseRepo.FullName(),pr.Index,pr.BaseRepo,gitRefName,err)