feat: archive
This implements a subset of git-archive
. I've tested with files (including symlinks and executables) and folders:
$ git --git-dir=$HOME/Sandbox/repo/.git archive --format=tar HEAD | tar -tvf -
-rw-rw-r-- root/root 10 2024-05-13 16:42 a.txt
drwxrwxr-x root/root 0 2024-05-13 16:42 b/
-rw-rw-r-- root/root 21 2024-05-13 16:42 b/b1.txt
-rwxrwxr-x root/root 23 2024-05-13 16:42 c.sh
lrwxrwxrwx root/root 0 2024-05-13 16:42 root_b1.txt -> b/b1.txt
$ bazel run -- cmd/bazel-git --git-dir=$HOME/Sandbox/repo/.git archive --format=tar HEAD 2> /dev/null | tar -tvf -
-rw-r--r-- 0/0 10 2024-05-13 16:42 a.txt
drwxrwxr-x 0/0 0 2024-05-13 16:42 b/
-rw-r--r-- 0/0 21 2024-05-13 16:42 b/b1.txt
-rwxr-xr-x 0/0 23 2024-05-13 16:42 c.sh
lrwxrwxrwx 0/0 0 2024-05-13 16:42 root_b1.txt -> b/b1.txt
There are a few differences in terms of permissions, but that shouldn't matter.