summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLanre Adelowo <adelowomailbox@gmail.com>2019-02-05 22:47:01 +0100
committerzeripath <art27@cantab.net>2019-02-05 21:47:01 +0000
commitc20034be31034f135f4e5f0a995ae82c318516c2 (patch)
tree124952a1b21db58526e9776c7393203b4f2b5305
parent2ec9bf9048b86092c3c31a150df75eae753df7c1 (diff)
downloadgitea-c20034be31034f135f4e5f0a995ae82c318516c2.tar.gz
gitea-c20034be31034f135f4e5f0a995ae82c318516c2.zip
Display the branch name in the commit view (#5950)
* add branch info * Remove blank lines * Remove blank lines * update git dependency
-rw-r--r--Gopkg.lock4
-rw-r--r--templates/repo/diff/page.tmpl1
-rw-r--r--vendor/code.gitea.io/git/commit.go1
-rw-r--r--vendor/code.gitea.io/git/repo_commit.go10
4 files changed, 13 insertions, 3 deletions
diff --git a/Gopkg.lock b/Gopkg.lock
index ba21eca95c..0df0cf57d0 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -3,11 +3,11 @@
[[projects]]
branch = "master"
- digest = "1:8a6c3c311918c0f08fa2899feae2c938a9bf22b51378e3720d63b80aca4e80aa"
+ digest = "1:537ed734fb4869453583d9ce24d93bf68c88287082778efe55ae749970a1012a"
name = "code.gitea.io/git"
packages = ["."]
pruneopts = "NUT"
- revision = "d04f81a6f8979be39da165fc034447a805071b97"
+ revision = "fbe468c7a634991285eaa1f93e73431e3edfc471"
[[projects]]
branch = "master"
diff --git a/templates/repo/diff/page.tmpl b/templates/repo/diff/page.tmpl
index d8489dffb9..3f383add94 100644
--- a/templates/repo/diff/page.tmpl
+++ b/templates/repo/diff/page.tmpl
@@ -13,6 +13,7 @@
{{if IsMultilineCommitMessage .Commit.Message}}
<pre class="commit-body">{{RenderCommitBody .Commit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
{{end}}
+ <span class="text grey"><i class="octicon octicon-git-branch"></i>{{.Commit.Branch}}</span>
</div>
<div class="ui attached info segment {{if .Commit.Signature}} isSigned {{if .Verification.Verified }} isVerified {{end}}{{end}}">
<div class="ui stackable grid">
diff --git a/vendor/code.gitea.io/git/commit.go b/vendor/code.gitea.io/git/commit.go
index 227df09b7d..36b8d54565 100644
--- a/vendor/code.gitea.io/git/commit.go
+++ b/vendor/code.gitea.io/git/commit.go
@@ -18,6 +18,7 @@ import (
// Commit represents a git commit.
type Commit struct {
+ Branch string // Branch this commit belongs to
Tree
ID SHA1 // The ID of this commit object
Author *Signature
diff --git a/vendor/code.gitea.io/git/repo_commit.go b/vendor/code.gitea.io/git/repo_commit.go
index 484568585f..bfbf5c6dae 100644
--- a/vendor/code.gitea.io/git/repo_commit.go
+++ b/vendor/code.gitea.io/git/repo_commit.go
@@ -10,7 +10,7 @@ import (
"strconv"
"strings"
- "github.com/mcuadros/go-version"
+ version "github.com/mcuadros/go-version"
)
// GetRefCommitID returns the last commit ID string of given reference (branch or tag).
@@ -130,6 +130,14 @@ func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
commit.repo = repo
commit.ID = id
+ data, err = NewCommand("name-rev", id.String()).RunInDirBytes(repo.Path)
+ if err != nil {
+ return nil, err
+ }
+
+ // name-rev commitID ouput will be "COMMIT_ID master" or "COMMIT_ID master~12"
+ commit.Branch = strings.Split(strings.Split(string(data), " ")[1], "~")[0]
+
repo.commitCache.Set(id.String(), commit)
return commit, nil
}