git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git archive and trailing "/" in prefix

From
Sergio Callegari <sergio.callegari@gmail.com>
Date
Oct 8, 2009, 22:07 UTC
Message-ID
<4ACE62B1.8070801@gmail.com>
In-Reply-To
<7v4oq9j1gs.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
Show 12 quoted lines
> Sergio Callegari <sergio.callegari@gmail.com> 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.
Show 13 quoted lines
> 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
>   
>
>   
Previous: Junio C HamanoNext: René Scharfe
Message 3 of 7 in “Git archive and trailing "/" in prefix”
  1. Sergio CallegariOct 8, 2009
  2. Junio C HamanoOct 8, 2009
  3. Sergio CallegariOct 8, 2009
  4. René ScharfeOct 9, 2009
  5. René ScharfeOct 8, 2009
  6. Junio C HamanoOct 9, 2009
  7. Linus TorvaldsOct 8, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.