Gitaly should use `archive/tar` to write tarball instead of system's tar binary
When retrieving custom hooks for a repository Gitaly delegates to the system's tar
binary to write the tarball. This is problematic because by default on macOS BSD tar is used instead of GNU tar. Small differences between these versions require different flags be passed. Currently system runtime checks are performed via runtime.GOOS
to determine if the --no-mac-metadata
flag is needed. This is not a perfect solution because the problem is not with the system, but which version of tar is being run. We are simply guessing that the system's default version of tar is being used.
Instead of spawning a separate process to write the tarball, we should use the archive/tar
to construct the tarball ourselves. This avoids running into this issue altogether.