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

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

From
Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Date
Mar 23, 2020, 13:08 UTC
Message-ID
<pull.577.git.1584968924555.gitgitgadget@gmail.com>
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.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
    Ignore the global PAX header in import-tars.perl
    
    This problem came up in Pacman-related work, where PKGBUILD definitions
    would reference the tarballs downloaded from GitHub, and patches would
    be applied on top. To work on those patches efficiently (e.g. when an
    upgrade to a new version of the project no longer lets those patches
    apply), I need to be able to import those tarballs into playground
    worktrees and work on them. I like to use 
    contrib/fast-import/import-tars.perl for that purpose, but it really
    needs to strip the prefix, otherwise it is too tedious to work with it.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-577%2Fdscho%2Fimport-tars-skip-pax-header-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-577/dscho/import-tars-skip-pax-header-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/577
 contrib/fast-import/import-tars.perl | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl
index e800d9f5c9c..d50ce26d5d9 100755
--- a/contrib/fast-import/import-tars.perl
+++ b/contrib/fast-import/import-tars.perl
@@ -139,6 +139,8 @@
 			print FI "\n";
 		}
 
+		next if ($typeflag eq 'g'); # ignore global header
+
 		my $path;
 		if ($prefix) {
 			$path = "$prefix/$name";

base-commit: b4374e96c84ed9394fed363973eb540da308ed4f
-- 
gitgitgadget
Next: René Scharfe
Message 1 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.