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:
authorMichael Leopard <mleopard@gitlab.com>2018-12-07 21:43:55 +0300
committerMichael Leopard <mleopard@gitlab.com>2018-12-07 21:43:55 +0300
commit3c41caffc462091c833bd7fe63cb40719fca6395 (patch)
tree43451e8878ab3e826d430b13b59a203b2187f2ee
parent2a64d30ec35ef78d068bf6e9abd933537a288ca2 (diff)
Improving cmd string formatting in branches.go
-rw-r--r--internal/service/ref/branches.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/service/ref/branches.go b/internal/service/ref/branches.go
index 14f256d1a..132534a62 100644
--- a/internal/service/ref/branches.go
+++ b/internal/service/ref/branches.go
@@ -60,6 +60,8 @@ func (s *server) FindBranch(ctx context.Context, req *gitalypb.FindBranchRequest
branchName = bytes.TrimPrefix(refName, []byte("refs/heads/"))
} else if bytes.HasPrefix(refName, []byte("heads/")) {
branchName = bytes.TrimPrefix(refName, []byte("heads/"))
+ } else {
+ branchName = refName
}
cmd, err := git.Command(ctx, repo, "for-each-ref", "--format", "'%(objectname) %(refname)'", fmt.Sprintf("refs/heads/%s", string(branchName)))
@@ -80,9 +82,9 @@ func (s *server) FindBranch(ctx context.Context, req *gitalypb.FindBranchRequest
var revision []byte
if len(line) > 0 {
- splitLine := bytes.Split(line, []byte(" "))
+ splitLine := bytes.Split(line[1:len(line)-1], []byte(" "))
revision = splitLine[0]
- name = splitLine[1]
+ name = bytes.TrimPrefix(splitLine[1], []byte("refs/heads/"))
}
commit, err := log.GetCommit(ctx, repo, string(revision))