summaryrefslogtreecommitdiffstats
path: root/modules/git/commit.go
diff options
context:
space:
mode:
author赵智超 <1012112796@qq.com>2020-06-25 03:40:52 +0800
committerGitHub <noreply@github.com>2020-06-24 20:40:52 +0100
commitae20de7771d81d76ff62227e464a699d55c62084 (patch)
tree2303bf11efa3d47fe700fb336293bcb385fb4f9d /modules/git/commit.go
parent8aef7aefd053d501e336eaca516fae56653d8032 (diff)
downloadgitea-ae20de7771d81d76ff62227e464a699d55c62084.tar.gz
gitea-ae20de7771d81d76ff62227e464a699d55c62084.zip
fix bug about can't skip commits base on base branch (#11555)
* fix bug about can't skip commits base on base branch Signed-off-by: a1012112796 <1012112796@qq.com> * Update modules/git/commit.go Co-authored-by: Lauris BH <lauris@nix.lv> * Update models/issue_comment.go Co-authored-by: Lauris BH <lauris@nix.lv> * fix lint Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'modules/git/commit.go')
-rw-r--r--modules/git/commit.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/git/commit.go b/modules/git/commit.go
index c06eabfbd4..b8ff99cdb6 100644
--- a/modules/git/commit.go
+++ b/modules/git/commit.go
@@ -482,6 +482,16 @@ func (c *Commit) GetBranchName() (string, error) {
return strings.SplitN(strings.TrimSpace(data), "~", 2)[0], nil
}
+// LoadBranchName load branch name for commit
+func (c *Commit) LoadBranchName() (err error) {
+ if len(c.Branch) != 0 {
+ return
+ }
+
+ c.Branch, err = c.GetBranchName()
+ return
+}
+
// GetTagName gets the current tag name for given commit
func (c *Commit) GetTagName() (string, error) {
data, err := NewCommand("describe", "--exact-match", "--tags", "--always", c.ID.String()).RunInDir(c.repo.Path)