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 <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Jun 15, 2022 at 19:05 UTC
4f4be00d302bc52d0d9d5a3d4738bb525066c710
3 files changed
+20
-20
Documentation/git-archive.txt
+2
-2
@@ -148,8 +148,8 @@ tar.<format>.command::
148
to the command (e.g., `-9`).
149
+
150
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.
153
154
tar.<format>.remote::
155
If true, enable the format for use by remote clients via
archive-tar.c
+2
-2
@@ -526,9 +526,9 @@ void init_tar_archiver(void)
526
int i;
527
register_archiver(&tar_archiver);
528
529
- tar_filter_config("tar.tgz.command", "gzip -cn", NULL);
529
+ tar_filter_config("tar.tgz.command", internal_gzip_command, NULL);
530
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);
532
tar_filter_config("tar.tar.gz.remote", "true", NULL);
533
git_config(git_tar_config, NULL);
534
for (i = 0; i < nr_tar_filters; i++) {
t/t5000-tar-tree.sh
+16
-16
@@ -339,21 +339,21 @@ test_expect_success 'only enabled filters are available remotely' '
339
test_cmp_bin remote.bar config.bar
340
'
341
342
-test_expect_success GZIP 'git archive --format=tgz' '
342
+test_expect_success 'git archive --format=tgz' '
343
git archive --format=tgz HEAD >j.tgz
344
'
345
346
-test_expect_success GZIP 'git archive --format=tar.gz' '
346
+test_expect_success 'git archive --format=tar.gz' '
347
git archive --format=tar.gz HEAD >j1.tar.gz &&
348
test_cmp_bin j.tgz j1.tar.gz
349
'
350
351
-test_expect_success GZIP 'infer tgz from .tgz filename' '
351
+test_expect_success 'infer tgz from .tgz filename' '
352
git archive --output=j2.tgz HEAD &&
353
test_cmp_bin j.tgz j2.tgz
354
'
355
356
-test_expect_success GZIP 'infer tgz from .tar.gz filename' '
356
+test_expect_success 'infer tgz from .tar.gz filename' '
357
git archive --output=j3.tar.gz HEAD &&
358
test_cmp_bin j.tgz j3.tar.gz
359
'
@@ -363,31 +363,31 @@ test_expect_success GZIP 'extract tgz file' '
363
test_cmp_bin b.tar j.tar
364
'
365
366
-test_expect_success GZIP 'remote tar.gz is allowed by default' '
366
+test_expect_success 'remote tar.gz is allowed by default' '
367
git archive --remote=. --format=tar.gz HEAD >remote.tar.gz &&
368
test_cmp_bin j.tgz remote.tar.gz
369
'
370
371
-test_expect_success GZIP 'remote tar.gz can be disabled' '
371
+test_expect_success 'remote tar.gz can be disabled' '
372
git config tar.tar.gz.remote false &&
373
test_must_fail git archive --remote=. --format=tar.gz HEAD \
374
>remote.tar.gz
375
'
376
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
380
'
381
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
386
'
387
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
391
'
392
393
test_expect_success 'archive and :(glob)' '