Subject: Re: Git archive and trailing "/" in prefix

From: Sergio Callegari <[email-masked]>
Date: Fri, 09 Oct 2009 00:07:45 +0200

Junio C Hamano wrote:
> Sergio Callegari <[email-masked]> writes:
>
>   
>> The git-archive man page indicates that if the --prefix option is passed to
>> git-archive, it is compulsory to end the prefix with a "/"
>>     
>
> No, it does not have to.
>
> 	$ git archive --prefix=v1.6.0- v1.6.0 Makefile | tar xf -
> 	$ make -f v1.6.0-Makefile
>   
Thanks... I now see better all the possible uses.

> This is consistent with the way the same --prefix option can be used with
> checkout-index.  e.g. to swap Makefile in work tree and in the index:
>
> 	$ edit Makefile
> 	$ git checkout-index --prefix=old- Makefile
> 	$ git update-index Makefile
>         $ mv old-Makefile Makefile
>
> These may or may not be useful examples, but this feature has been with us
> for a long time.  I wouldn't be surprised if removing the ability to
> archive or checkout with filename prefix (not leading directory path
> prefix) causes grief to existing scripts of people.
>   
That's why I asked btw. I did not want to start experimenting 
modification like auto adding a "/"
after the prefix without knowing whether they could have limited some 
other uses or broken some
consistency. I now see they would do.

I guess the bug in using --prefix on a worktree with subdirs without 
specifying a path is not specific
to git archive, then.

Sergio