Skip to contentSkip to conversation

git archive -o something.tar.zst but file info just says "POSIX tar archive"

DISCUSSION Bagas Sanjaya 2 participants 3 messages Oct 10, 2021 – Oct 11, 2021

lore
Share & tools
lore
#0 lore raw

Hi,

I noticed the following (possible bug?) when I tried to create zstd tar archive (.tar.zst) with git archive.

First, I created the plain tar archive with git archive, then extract and rearchive to zstd tar achive:

```
(on the repo)

$ git archive -o /tmp/something.tar --prefix=something/ HEAD

(outside the repo, on /tmp)

$ tar xvf something.tar
$ tar --zstd -c -v -f something.tar.zst something/
```

I checked that the archive was indeed zstd tar archive:

```
$ file something.tar.zst
something.tar.zst: Zstandard compressed data (v0.8+), Dictionary ID: None
```

Now I created the same archive with git archive directly:

```
(on the repo)

$ git archive -o /tmp/something1.tar.zst --prefix=something/ HEAD
```

But that archive info (with file) was something different:

```
(outside the repo, on /tmp)
$ file something1.tar.zst
something1.tar.zst: POSIX tar archive
```

I expected that something1.tar.zst was proper zstd tar archive, and not plain archive like above.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#1 lore raw
Quoted 8 lines · Bagas Sanjaya

I noticed the following (possible bug?) when I tried to create zstd tar archive (.tar.zst) with git archive.

$ git archive -o /tmp/something1.tar.zst --prefix=something/ HEAD
```

But that archive info (with file) was something different:

Quoted 8 lines
```
(outside the repo, on /tmp)
$ file something1.tar.zst
something1.tar.zst: POSIX tar archive
```

I expected that something1.tar.zst was proper zstd tar archive, and not plain archive like above.

  $ git archive -h |grep -e ' -l'
      -l, --list            list supported archive formats
  $ git archive -l
  tar
  tgz
  tar.gz
  zip

Does it list zstd among the supported formats on your machine?

#2 lore raw
Quoted 10 lines · SZEDER Gábor
   $ git archive -h |grep -e ' -l'
       -l, --list            list supported archive formats
   $ git archive -l
   tar
   tgz
   tar.gz
   zip

Does it list zstd among the supported formats on your machine?

Oh, I forgot to add tar.tar.zst config option.

Now git archive -l lists:

tar
tgz
tar.gz
tar.zst
tar.bz2
tar.xz
zip

and the corresponding .gitconfig are:

tar.tar.zst.command=zstd -c
tar.tar.bz2.command=bzip2 -c
tar.tar.xz.command=xz -c

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara