All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: Robert Zeh <robert.a.zeh@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Add git svn gc command
Date: Mon, 20 Jul 2009 00:59:29 -0700	[thread overview]
Message-ID: <20090720075929.GA5591@dcvr.yhbt.net> (raw)
In-Reply-To: <8E0EFA3B-E8C0-4030-8BAE-E8EF65694031@gmail.com>

Robert Zeh <robert.a.zeh@gmail.com> wrote:
> Add a git svn gc command that gzips all unhandled.log files, and removes 
> all index files under .git/svn.
>
> Signed-off-by: Robert Allan Zeh <robert.a.zeh@gmail.com>
> ---
>  Documentation/git-svn.txt |    4 ++++
>  git-svn.perl              |   37 +++++++++++++++++++++++++++++++++++++
>  t/t9140-git-svn-gc.sh     |   45 ++++++++++++++++++++++++++++++++++++ 
> +++++++++
>  3 files changed, 86 insertions(+), 0 deletions(-)
>  create mode 100755 t/t9140-git-svn-gc.sh

Hi Robert,

Your mailer is mangling whitespace badly so the patch isn't applying
at all.  Make sure indents are real tabs like the rest of the code.

Some more comments below, but I think this will be a good addition
to git svn.

> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -35,11 +35,14 @@ push @Git::SVN::Ra::ISA, 'SVN::Ra';
>  push @SVN::Git::Editor::ISA, 'SVN::Delta::Editor';
>  push @SVN::Git::Fetcher::ISA, 'SVN::Delta::Editor';
>  use Carp qw/croak/;
> +use Compress::Zlib;

I'd "require" Compress::Zlib lazilly so it's not loaded at startup.
It's not a stock component of Perl and not needed for the majority of
commands.

> +sub cmd_gc
> +{
> +    use Cwd;
> +       my $git_dir = $ENV{GIT_DIR};
> +    my $svn_dir = "$git_dir/svn";
> +    print getcwd;
> +    print "\n";

I'm not sure why you need to print getcwd there, leftover code from
testing/debugging?

> +sub gc_directory {
> +    if (-f $_ && basename($_) eq "unhandled.log") {
> +        my $out_filename = $_ . ".gz";
> +        print $out_filename, "\n";
> +        open my $in_fh, "<", $_ or die "Unable to open $_: $!\n";
> +        binmode $in_fh;
> +        my $gz = gzopen($out_filename, "wb") or die "Unable to open  
> $out_filename: $!\n";

gzopen with "ab" might be a better idea than "wb".  I'm not sure if
clobbering the existing log every time we run this command is a good
idea.

-- 
Eric Wong

  reply	other threads:[~2009-07-20  7:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19 23:00 [PATCH] Add git svn gc command Robert Zeh
2009-07-20  7:59 ` Eric Wong [this message]
2009-07-20  8:15   ` demerphq
2009-07-20  8:36     ` Eric Wong
2009-07-20  9:02       ` demerphq
2009-07-20 11:41         ` Thomas Rast
2009-07-20 12:18           ` demerphq
     [not found]   ` <1030C457-44CB-4D78-A692-8F3B34A3E9BD@gmail.com>
2009-07-21  3:25     ` Eric Wong

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=20090720075929.GA5591@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=git@vger.kernel.org \
    --cc=robert.a.zeh@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.