summaryrefslogtreecommitdiffstats
path: root/vendor/code.gitea.io/git/repo_commit.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/code.gitea.io/git/repo_commit.go')
-rw-r--r--vendor/code.gitea.io/git/repo_commit.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/vendor/code.gitea.io/git/repo_commit.go b/vendor/code.gitea.io/git/repo_commit.go
index fbb8f97a1d..2d9f5bdbf8 100644
--- a/vendor/code.gitea.io/git/repo_commit.go
+++ b/vendor/code.gitea.io/git/repo_commit.go
@@ -101,7 +101,11 @@ l:
sig, err := newGPGSignatureFromCommitline(data, (nextline+1)+sigindex, true)
if err == nil && sig != nil {
// remove signature from commit message
- cm = cm[:sigindex-1]
+ if sigindex == 0 {
+ cm = ""
+ } else {
+ cm = cm[:sigindex-1]
+ }
commit.Signature = sig
}
}
@@ -153,13 +157,14 @@ func (repo *Repository) getCommit(id SHA1) (*Commit, error) {
func (repo *Repository) GetCommit(commitID string) (*Commit, error) {
if len(commitID) != 40 {
var err error
- commitID, err = NewCommand("rev-parse", commitID).RunInDir(repo.Path)
+ actualCommitID, err := NewCommand("rev-parse", commitID).RunInDir(repo.Path)
if err != nil {
if strings.Contains(err.Error(), "unknown revision or path") {
return nil, ErrNotExist{commitID, ""}
}
return nil, err
}
+ commitID = actualCommitID
}
id, err := NewIDFromString(commitID)
if err != nil {