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:
authorIgor Drozdov <idrozdov@gitlab.com>2019-06-14 13:13:07 +0300
committerIgor Drozdov <idrozdov@gitlab.com>2019-06-14 14:10:10 +0300
commit9d69bcbde7f5906d93327dfcb546dd4483bd7b75 (patch)
tree0b5b8cce8b85d2ebdde4d0905bc6d19c9c522042
parent7cbe010f500a1fc4a337d3169ca9fdfdafffa0ac (diff)
Allow to specify paths for last commits for treeid-last-commits-for-tree-paths
-rw-r--r--internal/service/commit/list_last_commits_for_tree.go4
-rw-r--r--internal/service/commit/list_last_commits_for_tree_test.go22
2 files changed, 25 insertions, 1 deletions
diff --git a/internal/service/commit/list_last_commits_for_tree.go b/internal/service/commit/list_last_commits_for_tree.go
index 7b2741c4d..c1064ab2f 100644
--- a/internal/service/commit/list_last_commits_for_tree.go
+++ b/internal/service/commit/list_last_commits_for_tree.go
@@ -4,6 +4,7 @@ import (
"fmt"
"io"
"sort"
+ "strings"
"gitlab.com/gitlab-org/gitaly-proto/go/gitalypb"
"gitlab.com/gitlab-org/gitaly/internal/command"
@@ -121,8 +122,9 @@ func newLSTreeParser(in *gitalypb.ListLastCommitsForTreeRequest, stream gitalypb
if path == "" || path == "/" {
path = "."
}
+ paths := strings.Split(path, " ")
- cmdArgs := []string{"ls-tree", "-z", "--full-name", string(in.GetRevision()), path}
+ cmdArgs := append([]string{"ls-tree", "-z", "--full-name", string(in.GetRevision())}, paths...)
cmd, err := git.Command(stream.Context(), in.GetRepository(), cmdArgs...)
if err != nil {
return nil, nil, err
diff --git a/internal/service/commit/list_last_commits_for_tree_test.go b/internal/service/commit/list_last_commits_for_tree_test.go
index 7ff1707de..0078cf825 100644
--- a/internal/service/commit/list_last_commits_for_tree_test.go
+++ b/internal/service/commit/list_last_commits_for_tree_test.go
@@ -168,6 +168,27 @@ func TestSuccessfulListLastCommitsForTreeRequest(t *testing.T) {
limit: 25,
offset: 13,
},
+ {
+ desc: "multiple paths provided",
+ revision: "570e7b2abdd848b95f2f578043fc23bd6f6fd24d",
+ path: []byte("files .gitmodules CONTRIBUTING.md"),
+ info: []commitInfo{
+ {
+ path: []byte("files"),
+ id: "570e7b2abdd848b95f2f578043fc23bd6f6fd24d",
+ },
+ {
+ path: []byte(".gitmodules"),
+ id: "6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9",
+ },
+ {
+ path: []byte("CONTRIBUTING.md"),
+ id: "6d394385cf567f80a8fd85055db1ab4c5295806f",
+ },
+ },
+ limit: 5,
+ offset: 0,
+ },
}
for _, testCase := range testCases {
@@ -208,6 +229,7 @@ func TestSuccessfulListLastCommitsForTreeRequest(t *testing.T) {
counter++
}
}
+ require.Equal(t, len(testCase.info), counter)
})
}
}