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

Re: [PATCH] import-tars: ignore the global PAX header

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 23, 2020, 21:08 UTC
Message-ID
<nycvar.QRO.7.76.6.2003232205580.46@tvgsbejvaqbjf.bet>
In-Reply-To
<xmqqh7yf55q7.fsf@gitster.c.googlers.com>
Hi Junio,
On Mon, 23 Mar 2020, Junio C Hamano wrote:
Show 30 quoted lines
> René Scharfe <l.s.r@web.de> writes:
>
> > Am 23.03.20 um 14:08 schrieb Johannes Schindelin via GitGitGadget:
> >> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >>
> >> Git's own `git archive` inserts that header, but it often gets into the
> >> way of `import-tars.perl` e.g. when a prefix was specified (for example
> >> via `--prefix=my-project-1.0.0/`, or when downloading a `.tar.gz` from
> >> GitHub releases): this prefix _should_ be stripped.
> >>
> >> Let's just skip it.
> >
> > git archive uses a global pax header to pass the ID of the archived
> > commit as a comment, and for mtime values after 2242-03-16.  Ignoring it
> > in a simple importer seems reasonable for now, but I don't understand
> > how this relates to prefixes.  Is it because the header is treated as a
> > regular file with the full path "pax_global_header" (independently from
> > any prefix for actual files) and can thus be placed outside the expected
> > destination directory?
>
> Thanks for asking the question, as I was also curious if we are
> throwing away too much (perhaps "prefix is given as a global pax
> header, and ignoring all global pax headers is the most expedite
> way" was the reason the patch was written that way?).  I agree with
> you that for the purpose of simple-minded importer, it probably is
> acceptable to take such a short-cut, but it would help future
> developers if we clearly documented that it is a short-cut that
> throws too much.  That would welcome their effort to enhance the
> importer, if they find it more useful to keep some other information
> found in global headers, without breaking the intent of this change.

I don't think that we're throwing away anything because the PAX header is intended to be a _header_, not a _file_, yet `contrib/fast-import/import-tars.perl` currently treats PAX headers that way.

Show 7 quoted lines
> Having said all that, even before "git archive" existed, release
> tarballs by many projects had leading prefix so that a tarball
> extract would be made inside a versioned directory.  To truly help
> users of the importer, doesn't the logic to allow the user to say
> "please strip one leading level of directory from all the tarballs I
> feed you, as I know they are versioned directories" belong to the
> command line option of the importer?

I guess nobody needed an explicit way to strip path prefixes yet, since the implicit way works so well.

Ciao, Dscho

Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 13 in “import-tars: ignore the global PAX header”
  1. import-tars: ignore the global PAX headerJohannes Schindelin via GitGitGadget, Mar 23, 2020
  2. René ScharfeMar 23, 2020
  3. Junio C HamanoMar 23, 2020
  4. Johannes SchindelinMar 23, 2020
  5. Junio C HamanoMar 23, 2020
  6. Johannes SchindelinMar 23, 2020
  7. Junio C HamanoMar 23, 2020
  8. brian m. carlsonMar 23, 2020
  9. Johannes SchindelinMar 24, 2020
  10. import-tars: ignore the global PAX headerJohannes Schindelin via GitGitGadget, Mar 24, 2020
  11. Junio C HamanoMar 24, 2020
  12. Johannes SchindelinMar 25, 2020
  13. Junio C HamanoMar 25, 2020

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.