Skip to content

Sub-repo permissions filtering for git.Archive

Administrator requested to merge mlw-sub-repo-filtering-git-archive-v2 into main

Created by: mollylogue

Previous behavior: if sub-repo perms are enabled for a repo, git.Archive will return an error.

New Behavior: If sub-repo perms are enabled for a repo, git.Archive will fetch the raw permissions (a list of path includes and a list of path excludes) and convert them to pathspecs for git to use to do the filtering at the level of the git command.

NOTE: Previously, when I was implementing the code for sub-repo filtering, I investigated using pathspecs for doing filtering. I had less context than I do now and determined that it wouldn't work because it seemed that the Glob syntax and the pathspec syntax weren't compatible. It turns out that the actual permissions from perforce only use a subset of the Glob syntax (particularly wildcard support) as seen in this file I'm using this git.Archive command as a way to implement and test using pathspecs for sub-repo permissions filtering. If it's successful through testing, we can simplify and improve the performance of the git.Commits code significantly by using pathspecs and doing the filtering at that level rather than requesting the file names and filtering after the fact.

Test plan

  • Unit tests around various scenarios
  • Validate locally for repos of various sizes
  • Validate against actual perforce permissions

Merge request reports

Loading