From: Brandon Casey <casey@nrlssc.navy.mil>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: gitster@pobox.com, git@vger.kernel.org,
galak@kernel.crashing.org, Brandon Casey <drafnel@gmail.com>
Subject: Re: [PATCH 2/2] builtin/fetch.c: ignore merge config when not fetching from branch's remote
Date: Wed, 25 Aug 2010 16:41:02 -0500 [thread overview]
Message-ID: <TDHEkC5Y5b2p-yjw_5mixlQb49a7TMinj2d5CgfEHHH9Dq6lNFV7dQ@cipher.nrlssc.navy.mil> (raw)
In-Reply-To: <20100825211641.GC2319@burratino>
On 08/25/2010 04:16 PM, Jonathan Nieder wrote:
> Brandon Casey wrote:
>
>> If the argument to fetch does not specify a named remote, or if the name
>> supplied does not match the remote configured for the current branch, then
>> the current branch's merge configuration should not be considered.
>
> Thanks for a fix.
>
>> +++ b/builtin/fetch.c
>> @@ -146,7 +146,8 @@ static struct ref *get_ref_map(struct transport *transport,
>> struct remote *remote = transport->remote;
>> struct branch *branch = branch_get(NULL);
>> int has_merge = branch_has_merge_config(branch);
>> - if (remote && (remote->fetch_refspec_nr || has_merge)) {
>> + if (remote && (remote->fetch_refspec_nr || (has_merge &&
>> + !strcmp(branch->remote_name, remote->name)))) {
>
> What will happen with this (invalid) branch?
>
> [branch "tmp"]
> merge = refs/heads/tmp
The same thing that would have happened before, since a few lines
further down there is this:
if (has_merge &&
!strcmp(branch->remote_name, remote->name))
add_merge_config(&ref_map, remote_refs, branch, &tail);
I didn't trace branch_get() to check whether it returns an object
with remote_name initialized in all cases. I relied on the form
of the existing code. Perhaps it's worth investigating. If something
needs to be fixed, then it was already broken and deserves a separate
patch anyway.
-Brandon
next prev parent reply other threads:[~2010-08-25 21:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-24 6:59 reducing object store size with remote alternates or shallow clone? Kumar Gala
2010-08-24 16:45 ` Junio C Hamano
2010-08-24 18:15 ` Brandon Casey
2010-08-24 18:59 ` Junio C Hamano
2010-08-24 23:29 ` Brandon Casey
2010-08-25 17:52 ` [PATCH 1/2] t/t5510: demonstrate failure to fetch when current branch has merge ref Brandon Casey
2010-08-25 21:28 ` Junio C Hamano
2010-08-25 17:52 ` [PATCH 2/2] builtin/fetch.c: ignore merge config when not fetching from branch's remote Brandon Casey
2010-08-25 21:16 ` Jonathan Nieder
2010-08-25 21:41 ` Brandon Casey [this message]
2010-08-25 21:54 ` Junio C Hamano
2010-09-09 18:56 ` [PATCH 1/2] builtin/fetch.c: comment that branch->remote_name is usable when has_merge Brandon Casey
2010-09-09 18:56 ` [PATCH 2/2] t/t5510-fetch.sh: improve testing with explicit URL and merge spec Brandon Casey
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=TDHEkC5Y5b2p-yjw_5mixlQb49a7TMinj2d5CgfEHHH9Dq6lNFV7dQ@cipher.nrlssc.navy.mil \
--to=casey@nrlssc.navy.mil \
--cc=drafnel@gmail.com \
--cc=galak@kernel.crashing.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).