Re: [PATCH] git-archive: document CWD effect
- From
Junio C Hamano <junkio@cox.net>
- Date
- Apr 8, 2007, 23:21 UTC
- Message-ID
- <7virc68nc1.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <4618DFEE.8080707@lsrfire.ath.cx>
René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
Show 15 quoted lines
> Nick Williams schrieb: >> git-archive only archives the current working dir (and sub dirs) even >> when no paths are specified. For example, if I do >> >> git archive --format=tar --prefix=git-1.5.0.2/ HEAD > ~/test/test.tar >> >> from with in the Documentation dir, then I only get part of the tree. >> >> Is this the intended behavior? >> >> The reason I ask is that from my (mis)reading of the man page I expect >> to get all of the tree unless paths are specified. > > Sorry about the late reply. Would these two additional manpage lines > clear things up for you?
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. 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.
So my suggestions are:
(1) When no pathspec is given, archive the whole tree, even
when you are in a subdirectory. (2) When a pathspec is given, produce a partial tarball limited
to the named spec like we do now, but do not say it is a
tarball of the named commit (i.e. get-tar-commit-id would
say empty).An alternative to (2) would be to say "$commit:Documentation" instead, but that has a little issue of what to do when more than one pathspecs are given.