Re: [PATCH] archive: add test testing MIME for created archive through compression filter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bagas Sanjaya <bagasdotme@xxxxxxxxx> writes:

> +test_expect_success GZIP,BZIP2,XZ 'git archive with gzip, bzip2, and xz filters creates compressed tar archive with proper MIME type' '
> +	git config tar.tar.bz2.command "bzip2 -c" &&
> +	git config tar.tar.xz.command "xz -c" &&
> +	git archive --output HEAD.tar.gz --prefix=src/ HEAD &&

I think a lot more portable and robust way to test the feature is to
configure git config tar.tar.test.command (or come up with a name for
a suffix to be used in the test), point it at a script created in this
test script and run git archive with output filename that would trigger
the command.  Then, arrange the test to notice if the "test" script was
called with expected command line arguments and standard input.

That way, you do not need to rely on prereqs and you do not have to
resort to un-portable use of the "file" command.  After all, you are
*not* testing if "bzip2 -c" the user happens to have on their $PATH
produces output their "find" recognises as bzip2 compressed.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux