Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly refer to PR in squash-merge commit message in case of external tracker #9844

Merged
merged 3 commits into from
Jan 18, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/content/doc/usage/linked-references.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions models/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down