git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Emanuele Giaquinta <e.giaquinta@glauco.it>,
	git@vger.kernel.org
Subject: Re: [PATCH 2/3] cvsimport: use show-ref to support packed refs
Date: Wed, 28 Nov 2007 19:16:36 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0711281916140.27959@racer.site> (raw)
In-Reply-To: <20071128185611.GB11320@coredump.intra.peff.net>

Hi,

On Wed, 28 Nov 2007, Jeff King wrote:

> diff --git a/git-cvsimport.perl b/git-cvsimport.perl
> index efa6a0c..b852f2f 100755
> --- a/git-cvsimport.perl
> +++ b/git-cvsimport.perl
> @@ -527,18 +527,12 @@ sub is_sha1 {
>  	return $s =~ /^[a-f0-9]{40}$/;
>  }
>  
> -sub get_headref ($$) {
> -    my $name    = shift;
> -    my $git_dir = shift;
> -
> -    my $f = "$git_dir/$remote/$name";
> -    if (open(my $fh, $f)) {
> -	    chomp(my $r = <$fh>);
> -	    is_sha1($r) or die "Cannot get head id for $name ($r): $!";
> -	    return $r;
> -    }
> -    die "unable to open $f: $!" unless $! == POSIX::ENOENT;
> -    return undef;
> +sub get_headref ($) {
> +	my $name = shift;
> +	my $r = `git show-ref -s '$name'`;
> +	return undef unless $? == 0;
> +	chomp $r;
> +	return $r;
>  }

Where has $remote gone?

Ciao,
Dscho

  reply	other threads:[~2007-11-28 19:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27 15:01 git-cvsimport bug Emanuele Giaquinta
2007-11-28 16:57 ` Jeff King
2007-11-28 18:55   ` Jeff King
2007-11-28 18:55     ` [PATCH 1/3] Add basic cvsimport tests Jeff King
2007-11-28 22:14       ` Junio C Hamano
2007-11-28 22:20         ` David Kastrup
2007-11-29  9:12         ` Andreas Ericsson
2007-11-28 18:56     ` [PATCH 2/3] cvsimport: use show-ref to support packed refs Jeff King
2007-11-28 19:16       ` Johannes Schindelin [this message]
2007-11-28 19:44         ` Jeff King
2007-11-28 20:37           ` Johannes Schindelin
2007-11-28 22:23           ` Junio C Hamano
2007-11-28 22:43             ` Jeff King
2007-11-28 22:52               ` Jeff King
2007-11-28 18:56     ` [PATCH 3/3] cvsimport: miscellaneous packed-ref fixes Jeff King
2007-11-29  0:52       ` Junio C Hamano
2007-11-29 14:19         ` Jeff King
2007-11-30 18:41     ` git-cvsimport bug Emanuele Giaquinta

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=Pine.LNX.4.64.0711281916140.27959@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=e.giaquinta@glauco.it \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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).