git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
To: git@vger.kernel.org, David Michael Barr <davidbarr@google.com>
Cc: florian.achleitner.2.6.31@gmail.com, Jeff King <peff@peff.net>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Michael Haggerty <mhagger@alum.mit.edu>,
	Sverre Rabbelier <srabbelier@gmail.com>
Subject: [PATCH] Fix overwritten remote ref on with fast-import.
Date: Sun, 15 Jul 2012 16:26:23 +0200	[thread overview]
Message-ID: <1342362383-31167-1-git-send-email-florian.achleitner.2.6.31@gmail.com> (raw)
In-Reply-To: <1342013933-14381-1-git-send-email-florian.achleitner.2.6.31@gmail.com>

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 ..).

There are some points that are still not completely clear to me:
- I found, that the remote ref I need is stored in ref->peer_ref. There
  is one little comment on peer_ref saying /* when renaming */. That doesn't say much
  to me. Is peer_ref the correct solution?
- fast-import's commit command does already add a commit to a branch. The
  remote ref was already correct, but got overwritten by store_updated_refs
  after fast import terminated. (I figured that out using strace).
  So the update is somewhat redundant. But probably only in this special case.(?)

Signed-off-by: Florian Achleitner <florian.achleitner.2.6.31@gmail.com>
---
 transport-helper.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/transport-helper.c b/transport-helper.c
index d6daad5..a0f05ce 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -485,8 +485,10 @@ static int fetch_with_import(struct transport *transport,
 			continue;
 		if (data->refspecs)
 			private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name);
+		else if (posn->peer_ref)
+			private = xstrdup(posn->peer_ref->name);
 		else
-			private = xstrdup(posn->name);
+			private = NULL;
 		if (private) {
 			read_ref(private, posn->old_sha1);
 			free(private);
-- 
1.7.9.5

  parent reply	other threads:[~2012-07-15 14:27 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 ` Florian Achleitner [this message]
2012-07-16  0:30   ` [PATCH] Fix overwritten remote ref on with fast-import Jonathan Nieder
2012-07-16  4:33     ` Junio C Hamano
2012-07-16 22:33     ` Florian Achleitner
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=1342362383-31167-1-git-send-email-florian.achleitner.2.6.31@gmail.com \
    --to=florian.achleitner.2.6.31@gmail.com \
    --cc=davidbarr@google.com \
    --cc=git@vger.kernel.org \
    --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 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).