git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] import-tars: ignore the global PAX header
@ 2020-03-23 13:08 Johannes Schindelin via GitGitGadget
  2020-03-23 17:09 ` René Scharfe
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2020-03-23 13:08 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Johannes Schindelin

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-03-25 18:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-23 13:08 [PATCH] import-tars: ignore the global PAX header Johannes Schindelin via GitGitGadget
2020-03-23 17:09 ` René Scharfe
2020-03-23 17:41   ` Junio C Hamano
2020-03-23 21:08     ` Johannes Schindelin
2020-03-23 21:50       ` Junio C Hamano
2020-03-23 21:05   ` Johannes Schindelin
2020-03-23 21:53     ` Junio C Hamano
2020-03-23 23:25 ` brian m. carlson
2020-03-24 13:35   ` Johannes Schindelin
2020-03-24 19:35 ` [PATCH v2] " Johannes Schindelin via GitGitGadget
2020-03-24 21:04   ` Junio C Hamano
2020-03-25 17:59     ` Johannes Schindelin
2020-03-25 18:43       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).