git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Marc-Andre Lureau <marcandre.lureau@gmail.com>
Cc: git@vger.kernel.org, Martin Langhoff <martin@catalyst.net.nz>
Subject: Re: [PATCH] git-cvsimport: fix initial checkout
Date: Thu, 13 Mar 2008 14:05:53 -0700	[thread overview]
Message-ID: <7vve3qwczy.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <1205435378-10411-1-git-send-email-marcandre.lureau@gmail.com> (Marc-Andre Lureau's message of "Thu, 13 Mar 2008 21:09:38 +0200")

Marc-Andre Lureau <marcandre.lureau@gmail.com> writes:

> git-symbolic-ref HEAD returns master reference, even if the file does
> not exists. That prevents the initial checkout and fails in
> git-rev-parse.

I had an impression that this check was deliberately done, but I do not
recall the details.  Martin?

> diff --git a/git-cvsimport.perl b/git-cvsimport.perl
> index 95c5eec..1512fe4 100755
> --- a/git-cvsimport.perl
> +++ b/git-cvsimport.perl
> @@ -570,12 +570,16 @@ unless (-d $git_dir) {
>  	open(F, "git-symbolic-ref HEAD |") or
>  		die "Cannot run git-symbolic-ref: $!\n";
>  	chomp ($last_branch = <F>);
> -	$last_branch = basename($last_branch);
> -	close(F);
> -	unless ($last_branch) {
> +	if (-f "$git_dir/$last_branch") {
> +	    $last_branch = basename($last_branch);
> +	    unless ($last_branch) {
>  		warn "Cannot read the last branch name: $! -- assuming 'master'\n";
>  		$last_branch = "master";
> +	    }

In any case, what if last_branch is a branch with hierarchical name, I
have to wonder.  If you are on a branch whose name has a slash
in it, like "frotz/nitfol" when you start cvsimport, doesn't this (before
or after the patch) code break your repository?

  reply	other threads:[~2008-03-13 21:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13 19:09 [PATCH] git-cvsimport: fix initial checkout Marc-Andre Lureau
2008-03-13 21:05 ` Junio C Hamano [this message]
2008-03-13 22:18 ` Martin Langhoff
2008-03-13 23:04   ` Marc-André Lureau
2008-03-13 23:07     ` Marc-André Lureau
2008-03-13 23:29     ` Martin Langhoff
2008-03-13 23:15   ` Junio C Hamano
2008-03-13 23:27     ` Martin Langhoff
2008-03-13 23:22   ` Marc-André Lureau

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=7vve3qwczy.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=marcandre.lureau@gmail.com \
    --cc=martin@catalyst.net.nz \
    /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).