8000 Automatically generated commit message when merging pull request is not clear · Issue #9898 · go-gitea/gitea · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Automatically generated commit message when merging pull request is not clear #9898

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

Closed
2 of 7 tasks
my1e5 opened this issue Jan 20, 2020 · 5 comments
Closed
2 of 7 tasks
Labels
issue/stale type/enhancement An improvement of existing functionality

Comments

@my1e5
Copy link
my1e5 commented Jan 20, 2020

Description

When merging a pull request, Gitea automatically generates text for the commit message. It has the following format:

TITLE: Merge pull request 'pull-request-name' (#pull-request-number) from branch into branch

CONTENT: Reviewed-on: url-of-pull-request

However, I've noticed a potential bug with the way it constructs the branch names. The first branch name is structured like:

organisation-name/branch-name

when I think it should be

organisation-name/repo-name/branch-name OR just branch-name

See the try.gitea example repo and the screenshots below for examples of this.

Screenshots

Organisation: my1e5_test
Repo: Merge-Pull-Request
Branch: feature/my_branch

I use a folder structure for my branch name. I am merging into master.

image

Notice how it says "from my1e5_test/feature/my_branch into master".

In my opinion this is not accurate. It should be just "from feature/my_branch into master" OR it should be "from my1e5_test/Merge-Pull-Request/feature/my_branch into master".

Missing out the repo name, but having the organisation name, is strange IMO.

@my1e5
Copy link
Author
my1e5 commented Jan 21, 2020

The relevant section of code is in pull.go:

// GetDefaultMergeMessage returns default message used when merging pull request
func (pr *PullRequest) GetDefaultMergeMessage() string {
	if pr.HeadRepo == nil {
		var err error
		pr.HeadRepo, err = GetRepositoryByID(pr.HeadRepoID)
		if err != nil {
			log.Error("GetRepositoryById[%d]: %v", pr.HeadRepoID, err)
			return ""
		}
	}
	if err := pr.LoadIssue(); err != nil {
		log.Error("Cannot load issue %d for PR id %d: Error: %v", pr.IssueID, pr.ID, err)
		return ""
	}
	return fmt.Sprintf("Merge pull request '%s' (#%d) from %s/%s into %s", pr.Issue.Title, pr.Issue.Index, pr.MustHeadUserName(), pr.HeadBranch, pr.BaseBranch)
}

@my1e5 my1e5 changed the title Automatically generated commit message when merging pull request is not accurate Automatically generated commit message when merging pull request is not clear Jan 21, 2020
@lunny
Copy link
Member
lunny commented Jan 21, 2020

It should know the PR is from the same repository or a forked repository.

@lafriks
Copy link
Member
lafriks commented Feb 4, 2020

Also it should really exclude merge commits and commits that merge commit includes

@stale
Copy link
stale bot commented Apr 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale stale bot added the issue/stale label Apr 5, 2020
@stale
Copy link
stale bot commented Apr 19, 2020

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale stale bot closed this as completed Apr 19, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/stale type/enhancement An improvement of existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants
0