git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Michael Loeffler <zvpunry@zvpunry.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] import-tars: use Archive::Tar instead of unpack()
Date: Mon, 12 Feb 2007 12:28:48 -0500	[thread overview]
Message-ID: <20070212172848.GC29621@spearce.org> (raw)
In-Reply-To: <1171289831.629.6.camel@ibook.zvpunry.de>

Michael Loeffler <zvpunry@zvpunry.de> wrote:
> This version does no longer support bzip2 or compress which will be fixed in
> an amend. I did this patch to solve 2 problems. Maybe I do another patch with
> GetoptLong and bzip2/compress support.

bzip2 and compress are popular formats applied to tars.
 
> @@ -10,6 +10,10 @@
>  ##
>  
>  use strict;
> +use Archive::Tar;
> +use Archive::Tar::File;
> +use Archive::Tar::Constant;
> +

I did not apply this hunk.  Not everyone has Archive::Tar installed.
But then again, not everyone will use this example program either.
I'm debating it.  Archive::Tar's parser will certainly be much
more robust than the one I hand-crafted.  It might also let us deal
with symlinks.  ;)

I would considering applying something like this if it would also
support at least bz2.  This is an example program meant to teach
people how to use fast-import, and maybe also to help someone who
wants to quickly import one or more .tar.gz for use with git-grep.
Requiring Archive::Tar here is not the end of Git as we know it. :)

> @@ -83,10 +64,8 @@ EOF
>  	foreach my $path (keys %files)
>  	{
>  		my ($mark, $mode) = @{$files{$path}};
> -		my $git_mode = 0644;
> -		$git_mode |= 0700 if $mode & 0111;
>  		$path =~ s,^([^/]+)/,, if $have_top_dir;
> -		printf FI "M %o :%i %s\n", $git_mode, $mark, $path;
> +		printf FI "M %o :%i %s\n", $mode & 0111 ? 0755 : 0644, $mark, $path;
>  	}
>  	print FI "\n";

This hunk is completely unrelated to the Archive::Tar rewrite.
It also fixes a rather embarrassing bug on my part; I should
have been able to get the mode right!  :-)

I've applied this hunk (and only this hunk) to my fastimport tree
and pushed it out.

-- 
Shawn.

  parent reply	other threads:[~2007-02-12 17:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12 14:17 [PATCH] import-tars: use Archive::Tar instead of unpack() Michael Loeffler
2007-02-12 14:25 ` Johannes Schindelin
2007-02-12 17:28 ` Shawn O. Pearce [this message]
2007-02-14 16:03   ` Michael Loeffler
2007-02-15  2:51     ` Shawn O. Pearce
     [not found] ` <127B27FE-1F9A-4328-A87A-77B907FFEBA7@zvpunry.de>
2007-04-24 10:13   ` Karl Hasselström
2007-04-24 10:55     ` Sam Vilain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070212172848.GC29621@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=zvpunry@zvpunry.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).