From: Daniel Barkalow <barkalow@iabervon.org>
To: Pierre Habouzit <madcoder@debian.org>
Cc: Nicolas Pitre <nico@cam.org>, Jeff King <peff@peff.net>,
Git ML <git@vger.kernel.org>
Subject: Re: [bug in next ?] git-fetch/git-push issue
Date: Mon, 5 Nov 2007 13:17:14 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0711051259580.7357@iabervon.org> (raw)
In-Reply-To: <20071105175654.GD6205@artemis.corp>
On Mon, 5 Nov 2007, Pierre Habouzit wrote:
> With the current tip of next[0], I have this bizare issue:
>
> * I have two branches say master, and next, I'm on next.
>
> * my master lags behind origin/master, but next is a fast-forward wrt
> origin/next.
>
> Now I git push:
>
> error: remote 'refs/heads/master' is not an ancestor of
> local 'refs/heads/master'.
> Maybe you are not up-to-date and need to pull first?
> updating 'refs/heads/next'
> from xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> to yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
> Counting objects: 24, done.
> Compressing objects: 100% (14/14), done.
> Writing objects: 100% (14/14), done.
> Total 14 (delta 12), reused 0 (delta 0)
> refs/heads/next: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -> yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
> updating local tracking ref 'refs/remotes/origin/master'
I think this is the bit that's wrong. I blame Jeff, in 334f4831. :)
The issue is that, in the previous version, we'd hit a continue on the
not-an-ancestor message and not reach the update_tracking_ref() section
for that ref. In 334f4831, all of the updating is after the loop, and it
doesn't filter out the refs that didn't actually get pushed.
Probably, all of the "continue;"s in do_send_pack() should also strip off
the peer_ref. Something like (totally untested):
diff --git a/builtin-send-pack.c b/builtin-send-pack.c
index 947c42b..6141672 100644
--- a/builtin-send-pack.c
+++ b/builtin-send-pack.c
@@ -254,12 +254,16 @@ static int do_send_pack(int in, int out, struct remote *remote, int nr_refspec,
if (will_delete_ref && !allow_deleting_refs) {
error("remote does not support deleting refs");
ret = -2;
+ free(ref->peer_ref);
+ ref->peer_ref = NULL;
continue;
}
if (!will_delete_ref &&
!hashcmp(ref->old_sha1, ref->peer_ref->new_sha1)) {
if (args.verbose)
fprintf(stderr, "'%s': up-to-date\n", ref->name);
+ free(ref->peer_ref);
+ ref->peer_ref = NULL;
continue;
}
@@ -303,6 +307,8 @@ static int do_send_pack(int in, int out, struct remote *remote, int nr_refspec,
ref->name,
ref->peer_ref->name);
ret = -2;
+ free(ref->peer_ref);
+ ref->peer_ref = NULL;
continue;
}
}
next prev parent reply other threads:[~2007-11-05 18:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-05 17:56 [bug in next ?] git-fetch/git-push issue Pierre Habouzit
2007-11-05 18:17 ` Daniel Barkalow [this message]
2007-11-05 21:07 ` Jeff King
2007-11-05 21:41 ` Daniel Barkalow
2007-11-05 22:55 ` Jeff King
2007-11-05 23:22 ` Junio C Hamano
2007-11-05 23:59 ` Daniel Barkalow
2007-11-05 23:46 ` Daniel Barkalow
2007-11-06 3:26 ` Jeff King
2007-11-05 18:19 ` Pierre Habouzit
2007-11-06 17:56 ` Pierre Habouzit
2007-11-06 18:09 ` Jeff King
2007-11-06 18:23 ` Junio C Hamano
2007-11-06 18:41 ` Jeff King
2007-11-06 19:37 ` Pierre Habouzit
2007-11-07 15:11 ` Pierre Habouzit
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=Pine.LNX.4.64.0711051259580.7357@iabervon.org \
--to=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=madcoder@debian.org \
--cc=nico@cam.org \
--cc=peff@peff.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 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).