Re: [PATCH] git-archive: document CWD effect
From: René Scharfe <hidden>
Date: 2016-06-15 22:43:03
Junio C Hamano schrieb:
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.
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é