git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-cvsimport: fix initial checkout

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 13, 2008, 21:05 UTC
Message-ID
<7vve3qwczy.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1205435378-10411-1-git-send-email-marcandre.lureau@gmail.com>
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?

Show 17 quoted lines
> 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?

Previous: Marc-Andre LureauNext: Martin Langhoff
Message 2 of 9 in “git-cvsimport: fix initial checkout”
  1. git-cvsimport: fix initial checkoutMarc-Andre Lureau, Mar 13, 2008
  2. Junio C HamanoMar 13, 2008
  3. Martin LanghoffMar 13, 2008
  4. Marc-André LureauMar 13, 2008
  5. Marc-André LureauMar 13, 2008
  6. Martin LanghoffMar 13, 2008
  7. Junio C HamanoMar 13, 2008
  8. Martin LanghoffMar 13, 2008
  9. Marc-André LureauMar 13, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.