Skip to content

Commit 1a1e3a5

Browse files
committed
Support other tar format configured by git tar.FORMAT.command setting
1 parent fc86194 commit 1a1e3a5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

git-archive-all.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,17 @@ if [ $VERBOSE -eq 1 ]; then
271271
fi
272272
# Concatenate archives into a super-archive.
273273
if [ $SEPARATE -eq 0 -o "-" == "$OUT_FILE" ]; then
274-
if [ $FORMAT == 'tar.gz' ]; then
274+
cmd=$(git config --get "tar.$FORMAT.command")
275+
if [ -n "$cmd" -a "$FORMAT" != "tar" ]; then
276+
superfile_=${superfile%.$FORMAT}.tar
277+
$cmd -d < "$superfile" > "$superfile_" && rm -f "$superfile"
278+
sed -e '1d' $TMPFILE | while read file; do
279+
file_=${file%.$FORMAT}.tar
280+
$cmd -d < "$file" > "$file_" && rm -f "$file"
281+
$TARCMD --concatenate -f "$superfile_" "$file_" && rm -f "$file_"
282+
done
283+
$cmd < "$superfile_" > "$superfile" && rm -f "$superfile_"
284+
elif [ $FORMAT == 'tar.gz' ]; then
275285
gunzip $superfile
276286
superfile=${superfile:0: -3} # Remove '.gz'
277287
sed -e '1d' $TMPFILE | while read file; do

0 commit comments

Comments
 (0)