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:
-rw-r--r--CHANGELOG.md2
-rw-r--r--internal/service/commit/last_commit_for_path.go2
-rw-r--r--internal/service/commit/last_commit_for_path_test.go6
3 files changed, 9 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bdc1f749f..60c0328a5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,8 @@
UNRELEASED
- Use context cancellation instead of command.Close
https://gitlab.com/gitlab-org/gitaly/merge_requests/332
+- Fix LastCommitForPath handling of tree root
+ https://gitlab.com/gitlab-org/gitaly/merge_requests/350
- Don't use 'bundle show' to find Linguist
https://gitlab.com/gitlab-org/gitaly/merge_requests/339
- Fix diff parsing when the last 10 bytes of a stream contain newlines
diff --git a/internal/service/commit/last_commit_for_path.go b/internal/service/commit/last_commit_for_path.go
index f82278dd6..d9d465c21 100644
--- a/internal/service/commit/last_commit_for_path.go
+++ b/internal/service/commit/last_commit_for_path.go
@@ -18,7 +18,7 @@ func (s *server) LastCommitForPath(ctx context.Context, in *pb.LastCommitForPath
}
path := string(in.GetPath())
- if len(path) == 0 {
+ if len(path) == 0 || path == "/" {
path = "."
}
diff --git a/internal/service/commit/last_commit_for_path_test.go b/internal/service/commit/last_commit_for_path_test.go
index a449304ed..2ea45362d 100644
--- a/internal/service/commit/last_commit_for_path_test.go
+++ b/internal/service/commit/last_commit_for_path_test.go
@@ -55,6 +55,12 @@ func TestSuccessfulLastCommitForPathRequest(t *testing.T) {
commit: commit,
},
{
+ desc: "path is '/'",
+ revision: "570e7b2abdd848b95f2f578043fc23bd6f6fd24d",
+ commit: commit,
+ path: []byte("/"),
+ },
+ {
desc: "file does not exist in this commit",
revision: "570e7b2abdd848b95f2f578043fc23bd6f6fd24d",
path: []byte("files/lfs/lfs_object.iso"),