From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.224.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796046382; b=sSmcYvl0xIW6sbTH/W/HruQSPwIAruky1OLzM4sX5Ty2GSD7qjAVL124qLeOpWsGHwmi RauK1i/V/cXy4hWC2XWIYETAWs6nAYRkxdy+SHG2RjQlWu00xPyyGRwjm6UIgzEq1P4SF z8C1E/QI68nbONeIPF94C/cjEKTa6VBZ2PichWu8SSXqZpjj5cXCOOmu5g/fcOrPHKGxW SJenqSm8WcDzjwBy3VorskcgJWfPaOwn40EoYvO51eGw1Z8m49wOz0+k6j32EJjdxhl7g wgFzjU9cTii0lGOv9aq64aEy1Y5ygEqjRkFAJz65JlsB0fngEhvwqDBWmkgZVi9+VwQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796046382; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:In-Reply-To: References:From:Date:Subject:Fcc:Content-Type: Content-Transfer-Encoding:MIME-Version:To:Cc; bh=8Ji7z6BXlhmHvyWxgr97zkw/ypE6Av1SpErKuGj8hh8=; b=jml36btDkNXfQ+R8oAnrpE+x3W+UL9ctcLwc1jtKxUWmaKmpbx25ZS7XABL3bWgO+YEm 5N7H/QLz0n2VlFGbMpxRaHz8KquXjcplKJS/6Co2p4u5HSplnt8Xe5nBmBoPtfKTS5ywz 5jZmWpG3fgZuYstUOsSo7ORE3XPk2ldBNXKSwvytHUYUPQFpllrn9kD/lAF+zTn33aM9d whTiqWVrlzoiCyCkvwrnlXHOM+Mjer99NfWQVGiDhrsGdveeS4JJMZQPC2M5UbbMAq86B /H1/L9jc1V6iwlJ4LAzhRQQD1KDo262YsCwC8GFQrIk4C7Rv7zNsgHS6Ig3SE51hmiQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=YTVfg+8Z; arc=none smtp.remote-ip=74.125.224.43 Received: from mail-yx1-f43.google.com (mail-yx1-f43.google.com [74.125.224.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6CB2606A681 for ; Mon, 30 Nov 2026 13:46:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C6CB2606A681 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=YTVfg+8Z Received: by mail-yx1-f43.google.com with SMTP id 956f58d0204a3-677bc4704cbso11983401d50.0 for ; Mon, 30 Nov 2026 05:46:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796046381; x=1796651181; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:references:in-reply-to:message-id:from:to:cc :subject:date:message-id:reply-to:content-type; bh=8Ji7z6BXlhmHvyWxgr97zkw/ypE6Av1SpErKuGj8hh8=; b=YTVfg+8ZSOWweaJr/OvN08bEuE5pVm+zJrPXw74GhDPcCbfmPhw4Y/70qJsn1xlYIR 4YeNcA2oEZod4qvmCuMwEqPbWtIizU959od8NHIscQSFHFkAXQfcakyj2jo5DW0C4UKD 1NL5xMiEOgQpH6rE2rgbOZPsVGl3xxmBdjJ/X2XIPFnSw7uL/JAxZsUiM0LM8+YHcVqG BPIQiDZPY+sNuWY1MyurgKxUMOjSSZoQEA8dUwKa7CY22YCeCqThPy7oulj1Q89EXkKP cfF3SWtX7cr5l/PdMImnx1zAiD12+iTFczsenso2pEyMq87g0FIn5uidgMpTD9EJdaPt KGrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796046381; x=1796651181; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:references:in-reply-to:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=8Ji7z6BXlhmHvyWxgr97zkw/ypE6Av1SpErKuGj8hh8=; b=v3RWabTuXze7ewECXeXmw3LZg2OhduyZ16qj1FsYQ7ogFtyzHSZLVj4zHdXi8OVMuF v8sQE6+qxmlGSOLRnz9eXQzUbNCqejTUMPpWd5ibOlV0NlLe24XGhIQ8jcANwG3fKJgV dVOxwaBZVqkC3KutafhMpx1sBn9RnArHk4ARTUprrWiFuh5kbfvT0thZOQOIeMO3Wlfs aQ24Qaxyg1GGY3EsCiU13UThWNJ378H9DvOdp6HJRHCI56XioRs/mvPIiNf9Xvzua7o/ +/X5pGt5RxyHQvqE9UI9Yj0oXxhiRTRFBsd2qT0oabMzxkpbbw/cCtqNo5sOoy/2piKm 0UeA== X-Gm-Message-State: APuU4Z8Sg9XOmh4J8esSBg6PGJVFgmGNJu1oRC6QbxF3nlx6XwfRub6f +m6X9E5nhDEk3dhIcvWe1FhCroJYG7ESxdR+BVPiZOBWxKVEjWG2A7VRUx1tSN49 X-Gm-Gg: AZFdTZf0jNqN0iUK6eNqTPLUnQNFYPN5MExPU2blt/H/7LIKroVJraSTFGQvQQycpyN EBdchx4BQdvCQLCXfYGWz7KcmqizH4+iW8rtXf+5xdJmTC40gXo1M0svaoXnmrg+g1NsL4H4fwR 31mqUdSYad37r7A+ueHhJQfc9PRGAPWh/+3u+4ONfNqd+cHADT9qkBNK/H6pOB2lQODkGtBrR9j SGC6MIxr/jeaJEYJdiAIzmyAMNI75mDa4HToCJJQE5n3zeVdun5b9p4tkfHwdJEXdyTag5ceSnX ldh0lJBU5vev00C/ZCsLj+cBMOJ6Blspf6ZaV2tkWPVJREE7VS829+GLXQnolvcYkl9pEW6UHwk nJCUB67BfIVdeSTj9OPS4TO3lJ9ydMQK2CfN4MYpcqz/S2cObU/k3PuvcZSjs5CGdstapOcyJMN fCcHFvfAl3INpZ7dW3nDwpzi+GfLt2sbA4QdmvTMRnLqOV3oYqJjHUgSO9c4w71Zlcdke+GkRJ5 JV+JKwg33IPncUCQOs4RdCaJXdWDpnzva3WreEUObuHH3ZBXbWcyIGfoafU56i9KQJGBBi5d0bM rjSprndO5Qil3JspMNAYsJhjXBZwFFY= X-Received: by 2002:a05:690e:bc6:b0:67d:bf51:7016 with SMTP id 956f58d0204a3-67df43f2ec1mr11612396d50.45.1796046380668; Mon, 30 Nov 2026 05:46:20 -0800 (PST) Received: from [127.0.0.1] ([20.49.63.207]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921349b3a0csm294923446d6.14.2026.11.30.05.46.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 05:46:20 -0800 (PST) Message-Id: <937e756a39fdbb659c0e0f50d4b2f8f37c3a4543.1796046376.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Harald Nordgren via GitGitGadget" Date: Mon, 30 Nov 2026 13:46:12 +0000 Subject: [PATCH v17 3/7] fetch: add remote..fetchRefmap Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 To: git@vger.kernel.org Cc: Phillip Wood , "D. Ben Knoble" , Matt Hunter , Kristoffer Haugsbakk , Harald Nordgren , Harald Nordgren From: Harald Nordgren Add a per-remote config variable, remote..fetchRefmap, that provides the default value for --refmap the same way remote..fetch already provides the default refspecs to fetch. --refmap on the command line overrides it. The refmap only says where fetched refs are stored. Configuring it does not change what a fetch without refspecs fetches. When remote..fetch is also configured, it still decides what to fetch. Its entries without a destination are stored through the refmap, and an entry with its own destination is stored only there. This lets a remote name only a few branches and store them all through one refmap: [remote "cabal"] fetch = master fetch = next fetch = seen fetchRefmap = +refs/heads/*:refs/remotes/cabal/* Tags are followed for refs stored through the refmap, the same as for refs stored through remote..fetch. With --prefetch the refmap's destinations move under refs/prefetch/ in the same way, and an empty refmap stays empty. Looking up the remote-tracking branch for a remote branch, as @{upstream} and "git branch --track" do, falls back to the refmap when remote..fetch has no match, so that these work for such branches too. A branch excluded by a negative refspec in remote..fetch stays excluded. Signed-off-by: Harald Nordgren --- Documentation/config/remote.adoc | 9 ++ Documentation/fetch-options.adoc | 3 + builtin/fetch.c | 78 ++++++++----- remote.c | 20 +++- remote.h | 6 + t/t5510-fetch.sh | 181 +++++++++++++++++++++++++++++++ 6 files changed, 269 insertions(+), 28 deletions(-) diff --git a/Documentation/config/remote.adoc b/Documentation/config/remote.adoc index 3a20d0f752..c088d6257d 100644 --- a/Documentation/config/remote.adoc +++ b/Documentation/config/remote.adoc @@ -33,6 +33,15 @@ remote..fetch:: The default set of "refspec" for linkgit:git-fetch[1]. See linkgit:git-fetch[1]. +remote..fetchRefmap:: + The default value of the `--refmap` option, used to map refs being + fetched to remote-tracking refs to store, the same way + `remote..fetch` does for an explicit refspec. + `remote..fetch`, if also configured, still decides what is + fetched, and an entry there with its own destination is stored + only at that destination. See the `--refmap` entry in + linkgit:git-fetch[1]. + remote..push:: The default set of "refspec" for linkgit:git-push[1]. See linkgit:git-push[1]. diff --git a/Documentation/fetch-options.adoc b/Documentation/fetch-options.adoc index e4b9e47806..aed38790bb 100644 --- a/Documentation/fetch-options.adoc +++ b/Documentation/fetch-options.adoc @@ -251,6 +251,9 @@ endif::git-pull[] refspecs and rely entirely on the refspecs supplied as command-line arguments. See section on "Configured Remote-tracking Branches" for details. ++ +`remote..fetchRefmap` provides the default value for this option, the +same way `remote..fetch` provides the default refspecs to fetch. `-t`:: `--tags`:: diff --git a/builtin/fetch.c b/builtin/fetch.c index fe026aca1f..53957e6b18 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -487,6 +487,29 @@ static void find_non_local_tags(const struct ref *refs, oidset_clear(&fetch_oids); } +static void move_dst_to_prefetch(struct refspec_item *item) +{ + struct strbuf new_dst = STRBUF_INIT; + char *old_dst = item->dst; + const char *sub = NULL; + + strbuf_addstr(&new_dst, ref_namespace[NAMESPACE_PREFETCH].ref); + + /* + * If old_dst starts with "refs/", then place + * sub after that prefix. Otherwise, start at + * the beginning of the string. + */ + if (!skip_prefix(old_dst, "refs/", &sub)) + sub = old_dst; + strbuf_addstr(&new_dst, sub); + + item->dst = strbuf_detach(&new_dst, NULL); + item->force = 1; + + free(old_dst); +} + static void filter_prefetch_refspec(struct refspec *rs) { int i; @@ -495,10 +518,6 @@ static void filter_prefetch_refspec(struct refspec *rs) return; for (i = 0; i < rs->nr; i++) { - struct strbuf new_dst = STRBUF_INIT; - char *old_dst; - const char *sub = NULL; - if (rs->items[i].negative) continue; if (!rs->items[i].dst || @@ -516,23 +535,18 @@ static void filter_prefetch_refspec(struct refspec *rs) continue; } - old_dst = rs->items[i].dst; - strbuf_addstr(&new_dst, ref_namespace[NAMESPACE_PREFETCH].ref); - - /* - * If old_dst starts with "refs/", then place - * sub after that prefix. Otherwise, start at - * the beginning of the string. - */ - if (!skip_prefix(old_dst, "refs/", &sub)) - sub = old_dst; - strbuf_addstr(&new_dst, sub); + move_dst_to_prefetch(&rs->items[i]); + } +} - rs->items[i].dst = strbuf_detach(&new_dst, NULL); - rs->items[i].force = 1; +static void filter_prefetch_refmap(struct refspec *refmap) +{ + if (!prefetch) + return; - free(old_dst); - } + for (int i = 0; i < refmap->nr; i++) + if (refmap->items[i].dst && refmap->items[i].dst[0]) + move_dst_to_prefetch(&refmap->items[i]); } static struct ref *get_ref_map(struct remote *remote, @@ -544,6 +558,12 @@ static struct ref *get_ref_map(struct remote *remote, struct ref *rm; struct ref *ref_map = NULL; struct ref **tail = &ref_map; + /* + * The --refmap command line option, if given, takes precedence + * over remote..fetchRefmap. + */ + struct refspec *effective_refmap = + refmap.nr ? &refmap : remote ? &remote->refmap : NULL; /* opportunistically-updated references: */ struct ref *orefs = NULL, **oref_tail = &orefs; @@ -554,6 +574,8 @@ static struct ref *get_ref_map(struct remote *remote, filter_prefetch_refspec(rs); if (remote) filter_prefetch_refspec(&remote->fetch); + if (effective_refmap) + filter_prefetch_refmap(effective_refmap); if (rs->nr) { for (i = 0; i < rs->nr; i++) { @@ -586,10 +608,11 @@ static struct ref *get_ref_map(struct remote *remote, * opportunistic entries with FETCH_HEAD_IGNORE. * * A refspec that names its own destination is not - * mapped through --refmap. + * mapped through the refmap. */ - if (refmap.nr) - map_refs_without_dst(ref_map, &refmap, &oref_tail); + if (effective_refmap && effective_refmap->nr) + map_refs_without_dst(ref_map, effective_refmap, + &oref_tail); else for (i = 0; i < remote->fetch.nr; i++) get_fetch_map(ref_map, &remote->fetch.items[i], @@ -631,12 +654,13 @@ static struct ref *get_ref_map(struct remote *remote, tail = &ref_map->next; } - if (refmap.nr) { + if (refmap.nr) drop_destinations(ref_map); - map_refs_without_dst(ref_map, &refmap, &oref_tail); - if (orefs) - *autotags = 1; - } + if (effective_refmap && effective_refmap->nr) + map_refs_without_dst(ref_map, effective_refmap, + &oref_tail); + if (orefs) + *autotags = 1; } if (tags == TAGS_SET) { diff --git a/remote.c b/remote.c index 2b7d26b844..d3bb874ed5 100644 --- a/remote.c +++ b/remote.c @@ -153,6 +153,7 @@ static struct remote *make_remote(struct remote_state *remote_state, ret->name = xstrndup(name, len); refspec_init_push(&ret->push, the_hash_algo); refspec_init_fetch(&ret->fetch, the_hash_algo); + refspec_init_fetch(&ret->refmap, the_hash_algo); string_list_init_dup(&ret->server_options); string_list_init_dup(&ret->negotiation_restrict); string_list_init_dup(&ret->negotiation_include); @@ -177,6 +178,7 @@ static void remote_clear(struct remote *remote) refspec_clear(&remote->push); refspec_clear(&remote->fetch); + refspec_clear(&remote->refmap); free((char *)remote->receivepack); free((char *)remote->uploadpack); @@ -540,6 +542,12 @@ static int handle_config(const char *key, const char *value, return -1; refspec_append(&remote->fetch, v); free(v); + } else if (!strcmp(subkey, "fetchrefmap")) { + char *v; + if (git_config_string(&v, key, value)) + return -1; + refspec_append(&remote->refmap, v); + free(v); } else if (!strcmp(subkey, "receivepack")) { char *v; if (git_config_string(&v, key, value)) @@ -1000,7 +1008,17 @@ void ref_push_report_free(struct ref_push_report *report) int remote_find_tracking(struct remote *remote, struct refspec_item *refspec) { - return refspec_find_match(&remote->fetch, refspec); + char **result = refspec->src ? &refspec->dst : &refspec->src; + + if (remote->fetch.nr && !refspec_find_match(&remote->fetch, refspec)) + return 0; + if (refspec_find_match(&remote->refmap, refspec)) + return -1; + if (refname_matches_negative_refspec_item(refspec->src, &remote->fetch)) { + FREE_AND_NULL(*result); + return -1; + } + return 0; } static struct ref *alloc_ref_with_prefix(const char *prefix, size_t prefixlen, diff --git a/remote.h b/remote.h index cca02033b9..ac485a584d 100644 --- a/remote.h +++ b/remote.h @@ -90,6 +90,12 @@ struct remote { struct refspec fetch; + /* + * How to map refs fetched without an explicit destination into our + * own namespace, the same as the --refmap command line option. + */ + struct refspec refmap; + /* * The setting for whether to fetch tags (as a separate rule from the * configured refspecs); diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index b21fafc5f7..4e01201222 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -995,6 +995,187 @@ test_expect_success '--refmap is not applied to a refspec with a destination' ' ) ' +test_expect_success 'remote.*.fetchRefmap acts like --refmap on the command line' ' + test_when_finished "git -C three config --unset remote.origin.fetchRefmap" && + git branch -f side && + git -C three config remote.origin.fetchRefmap \ + "refs/heads/*:refs/remotes/other/*" && + ( + cd three && + git update-ref refs/remotes/origin/main base-origin-main && + o=$(git rev-parse --verify refs/remotes/origin/main) && + git fetch origin main && + n=$(git rev-parse --verify refs/remotes/origin/main) && + test "$o" = "$n" && + test_must_fail git rev-parse --verify refs/remotes/origin/side && + git rev-parse --verify refs/remotes/other/main + ) +' + +check_fetched_refs () { + git for-each-ref --format="%(refname)" refs/remotes/ >actual && + cat >expect && + test_cmp expect actual +} + +setup_refmap_repos () { + test_when_finished "rm -fr fetch-refmap-upstream downstream" && + git init -b "$1" fetch-refmap-upstream && + test_commit -C fetch-refmap-upstream base && + shift && + for branch + do + git -C fetch-refmap-upstream branch "$branch" || return 1 + done && + git init downstream && + ( + cd downstream && + git remote add cabal ../fetch-refmap-upstream && + git config --unset-all remote.cabal.fetch && + git config remote.cabal.fetchRefmap \ + "+refs/heads/*:refs/remotes/cabal/*" + ) +} + +test_expect_success 'remote..fetchRefmap without tracking (baseline)' ' + setup_refmap_repos main other && + ( + cd downstream && + + # Nothing tracked, nothing fetched, no error. + git fetch cabal && + check_fetched_refs <<-\EOF && + EOF + + # An ordinary remote..fetch still decides what is + # fetched and where it is stored. + git config remote.cabal.fetch "+refs/heads/*:refs/remotes/cabal/*" && + git fetch cabal && + check_fetched_refs <<-\EOF + refs/remotes/cabal/HEAD + refs/remotes/cabal/main + refs/remotes/cabal/other + EOF + ) +' + +test_expect_success 'remote..fetchRefmap stores branches named in remote..fetch' ' + setup_refmap_repos master next seen other && + ( + cd downstream && + git config --add remote.cabal.fetch master && + git config --add remote.cabal.fetch next && + git config --add remote.cabal.fetch seen && + git fetch cabal && + check_fetched_refs <<-\EOF && + refs/remotes/cabal/HEAD + refs/remotes/cabal/master + refs/remotes/cabal/next + refs/remotes/cabal/seen + EOF + git rev-parse --verify refs/tags/base && + git branch --track topic cabal/next && + echo refs/remotes/cabal/next >expect && + git rev-parse --symbolic-full-name topic@{upstream} >actual && + test_cmp expect actual + ) +' + +test_expect_success '--refmap on the command line overrides remote..fetchRefmap' ' + setup_refmap_repos master next && + ( + cd downstream && + git config --add remote.cabal.fetch master && + git fetch --refmap="refs/heads/*:refs/remotes/other/*" cabal && + check_fetched_refs <<-\EOF + refs/remotes/other/master + EOF + ) +' + +test_expect_success '--prefetch keeps an empty --refmap empty' ' + setup_refmap_repos master && + ( + cd downstream && + git config --add remote.cabal.fetch \ + "+refs/heads/*:refs/remotes/cabal/*" && + git fetch --prefetch --refmap= cabal && + git for-each-ref refs/prefetch refs/remotes >actual && + test_must_be_empty actual + ) +' + +test_expect_success '--prefetch keeps an empty remote..fetchRefmap empty' ' + setup_refmap_repos master && + ( + cd downstream && + git config --add remote.cabal.fetch \ + "+refs/heads/*:refs/remotes/cabal/*" && + git config remote.cabal.fetchRefmap "" && + git fetch --prefetch cabal master:refs/remotes/custom/master && + git for-each-ref --format="%(refname)" refs/prefetch refs/remotes >actual && + echo refs/prefetch/remotes/custom/master >expect && + test_cmp expect actual + ) +' + +test_expect_success 'remote..fetchRefmap is not applied to a remote..fetch entry with a destination' ' + setup_refmap_repos master next && + ( + cd downstream && + git config --add remote.cabal.fetch \ + "+refs/heads/master:refs/remotes/custom/master" && + git config --add remote.cabal.fetch next && + git fetch cabal && + check_fetched_refs <<-\EOF + refs/remotes/cabal/next + refs/remotes/custom/master + EOF + ) +' + +test_expect_success 'remote..fetchRefmap is not applied to a command-line refspec with a destination' ' + setup_refmap_repos master next && + ( + cd downstream && + git fetch cabal master:refs/remotes/custom/master next && + check_fetched_refs <<-\EOF + refs/remotes/cabal/next + refs/remotes/custom/master + EOF + ) +' + +test_expect_success 'remote..fetchRefmap tracks a branch outside remote..fetch' ' + setup_refmap_repos main other && + ( + cd downstream && + git config --add remote.cabal.fetch \ + "+refs/heads/main:refs/remotes/cabal/main" && + git fetch cabal other && + git branch --track topic cabal/other && + test_cmp_config cabal branch.topic.remote && + test_cmp_config refs/heads/other branch.topic.merge && + echo refs/remotes/cabal/other >expect && + git rev-parse --symbolic-full-name topic@{upstream} >actual && + test_cmp expect actual + ) +' + +test_expect_success 'remote..fetchRefmap does not track a branch excluded by remote..fetch' ' + setup_refmap_repos main secret && + ( + cd downstream && + git config --add remote.cabal.fetch \ + "+refs/heads/*:refs/remotes/cabal/*" && + git config --add remote.cabal.fetch "^refs/heads/secret" && + git fetch cabal secret && + git rev-parse --verify refs/remotes/cabal/secret && + test_must_fail git branch --track topic cabal/secret 2>err && + test_grep "not a branch" err + ) +' + test_expect_success 'explicitly empty --refmap option disables remote.*.fetch' ' git branch -f side && ( -- gitgitgadget