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

3 messages from 2021-10-10 to 2021-10-11. Participants: Bagas Sanjaya, SZEDER Gábor.
Thread: https://gitlist.dev/t/56677

## Bagas Sanjaya, 2021-10-10 11:19

Subject: git archive -o something.tar.zst but file info just says "POSIX tar archive"
Message-ID: <e50a85f1-7be2-dab9-a453-fb93bdb71f3c@gmail.com>
URL: https://gitlist.dev/e/e50a85f1-7be2-dab9-a453-fb93bdb71f3c%40gmail.com

```
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.

-- 
An old man doll... just what I always wanted! - Clara

```

## SZEDER Gábor, 2021-10-10 11:40

Subject: Re: git archive -o something.tar.zst but file info just says "POSIX tar archive"
Message-ID: <20211010114025.GA571180@szeder.dev>
URL: https://gitlist.dev/e/20211010114025.GA571180%40szeder.dev
In-Reply-To: <e50a85f1-7be2-dab9-a453-fb93bdb71f3c@gmail.com>

```
On Sun, Oct 10, 2021 at 06:19:53PM +0700, Bagas Sanjaya wrote:
> 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:
> 
> ˋˋˋ
> (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?


```

## Bagas Sanjaya, 2021-10-11 06:43

Subject: Re: git archive -o something.tar.zst but file info just says "POSIX tar archive"
Message-ID: <38ba34f9-47e5-8059-7c16-6cf159c849ad@gmail.com>
URL: https://gitlist.dev/e/38ba34f9-47e5-8059-7c16-6cf159c849ad%40gmail.com
In-Reply-To: <20211010114025.GA571180@szeder.dev>

```
On 10/10/21 18.40, SZEDER Gábor wrote:
>    $ 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.

-- 
An old man doll... just what I always wanted! - Clara

```
