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

Re: [PATCH] git-archive: accept --owner and --group like GNU tar

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 5, 2018, 19:10 UTC
Message-ID
<xmqqtvw0ceat.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<ee76246b-579c-fe01-eb9c-d400061b47b6@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 11 quoted lines
>> 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.

Previous: René ScharfeNext: suzuki toshiya
Message 12 of 13 in “git-archive: accept --owner and --group like GNU tar”
  1. git-archive: accept --owner and --group like GNU tarsuzuki toshiya, Dec 29, 2017
  2. René ScharfeJan 1, 2018
  3. Perry HutchisonJan 2, 2018
  4. René ScharfeJan 4, 2018
  5. suzuki toshiyaJan 2, 2018
  6. René ScharfeJan 2, 2018
  7. suzuki toshiyaJan 4, 2018
  8. suzuki toshiyaJan 4, 2018
  9. René ScharfeJan 4, 2018
  10. Junio C HamanoJan 4, 2018
  11. René ScharfeJan 5, 2018
  12. Junio C HamanoJan 5, 2018
  13. suzuki toshiyaJan 5, 2018

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.