Skip to content

Fix format detection when archiving remotely

[email protected] git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest1 patch 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1archive: init archivers before determining formatbuiltin/archive.c+4 -14 replies

Reviews trailers per patch

The patch has no Reviewed-by or Acked-by.

PatchJeff King
SeriesHelped-by Helped-by Helped-by Helped-by
1/1

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/1] Fix format detection when archiving remotely

Currently, git-archive does not properly determine the desired archive format when both --output and --remote are provided, because run_remote_archiver() does not initialize the archivers prior to calling archive_format_from_filename(). This results in the remote archiver always returning a TAR file, regardless of the requested format.

This patch initializes the TAR and ZIP archivers before calling archive_format_from_filename(), which fixes format detection.

Steps to reproduce:

∫ git version
git version 2.19.1.568.g152ad8e336-goog
∫ cd ~/src/git
∫ git archive --output ~/good.zip HEAD
∫ file ~/good.zip
/home/steadmon/good.zip: Zip archive data, at least v1.0 to extract ∫ git archive --output ~/bad.zip --remote=. HEAD
∫ file ~/bad.zip
/home/steadmon/bad.zip: POSIX tar archive

(apply patch and build)

∫ ./bin-wrappers/git archive --output ~/fixed.zip --remote=. HEAD ∫ file ~/fixed.zip
/home/steadmon/fixed.zip: Zip archive data, at least v1.0 to extract

Josh Steadmon (1):
archive: init archivers before determining format

 builtin/archive.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Signature · 1 line
2.19.1.568.g152ad8e336-goog