From: John Keeping <john@keeping.me.uk>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] fetch: don't try to update unfetched tracking refs
Date: Mon, 27 May 2013 17:01:29 +0100 [thread overview]
Message-ID: <20130527160129.GN27005@serenity.lan> (raw)
In-Reply-To: <20130527154252.GB8250@sigill.intra.peff.net>
On Mon, May 27, 2013 at 11:42:52AM -0400, Jeff King wrote:
> On Mon, May 27, 2013 at 12:40:25PM +0100, John Keeping wrote:
>
> > Since commit f269048 (fetch: opportunistically update tracking refs,
> > 2013-05-11) we update tracking refs opportunistically when fetching
> > remote branches. However, if a refspec is given on the command line
> > that does not include a configured (non-pattern) refspec a fatal error
> > occurs.
>
> I'm not sure I understand what the last sentence means. I tried to add a
> test like:
>
> diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
> index ff43e08..02e30e1 100755
> --- a/t/t5510-fetch.sh
> +++ b/t/t5510-fetch.sh
> @@ -422,6 +422,16 @@ test_expect_success 'configured fetch updates tracking' '
> )
> '
>
> +test_expect_success 'non-configured ref does not confuse tracking update' '
> + cd "$D" &&
> + git update-ref refs/odd/location HEAD &&
> + (
> + cd three &&
> + git fetch origin refs/odd/location &&
> + git rev-parse --verify FETCH_HEAD
> + )
> +'
> +
> test_expect_success 'pushing nonexistent branch by mistake should not segv' '
>
> cd "$D" &&
>
> but it does not fail with the existing code. Can you give an example
> that fails?
I have this in my .git/config for git.git:
[remote "origin"]
url = git://github.com/gitster/git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/notes/amlog:refs/notes/amlog
Then doing "git fetch origin master" fails because:
fatal: Couldn't find remote ref refs/notes/amlog
The following test fails for me (and passes with my patch) - note that
in "two", remote.one.fetch is configured as
"refs/heads/master:refs/heads/one".
-- >8 --
diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
index ff43e08..c540257 100755
--- a/t/t5510-fetch.sh
+++ b/t/t5510-fetch.sh
@@ -422,6 +422,19 @@ test_expect_success 'configured fetch updates tracking' '
)
'
+test_expect_success 'configured ref does not confuse tracking' '
+
+ cd "$D" &&
+ (
+ cd one &&
+ git branch -f side
+ ) &&
+ (
+ cd two &&
+ git fetch one side
+ )
+'
+
test_expect_success 'pushing nonexistent branch by mistake should not segv' '
cd "$D" &&
next prev parent reply other threads:[~2013-05-27 16:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-27 11:40 [PATCH] fetch: don't try to update unfetched tracking refs John Keeping
2013-05-27 15:42 ` Jeff King
2013-05-27 16:01 ` John Keeping [this message]
2013-05-27 16:19 ` Jeff King
2013-05-27 16:33 ` [PATCH v2] " John Keeping
2013-05-27 16:35 ` Jeff King
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=20130527160129.GN27005@serenity.lan \
--to=john@keeping.me.uk \
--cc=git@vger.kernel.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).