git archive error "gzip -cn: gzip: command not found" with MinGit package on windows

Created on 8 Dec 2018  路  16Comments  路  Source: git-for-windows/git

  • [x ] I was not able to find an open or closed issue matching what I'm seeing

git archive does not work if you have the windows MinGit package installed because gzip is missing from the package.

gzip -cn: gzip: command not found
enhancement git-upstream up for grabs

All 16 comments

Full example, please.

Full example:

PS E:\vcpkg\vcpkg> git.exe archive FETCH_HEAD -o e:\vcpkg\vcpkgarchive.tar.gz
gzip -cn: gzip: command not found
PS E:\vcpkg\vcpkg>

Okay, it is specific to .tar.gz files. The major problem I have here is that gzip.exe would be needed only for this obscure command, and it would increase the size of the MinZip package (which I don't want). Also, it would encourage people to use gzip from the MinGit package, and that is not what MinGit is about.

Besides, the gzip.exe in Git for Windows' SDK is an MSYS2 one, i.e. it incurs all the problems we have occasionally with the MSYS2 runtime and its DLL base address.

So my current thinking is: If we can somehow implement the bare minimum code in archive-tar.c to perform gzip compression (we already link to zlib, and AFAIU gzip only adds a file header), then we could neatly side-step this issue without bundling gzip.exe.

the bare minimum code in archive-tar.c to perform gzip compression

This should help: https://github.com/madler/zlib/blob/master/test/minigzip.c

@Rastaban I had a thorough look today, and it seems that the proper solution to this would be to change archive-tar.c to use the git_deflate() facility (with appropriate initialization and cleanup), essentially by changing all call sites of write_or_die() so that they use a git_zstream * (which will have to be handed all the way down in the form of function parameters).

Based on past experience with Git for Windows users, I am not sure whether you fall into the exciting group of contributors who only need minimal guidance and are eager to fix their issue?

If not, you can just go and copy gzip.exe e.g. from http://github.com/git-for-windows/git-sdk-64/tree/master/usr/bin.

Of course, I hope you fall into that exciting group, in which case I would be happy to assist you.

@dscho, I am unable to commit to it at this time. In order to unblock vcpkg we will switch to one of the larger packages that already has gzip. When I have a block of free time I will take you up on your offer to assist me in making this change (unless someone else gets to it first)

for future reference, where would I find the instructions for building git on windows?

where would I find the instructions for building git on windows?

Here: https://github.com/git-for-windows/git/wiki/Building-Git

When I have a block of free time I will take you up on your offer to assist me in making this change

Excellent.

@dscho @Rastaban : If any of you haven't started to work on this issue, can I take this up? This would be my first contribution.

@r1walz I haven't had a chance to look at it yet, and would be happy to let you take it over.

@r1walz go for it! Do you have information to get started?

@dscho : yes, I'd love to receive some extra information

Hi @r1walz - Is there any specific information that is currently missing in this issue (#1970) thread for you, at least to get started with a trial build of the current release, just to 'pipe clean' the process?

If any of the wiki/Building-Git steps fail to work for you then do please do tell us so we can improve them.

Philip

@r1walz did you manage to compile (and use) minigzip.c (mentioned in https://github.com/git-for-windows/git/issues/1970) yet?

@dscho yes, I was able to compile and run minigzip.c, but are we not going according to this plan?

For lurkers: we talked more on IRC.

@r1walz this was quite the pleasant contribution, thank you so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Snaptags picture Snaptags  路  4Comments

dscho picture dscho  路  3Comments

drewnoakes picture drewnoakes  路  5Comments

0x7cc picture 0x7cc  路  4Comments

sschlesier picture sschlesier  路  3Comments