git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Han Jiang <jhcarl0814@gmail.com>,  git@vger.kernel.org
Subject: Re: `git fetch --refmap=<refspec>… <repository> <refspec>… ` providing NON-empty <refspec> to the --refmap ALSO causes Git to ignore the configured refspecs
Date: Wed, 04 Sep 2024 09:47:09 -0700	[thread overview]
Message-ID: <xmqq5xrbbc36.fsf@gitster.g> (raw)
In-Reply-To: <562614e4-5384-4220-896a-20b3f79771bd@kdbg.org> (Johannes Sixt's message of "Wed, 4 Sep 2024 18:38:04 +0200")

Johannes Sixt <j6t@kdbg.org> writes:

> Am 04.09.24 um 13:12 schrieb Han Jiang:
>> 1. If the doc says "providing an empty <refspec> to the --refmap
>> option causes Git to ignore the configured refspecs and rely entirely
>> on the refspecs supplied as command-line arguments" then it's
>> reasonable to guess that "providing a non-empty <refspec> will not do
>> those".
>
> Fair enough. But then in section "Configured Remote-tracking Branches"
> it is said that "The latter use of the remote.<repository>.fetch values
> can be overridden by giving the --refmap=<refspec> parameter(s) on the
> command line." So... I dunno. Just my 2c.

This cuts both ways, I suspect.  It is so unusual to say

    git fetch --refmap="" foo bar baz

to use an empty string as <refspec> in "--refmap=<refspec>", simply
because you would not say

    git fetch origin ""

and expect the empty string is a <refspec> in "git fetch origin <refspec>".

Any string other than an empty string, e.g. 

    git fetch --refmap="refs/heads/*:refs/prefetch/x/*" foo bar baz

would have an extra side effect of storing what gets fetched, when
your primary focus is "I want the command to ignore the configured
refspec".

For these reasons, I would actually say it is quite fair for the
documentation to single out the empty string case as an idiom that
may be hard for readers to figure out for themselves without being
told.

I would not be opposed to add a sentence or two to clarify what
happens when a non-empty <refspec> is used, though.

Thanks.


  reply	other threads:[~2024-09-04 16:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  4:09 `git fetch --refmap=<refspec>… <repository> <refspec>…​` providing NON-empty <refspec> to the --refmap ALSO causes Git to ignore the configured refspecs Han Jiang
2024-09-04  6:15 ` `git fetch --refmap=<refspec>… <repository> <refspec>… ` " Johannes Sixt
2024-09-04 11:12   ` Han Jiang
2024-09-04 16:38     ` Johannes Sixt
2024-09-04 16:47       ` Junio C Hamano [this message]
2024-09-04 23:52         ` Han Jiang
2024-09-04 14:34 ` `git fetch --refmap=<refspec>… <repository> <refspec>…​` " Junio C Hamano
2024-09-04 23:41   ` Han Jiang

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=xmqq5xrbbc36.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=jhcarl0814@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).