Last active
March 15, 2024 10:55
-
-
Save arteymix/03702e3eb05c2c161a86b49d4626d21f to your computer and use it in GitHub Desktop.
Archive HEAD and its submodules recursively
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh | |
| if [ -z $1 ]; then | |
| echo "You must specify a super-archive name." | |
| exit 1 | |
| fi | |
| git archive --prefix "$1/" -o "$1.tar" HEAD | |
| git submodule foreach --recursive "git archive --prefix=$1/\$path/ --output=\$sha1.tar HEAD && tar --concatenate --file=$(pwd)/$1.tar \$sha1.tar && rm \$sha1.tar" | |
| gzip "$1.tar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
found a problem when using this on https://github.com/jaiminpan/pg_jieba which has a recursive submodule,
the current using of
\$pathwould cause deps/libmonp being put at top directory instead oflibjieba/'s subdirectory,debugging showing of these variables as:
you can see
$displaypathshowing the correctlibjieba/deps/limonpwith$pathwould meandeps/limonpcause being put to the top directory,Changing your
$pathto$displaypathresolved this problem.