Explicitly refer to PR in squash-merge commit message in case of external tracker (#9844)
* Explicitly refer to PR in squash-merge commit message in case of external tracker * documentation Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
fec1095f17
commit
aac8250b47
2 changed files with 9 additions and 1 deletions
|
@ -136,7 +136,8 @@ the `!` marker to identify pull requests. For example:
|
||||||
> This is pull request [!1234](#), and links to a pull request in Gitea.
|
> This is pull request [!1234](#), and links to a pull request in Gitea.
|
||||||
|
|
||||||
The `!` and `#` can be used interchangeably for issues and pull request _except_
|
The `!` and `#` can be used interchangeably for issues and pull request _except_
|
||||||
for this case, where a distinction is required.
|
for this case, where a distinction is required. If the repository uses external
|
||||||
|
tracker, commit message for squash merge will use `!` as reference by default.
|
||||||
|
|
||||||
## Issues and Pull Requests References Summary
|
## Issues and Pull Requests References Summary
|
||||||
|
|
||||||
|
|
|
@ -390,6 +390,13 @@ func (pr *PullRequest) GetDefaultSquashMessage() string {
|
||||||
log.Error("LoadIssue: %v", err)
|
log.Error("LoadIssue: %v", err)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
if err := pr.LoadBaseRepo(); err != nil {
|
||||||
|
log.Error("LoadBaseRepo: %v", err)
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if pr.BaseRepo.UnitEnabled(UnitTypeExternalTracker) {
|
||||||
|
return fmt.Sprintf("%s (!%d)", pr.Issue.Title, pr.Issue.Index)
|
||||||
|
}
|
||||||
return fmt.Sprintf("%s (#%d)", pr.Issue.Title, pr.Issue.Index)
|
return fmt.Sprintf("%s (#%d)", pr.Issue.Title, pr.Issue.Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue