All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] contrib/git-svn: fix UUID reading w/pre-1.2 svn; fetch args
Date: Thu, 09 Mar 2006 02:08:38 -0800	[thread overview]
Message-ID: <7vacc07wwp.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20060308015730.GA28056@localdomain> (Eric Wong's message of "Tue, 7 Mar 2006 17:57:30 -0800")

Eric Wong <normalperson@yhbt.net> writes:

> Junio: please don't apply this patch to git.git just yet.  It seems fine
> to me, but I haven't tested it heavily yet (Yann can help me, I hope :)
> I hardly slept the past few days and I may have broken something badly
> (it pasts all the tests, though).

I won't be applying it then.

I think this part is wrong.

> @@ -922,7 +930,9 @@ sub git_commit {
>  	}
>  	my @update_ref = ('git-update-ref',"refs/remotes/$GIT_SVN",$commit);
>  	if (my $primary_parent = shift @exec_parents) {
> -		push @update_ref, $primary_parent;
> +		if (!system('git-rev-parse',"refs/remotes/$GIT_SVN")){
> +			push @update_ref, $primary_parent;
> +		}

I think you are trying to see if you have .git/refs/remotes/foo,
and I think you actually have tried it to determine that is the
case.

But "git-rev-parse refs/remotes/foo" dies not because there is
no valid file .git/refs/remotes/foo that records SHA1 of an
existing commit.  If there is refs/remotes/foo file, it thinks
you have asked for it and gives it back happily.

A demonstration:

	$ cd /var/tmp/ && rm -fr junk && mkdir junk && cd junk
        $ git init-db
	defaulting to local storage area
        $ git-rev-parse refs/remotes/foo ; echo $?
        refs/remotes/foo
        fatal: 'refs/remotes/foo': No such file or directory
        128
        $ mkdir -p refs/remotes/foo
        $ ls -a
        ./  ../  .git/	refs/
        $ git-rev-parse refs/remotes/foo; echo $?
        refs/remotes/foo
        0

If you are trying to see if there is such a ref, I would do
this:

	$ git-rev-parse --verify refs/remotes/foo^0
        git-rev-parse --verify refs/remotes/foo^0
        fatal: Needed a single revision
	128

The --verify flag makes sure that the argument resolves to a
valid 40-hexadigit string (note that it does not verify if that
object actually exists), so asking for zeroth parent makes sure
you are dealing with a ref that actually points at a commit
object that exists.

  reply	other threads:[~2006-03-09 10:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-07 22:08 git-svn, tree moves, and --no-stop-on-copy Yann Dirson
2006-03-08  1:42 ` Eric Wong
2006-03-08  1:57   ` [PATCH] contrib/git-svn: fix UUID reading w/pre-1.2 svn; fetch args Eric Wong
2006-03-09 10:08     ` Junio C Hamano [this message]
2006-03-09 11:48       ` [PATCH] contrib/git-svn: fix svn compat and " Eric Wong
2006-03-08 22:15   ` git-svn, tree moves, and --no-stop-on-copy Yann Dirson
2006-03-08 22:41     ` Yann Dirson
2006-03-09 11:50   ` [PATCH] contrib/git-svn: remove the --no-stop-on-copy flag Eric Wong
2006-03-08 17:02 ` git-svn, tree moves, and --no-stop-on-copy Matthias Urlichs

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=7vacc07wwp.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.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 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.