All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>,
	git@vger.kernel.org, David Michael Barr <davidbarr@google.com>,
	Jeff King <peff@peff.net>,
	Michael Haggerty <mhagger@alum.mit.edu>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] Fix overwritten remote ref on with fast-import.
Date: Tue, 17 Jul 2012 00:33:21 +0200	[thread overview]
Message-ID: <11883284.WI8IR4K6qp@flobuntu> (raw)
In-Reply-To: <20120716003024.GA4246@burratino>

On Sunday 15 July 2012 19:30:25 Jonathan Nieder wrote:
> Hi Florian,
> 
> Florian Achleitner wrote:
> > After importing new commits on top of refs/remotes/* the
> > ref was overwritten with the local refs/heads/master, because the name
> > of the remote reference to fetch, i.e. refs/heads/master, was used to
> > retrieve old_sha1 for it's local counterpart. Therefore, old_sha1 pointed
> > to the local head which was not contained in the remote branch and
> > couldn't
> > be updated (printing a warning ..).
> 
> I assume you are talking about the status quo here.  It's easy to
> forget that others have not already applied your patch, but using the
> present tense would make reading easier.  Think of the patch
> description as a special kind of bug report.
> 
> Unfortunately, as a bug report, the above is lacking some detail.  Do
> I understand correctly that some remote helper is failing when git
> invokes its 'import' command?  What are the symptoms?  If it prints a
> warning, what is the exact warning?

I got that problem when I wanted to make remote-svn fetch
to refs/remotes/ instead of the formerly hardcoded (in fast-export.c)
refs/heads/master. 
I didn't yet have the refspec capability (now I have it), and that seems to be 
a significant part of the problem.
The scenario is as follows:
The fast import stream contains 'commit refs/remotes/svnfile/master' and fast-
import adds all the commits on top of it and updates the ref correctly.
But the string affected by the patch, 'private', contains the remote name of 
the branch because it is duped from ref->name, namely refs/heads/master.
As a consequence, subsequent processing leads to:

fatal: bad object 0000000000000000000000000000000000000000
error: svn::file:///anypath did not send all necessary objects

..because it expects something to have arrived on refs/heads/master.

If ref/heads/master already exists, it works, but the resulting refs are 
wrong.
refs/remotes/svnfile/master points to the same commit as ref/heads/master does, 
which is the one created locally. There is no ref to the remote commits.

It follows that, on re-fetching the same remote it fails and fast-import 
refuses to update the ref:
warning: Not updating refs/remotes/svnfile/master (new tip 
5479b212afab5ef541c142bf75357405b7888e4d does not contain 
4e49b15fcc9797bb90e36ec90c14de3d5437a94d)

That's because the  refs/remotes/svnfile/master points to the wrong local-only 
commit.

After exploring the whole fetch process by inserting dozens of printfs, I 
concluded that it's wrong to retrieve the sha1 to update by passing the branch 
name on the remote side (in private) to read_ref, which gives the sha1 of a 
local branch, but that the correct ref is stored in ->peer_ref. I wasn't 
really sure what peer-ref is meant to be. That's what lead to the patch, but..
> 
> Does that remote helper advertise the 'refspec' capability?  If so,
> what refspec does it use?  If not, why not?

When it does advertise refspec like:
Debug: Remote helper: <- refspec refs/heads/master:refs/remotes/svnfile/master
it all works. Unfortunatly I didn't understand that a day ago.

But I'm still not completely sure about what the line I wanted to patch is 
for.
Doc about git-remote-helpers says: "If no refspec capability is advertised, 
there is an implied refspec *:*."
Hmm..so if the helper doesn't advertise 'refspec' the remote refs/heads/master 
is always fetched to the local refs/heads/master?
If yes, it makes sense now! A little comment in the sources would help a lot.

> 
> It might seem silly to ask for these things when you're providing a
> fix along with the report!  However, if someone else runs into the
> same symptoms, they need to be able to find your patch quickly; if
> your patch has a bad side-effect then we need to know why not to
> revert it; and if someone new starts working on the same area of code,
> they need to know what bugs to avoid reintroducing.

I think we can throw that patch away.

> 
> Curious,
> Jonathan

  parent reply	other threads:[~2012-07-16 22:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11 13:38 [RFC/PATCH 0/4] GSOC remote-svn Florian Achleitner
2012-07-11 13:38 ` [PATCH 1/4] vcs-svn: add fast_export_note to create notes Florian Achleitner
2012-07-11 13:38   ` [PATCH 2/4] Allow reading svn dumps from files via file:// urls Florian Achleitner
2012-07-11 13:38     ` [PATCH 3/4] Create a note for every imported commit containing svn metadata Florian Achleitner
2012-07-11 13:38       ` [PATCH 4/4] When debug==1, start fast-import with "--stats" instead of "--quiet" Florian Achleitner
2012-07-11 14:29     ` [PATCH 2/4] Allow reading svn dumps from files via file:// urls Dmitry Ivankov
2012-07-11 17:00       ` Junio C Hamano
2012-07-11 17:49         ` Stephen Bash
2012-07-15 14:26 ` [PATCH] Fix overwritten remote ref on with fast-import Florian Achleitner
2012-07-16  0:30   ` Jonathan Nieder
2012-07-16  4:33     ` Junio C Hamano
2012-07-16 22:33     ` Florian Achleitner [this message]
2012-07-17  3:27       ` Jonathan Nieder
2012-07-17  9:54         ` Florian Achleitner
2012-07-17 13:48           ` Jonathan Nieder
2012-07-17 20:52             ` Florian Achleitner
2012-07-17 21:02               ` Jonathan Nieder
2012-07-17 22:25                 ` Florian Achleitner
2012-07-17  9:56         ` [PATCH] Add explanatory comment for transport-helpers refs mapping Florian Achleitner
2012-07-17 16:04           ` Jonathan Nieder

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=11883284.WI8IR4K6qp@flobuntu \
    --to=florian.achleitner.2.6.31@gmail.com \
    --cc=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=mhagger@alum.mit.edu \
    --cc=peff@peff.net \
    --cc=srabbelier@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.