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

Re: [PATCH] git-archive: document CWD effect

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Apr 9, 2007, 15:04 UTC
Message-ID
<461A55FB.6070600@lsrfire.ath.cx>
In-Reply-To
<7virc68nc1.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano schrieb:
Show 7 quoted lines
> While the updated description reflects what the command does
> more accurately, I am not sure if it is a desired behaviour.
> For one thing, --format=tar (by the way, maybe we would want to
> make this the default when none is specified?) adds the comment
> that is readable by get-tar-commit-id that claims the tarball
> contains the named commit, giving a false impression that it is
> the whole thing.

It marks the archive as being _created_ from this specific commit, not necessarily as containing all of it. Perhaps this should be noted in the documentation..

Making '--format=tar' the default is a good idea. I doubt we'll see the addition of a new archive format -- that deserves to be the default one instead of tar -- soon.

Show 8 quoted lines
> Since people who _really_ want a subtree can
> just say "git archive --format=tar HEAD:Documentation", I
> suspect we may be better off not doing "current directory only"
> by default.  This changes the behaviour, but (1) it affects only
> people who run from a subdirectory, (2) it is counterintuitive
> that your location in the working tree matters when you say "I
> want a tarball of that commit", and (3) it is an undocumented
> behaviour anyway.

I agree with (1) and (3), meaning that we are free to change the behaviour. I don't agree with (2), though. I'd find it strange if changing the working directory wouldn't change the archive contents.

We should keep consistency with the rest of git here.  Since git-archive
is just a fancy git-ls-tree, I think we should mirror its behaviour with
respect to the working directory.  (Which is what the current code does.
 Modulo bugs, of course.)
René
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 10 in “bug in git-archive?”
  1. Nick WilliamsMar 3, 2007
  2. Johannes SchindelinMar 3, 2007
  3. git-archive: document CWD effectRené Scharfe, Apr 8, 2007
  4. Junio C HamanoApr 8, 2007
  5. René ScharfeApr 9, 2007
  6. Junio C HamanoApr 9, 2007
  7. Andy ParkinsApr 9, 2007
  8. René ScharfeApr 10, 2007
  9. Junio C HamanoApr 10, 2007
  10. René ScharfeApr 11, 2007

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.