René Scharfe <l.s.r@xxxxxx> writes: >> One practical problem is that users who do this >> >> $ git archive HEAD Documentation/ | tar tf - >> >> would be expecting (at least) two different things, depending on the >> situation they are in. >> >> So at least you'd need an "--include-untracked" option, I guess. > > Right, this breaks down with directories -- most build artifacts (e.g. > .o files) are probably not meant to end up in archives. I agree that it is unwise to overload the pathspec for this purpose. Perhaps bulk of the documentation of a project is in javadoc in its source code and extracted into some directory, where the user would want to include untracked things as well as tracked ones, while untracked contents of other directories are all not meant to be packaged. As "git archive" is primarily about freezing the contents of a set of paths in a single revision into an archive, and including untracked things is secondary, perhaps the right way to do so would be to: (1) leave pathspec as-is---they mean "only this area of the named revision goes into the resulting archive", and (2) introduce a new "--add-untracked=<wildmatch>" option, that can be multiply given, is cumulative, and is used to specify which untracked paths to be included in the result from the working tree contents. So git archive \ --add-untracked=./configure \ --add-untracked='Documentation/**/*.html' \ --add-untracked='Documentation/*.[1-9]' \ HEAD -- . ':!contrib/' ':t/' might be a way to package up sources we use without tests but include the built documentation files.