Skip to content

Commit aa6ed1b

Browse files
davidsvantessonzeripath
authored andcommitted
Explicitly refer to PR in squash-merge commit message in case of external tracker (#9844) (#9855)
* Explicitly refer to PR in squash-merge commit message in case of external tracker * documentation Co-authored-by: zeripath <[email protected]> Co-authored-by: zeripath <[email protected]>
1 parent 95cb921 commit aa6ed1b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

docs/content/doc/usage/linked-references.en-us.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ the `!` marker to identify pull requests. For example:
136136
> This is pull request [!1234](#), and links to a pull request in Gitea.
137137
138138
The `!` and `#` can be used interchangeably for issues and pull request _except_
139-
for this case, where a distinction is required.
139+
for this case, where a distinction is required. If the repository uses external
140+
tracker, commit message for squash merge will use `!` as reference by default.
140141

141142
## Issues and Pull Requests References Summary
142143

models/pull.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,13 @@ func (pr *PullRequest) GetDefaultSquashMessage() string {
385385
log.Error("LoadIssue: %v", err)
386386
return ""
387387
}
388+
if err := pr.LoadBaseRepo(); err != nil {
389+
log.Error("LoadBaseRepo: %v", err)
390+
return ""
391+
}
392+
if pr.BaseRepo.UnitEnabled(UnitTypeExternalTracker) {
393+
return fmt.Sprintf("%s (!%d)", pr.Issue.Title, pr.Issue.Index)
394+
}
388395
return fmt.Sprintf("%s (#%d)", pr.Issue.Title, pr.Issue.Index)
389396
}
390397

0 commit comments

Comments
 (0)