Skip to content

Commit 4f4be00

Browse files
rscharfegitster
authored andcommitted
archive-tar: use internal gzip by default
Drop the dependency on gzip(1) and use our internal implementation to create tar.gz and tgz files. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 23fcf8b commit 4f4be00

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

‎Documentation/git-archive.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ tar.<format>.command::
148148
to the command (e.g., `-9`).
149149
+
150150
The `tar.gz` and `tgz` formats are defined automatically and use the
151-
command `gzip -cn` by default. An internal gzip implementation can be
152-
used by specifying the value `git archive gzip`.
151+
magic command `git archive gzip` by default, which invokes an internal
152+
implementation of gzip.
153153

154154
tar.<format>.remote::
155155
If true, enable the format for use by remote clients via

‎archive-tar.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,9 @@ void init_tar_archiver(void)
526526
int i;
527527
register_archiver(&tar_archiver);
528528

529-
tar_filter_config("tar.tgz.command", "gzip -cn", NULL);
529+
tar_filter_config("tar.tgz.command", internal_gzip_command, NULL);
530530
tar_filter_config("tar.tgz.remote", "true", NULL);
531-
tar_filter_config("tar.tar.gz.command", "gzip -cn", NULL);
531+
tar_filter_config("tar.tar.gz.command", internal_gzip_command, NULL);
532532
tar_filter_config("tar.tar.gz.remote", "true", NULL);
533533
git_config(git_tar_config, NULL);
534534
for (i = 0; i < nr_tar_filters; i++) {

‎t/t5000-tar-tree.sh‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -339,21 +339,21 @@ test_expect_success 'only enabled filters are available remotely' '
339339
test_cmp_bin remote.bar config.bar
340340
'
341341

342-
test_expect_success GZIP 'git archive --format=tgz' '
342+
test_expect_success 'git archive --format=tgz' '
343343
git archive --format=tgz HEAD >j.tgz
344344
'
345345

346-
test_expect_success GZIP 'git archive --format=tar.gz' '
346+
test_expect_success 'git archive --format=tar.gz' '
347347
git archive --format=tar.gz HEAD >j1.tar.gz &&
348348
test_cmp_bin j.tgz j1.tar.gz
349349
'
350350

351-
test_expect_success GZIP 'infer tgz from .tgz filename' '
351+
test_expect_success 'infer tgz from .tgz filename' '
352352
git archive --output=j2.tgz HEAD &&
353353
test_cmp_bin j.tgz j2.tgz
354354
'
355355

356-
test_expect_success GZIP 'infer tgz from .tar.gz filename' '
356+
test_expect_success 'infer tgz from .tar.gz filename' '
357357
git archive --output=j3.tar.gz HEAD &&
358358
test_cmp_bin j.tgz j3.tar.gz
359359
'
@@ -363,31 +363,31 @@ test_expect_success GZIP 'extract tgz file' '
363363
test_cmp_bin b.tar j.tar
364364
'
365365

366-
test_expect_success GZIP 'remote tar.gz is allowed by default' '
366+
test_expect_success 'remote tar.gz is allowed by default' '
367367
git archive --remote=. --format=tar.gz HEAD >remote.tar.gz &&
368368
test_cmp_bin j.tgz remote.tar.gz
369369
'
370370

371-
test_expect_success GZIP 'remote tar.gz can be disabled' '
371+
test_expect_success 'remote tar.gz can be disabled' '
372372
git config tar.tar.gz.remote false &&
373373
test_must_fail git archive --remote=. --format=tar.gz HEAD \
374374
>remote.tar.gz
375375
'
376376

377-
test_expect_success 'git archive --format=tgz (internal gzip)' '
378-
test_config tar.tgz.command "git archive gzip" &&
379-
git archive --format=tgz HEAD >internal_gzip.tgz
377+
test_expect_success GZIP 'git archive --format=tgz (external gzip)' '
378+
test_config tar.tgz.command "gzip -cn" &&
379+
git archive --format=tgz HEAD >external_gzip.tgz
380380
'
381381

382-
test_expect_success 'git archive --format=tar.gz (internal gzip)' '
383-
test_config tar.tar.gz.command "git archive gzip" &&
384-
git archive --format=tar.gz HEAD >internal_gzip.tar.gz &&
385-
test_cmp_bin internal_gzip.tgz internal_gzip.tar.gz
382+
test_expect_success GZIP 'git archive --format=tar.gz (external gzip)' '
383+
test_config tar.tar.gz.command "gzip -cn" &&
384+
git archive --format=tar.gz HEAD >external_gzip.tar.gz &&
385+
test_cmp_bin external_gzip.tgz external_gzip.tar.gz
386386
'
387387

388-
test_expect_success GZIP 'extract tgz file (internal gzip)' '
389-
gzip -d -c <internal_gzip.tgz >internal_gzip.tar &&
390-
test_cmp_bin b.tar internal_gzip.tar
388+
test_expect_success GZIP 'extract tgz file (external gzip)' '
389+
gzip -d -c <external_gzip.tgz >external_gzip.tar &&
390+
test_cmp_bin b.tar external_gzip.tar
391391
'
392392

393393
test_expect_success 'archive and :(glob)' '

0 commit comments

Comments
 (0)