aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Svantesson <davidsvantesson@gmail.com>2020-01-18 05:40:43 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2020-01-18 12:40:43 +0800
commitaac8250b473600549105e8fd499a8d18f5bb3dd0 (patch)
tree7cc16b5750c4a0eb326c25162ae750f61c8b5c56
parentfec1095f1729fefa8c0feca8cad8e8e81591d348 (diff)
downloadgitea-aac8250b473600549105e8fd499a8d18f5bb3dd0.tar.gz
gitea-aac8250b473600549105e8fd499a8d18f5bb3dd0.zip
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>
-rw-r--r--docs/content/doc/usage/linked-references.en-us.md3
-rw-r--r--models/pull.go7
2 files changed, 9 insertions, 1 deletions
diff --git a/docs/content/doc/usage/linked-references.en-us.md b/docs/content/doc/usage/linked-references.en-us.md
index a5f88363dd..d2836f8571 100644
--- a/docs/content/doc/usage/linked-references.en-us.md
+++ b/docs/content/doc/usage/linked-references.en-us.md
@@ -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.
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
diff --git a/models/pull.go b/models/pull.go
index fcfcd221c4..3ef631852e 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -390,6 +390,13 @@ func (pr *PullRequest) GetDefaultSquashMessage() string {
log.Error("LoadIssue: %v", err)
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)
}