Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2018-06-27 15:55:32 +0300
committerJacob Vosmaer <jacob@gitlab.com>2018-06-27 15:55:32 +0300
commit7b8cc0a225bef6d62773cf44d61e6f0e953e08a9 (patch)
tree76285bcec19066835b85d40ca50b3b34dda22147
parent306b57579406387f2dfb0adc913f0568f2f61aa8 (diff)
Simplify commit object lookup
-rw-r--r--internal/git/log/commit.go16
1 files changed, 1 insertions, 15 deletions
diff --git a/internal/git/log/commit.go b/internal/git/log/commit.go
index 341d155a2..ddb093834 100644
--- a/internal/git/log/commit.go
+++ b/internal/git/log/commit.go
@@ -4,7 +4,6 @@ import (
"bufio"
"bytes"
"context"
- "fmt"
"io/ioutil"
"strconv"
"strings"
@@ -30,7 +29,7 @@ func GetCommit(ctx context.Context, repo *pb.Repository, revision string) (*pb.G
// GetCommitCatfile looks up a commit by revision using an existing *catfile.Batch instance.
func GetCommitCatfile(c *catfile.Batch, revision string) (*pb.GitCommit, error) {
- info, err := c.Info(revision)
+ info, err := c.Info(revision + "^{commit}")
if err != nil {
if catfile.IsNotFound(err) {
return nil, nil
@@ -39,19 +38,6 @@ func GetCommitCatfile(c *catfile.Batch, revision string) (*pb.GitCommit, error)
return nil, err
}
- // If we found a tag object, resolve it to a commit. Repeat if needed but
- // not in an infinite loop.
- for i := 0; info.Type == "tag" && i < 100; i++ {
- info, err = c.Info(info.Oid + "^{commit}")
- if err != nil {
- return nil, err
- }
- }
-
- if info.Type != "commit" {
- return nil, fmt.Errorf("expected %s to resolve to commit, got %s", revision, info.Type)
- }
-
r, err := c.Commit(info.Oid)
if err != nil {
return nil, err