[go: up one dir, main page]

Add support for eliding the path from the result of GetArchive

I propose adding bool elide_path to GetArchiveRequest. When RepositoryService.GetArchive is called with elide_path = true, Gitaly will call git archive in such a way that <path> is elided from the resulting archive entries.

  • With elide_path = false, Gitaly calls git archive --format <format> --prefix <prefix>/ <commit-id> <path> (this is the current behavior)
  • With elide_path = true, Gitaly calls git archive --format <format> --prefix <prefix>/ <commit-id>:<path>

The difference is passing the commit ID and path as a single argument, separated by a colon, instead of two arguments (separated by a space).

If the repository contains dir/README.md, the prefix is prefix, and the path is dir:

  • With elide_path = false, the archive includes prefix/dir/README.md
  • With elide_path = true, the archive includes prefix/README.md

This will be useful for GitLab's Go proxy implementation. See gitlab#221358 (comment 360527322) and gitlab#218083 (closed)