git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Tamino Bauknecht <dev@tb6.eu>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 2/2] fetch: add cli option --default-only
Date: Fri, 05 Jan 2024 08:13:05 -0800	[thread overview]
Message-ID: <xmqqa5pjpxm6.fsf@gitster.g> (raw)
In-Reply-To: <20240104222259.15659-2-dev@tb6.eu> (Tamino Bauknecht's message of "Thu, 4 Jan 2024 23:22:10 +0100")

Tamino Bauknecht <dev@tb6.eu> writes:

> This option can be used to restore the default behavior of "git fetch"
> if the "fetch.all" config option is enabled.
> The flag cannot be used in combination with "--all" or explicit
> remote(s).

There is "--all" option that can be used to alter the behaviour of
the command.  This is OPT_BOOL(), and if you have

    [alias] f = fetch --all

you can say "git f --no-all" to countermand it from the command
line, as it is equivalent to "git fetch --all --no-all" and the last
one wins.

If you add "fetch.all" that makes the command behave as if it was
given "--all" from the command line even when the user didn't,
passing "--no-all" would be a lot more natural way to countermand
it, no?

"git fetch" (no parameters) are omitting two kinds of stuff, i.e.,
where we fetch from (repository) and what we are fetching from there
(refspec).  You created a need to override the configured fetch
source (aka fetch.all), and in order to countermand it, one way is
to tell the command to "fetch from the default repository", but for
that, an option that does not say "repository" anywhere is closing
door for future evolution of the command.  What if the next person
(which could be you) invented a way to say what refspec to be used
without specifying it from the command line, and needs to say "no,
no, no, do not use the configured value, but just use the default"?
In other words, "--default" will be met by a reaction "default of
which one???".

Compared to that, I would think "--[no-]all" would be a lot simpler
to understand.

The best part is that you do not have to add a new option.  Just
make sure the one specified from the command line, either --all
or --no-all, will cause the command to ignore the configured
fetch.all and you do not need to add anything new to the UI.



  parent reply	other threads:[~2024-01-05 16:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-18 20:15 new config option "fetch.all" Tamino Bauknecht
2024-01-04 14:33 ` [PATCH] fetch: add new config option fetch.all Tamino Bauknecht
2024-01-04 17:33   ` Taylor Blau
2024-01-04 18:04     ` Eric Sunshine
2024-01-04 18:29     ` Junio C Hamano
2024-01-04 18:32     ` Tamino Bauknecht
2024-01-04 19:13       ` Taylor Blau
2024-01-04 18:23   ` Junio C Hamano
2024-01-04 20:18     ` Tamino Bauknecht
2024-01-04 20:49       ` Junio C Hamano
2024-01-04 20:25 ` Tamino Bauknecht
2024-01-04 20:50   ` Eric Sunshine
2024-01-04 20:55   ` Eric Sunshine
2024-01-04 22:22 ` [PATCH v2 1/2] " Tamino Bauknecht
2024-01-04 22:22   ` [PATCH v2 2/2] fetch: add cli option --default-only Tamino Bauknecht
2024-01-05  2:43     ` Eric Sunshine
2024-01-05 16:13     ` Junio C Hamano [this message]
2024-01-06 20:17       ` [PATCH v3] fetch: add new config option fetch.all Tamino Bauknecht
2024-01-06 23:32         ` Eric Sunshine
2024-01-06 23:37           ` Eric Sunshine
2024-01-08 17:25         ` Junio C Hamano
2024-01-08 21:13           ` [PATCH] " Tamino Bauknecht
2024-01-05  1:02   ` [PATCH v2 1/2] " Eric Sunshine

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=xmqqa5pjpxm6.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=dev@tb6.eu \
    --cc=git@vger.kernel.org \
    /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).