fabacab / git-archive-all.sh

A bash shell script wrapper for git-archive that archives a git superproject and its submodules, if it has any.
214 stars 86 forks source link

`--format zip` archive stores zip file itself #40

Open KSR-Yasuda opened 1 year ago

KSR-Yasuda commented 1 year ago

For --format zip, it tries to append submodule files by zip -g command, as tar --concatenate for --format tar.

However, it just adds the submodule's zip archive file.

Perhaps it is because environment zip command does not have -g option.

Procedure

% git -c protocol.file.allow=always submodule add ../b.git b
% git commit -m "b"
% git archive-all --format zip ../01.zip
  adding: b.zip (stored 0%)

% 7z l ../01.zip

7-Zip 22.01 (x64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15

Scanning the drive for archives:
1 file, 793 bytes (1 KiB)

Listing archive: ..\01.zip

--
Path = ..\01.zip
Type = zip
Physical Size = 793
Comment = 506c134f55e7ebc19cb5cf8ac3c15d4ba9a0a458

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2023-03-29 09:12:51 .....           42           42  .gitmodules
2023-03-29 09:12:51 D....            0            0  b
2023-03-29 11:36:59 ....A          260          260  b.zip                      # <-- Just a zip archive is added
------------------- ----- ------------ ------------  ------------------------
2023-03-29 11:36:59                302          302  2 files, 1 folders
% zip --help
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
  The default action is to add or replace zipfile entries from list, which
  can include the special name - to compress standard input.
  If zipfile and list are omitted, zip compresses stdin to stdout.
  -f   freshen: only changed files  -u   update: only changed or new files
  -d   delete entries in zipfile    -m   move into zipfile (delete OS files)
  -r   recurse into directories     -j   junk (don't record) directory names
  -0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)
  -1   compress faster              -9   compress better
  -q   quiet operation              -v   verbose operation/print version info
  -c   add one-line comments        -z   add zipfile comment
  -@   read names from stdin        -o   make zipfile as old as latest entry
  -x   exclude the following names  -i   include only the following names
  -F   fix zipfile (-FF try harder) -D   do not add directory entries
  -A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)
  -T   test zipfile integrity       -X   eXclude eXtra file attributes
  -!   use privileges (if granted) to obtain all aspects of WinNT security
  -$   include volume label         -S   include system and hidden files
  -e   encrypt                      -n   don't compress these suffixes
  -h2  show more help

If zip -g doesn't work as expected, you should create a tar archive, and then, recompress into a zip file.

KSR-Yasuda commented 1 year ago

Oh, #38 has already fixed it. Could you merge the PR?