git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Junio C Hamano <gitster@pobox.com>,
	 Igor Todorovski <itodorov@ca.ibm.com>,
	Bence Ferdinandy <bence@ferdinandy.com>
Subject: Re: [PATCH v2 0/4] refspec: treat 'fetch' as a Boolean value
Date: Wed, 19 Mar 2025 08:31:00 -0700	[thread overview]
Message-ID: <CABPp-BE6JmiXB+pUL1Z4ewVDbG2RBxCdA2m5-WTYtoKMTtu_Xw@mail.gmail.com> (raw)
In-Reply-To: <cover.1742338207.git.me@ttaylorr.com>

On Tue, Mar 18, 2025 at 3:50 PM Taylor Blau <me@ttaylorr.com> wrote:
>
> Here's a small reroll that cleans up some wording in the first patch,
> and drops the accidental inclusion of a stray 'git-diff-pairs' binary
> that was sitting in my working tree at the time of writing the initial
> commit.
>
> Otherwise the series is unchanged, but a range-diff is attached
> nonetheless. Thanks for reviewing :-).
>
> Taylor Blau (4):
>   refspec: treat 'fetch' as a Boolean value
>   refspec: replace `refspec_init()` with fetch/push variants
>   refspec: remove refspec_item_init_or_die()
>   refspec: replace `refspec_item_init()` with fetch/push variants
>
>  builtin/fetch.c    |  2 +-
>  builtin/pull.c     |  3 ++-
>  refspec.c          | 38 +++++++++++++++++++++++++++-----------
>  refspec.h          | 18 +++++++-----------
>  remote.c           |  4 ++--
>  transport-helper.c |  2 +-
>  6 files changed, 40 insertions(+), 27 deletions(-)
>
> Range-diff against v1:
> 1:  7e662acb5a ! 1:  04e1ab8209 refspec: treat 'fetch' as a Boolean value
>     @@ Commit message
>          refspec: treat 'fetch' as a Boolean value
>
>          Since 6d4c057859 (refspec: introduce struct refspec, 2018-05-16), we
>     -    have constants called REFSPEC_FETCH and REFSPEC_PUSH. This misleadingly
>     -    suggests that we might introduce other modes in the future.
>     +    have macros called REFSPEC_FETCH and REFSPEC_PUSH. This confusingly
>     +    suggests that we might introduce other modes in the future, which, while
>     +    possible, is highly unlikely.
>
>          But these values are treated as a Boolean, and stored in a struct field
>          called 'fetch'. So the following:
>     @@ Commit message
>              if (refspec->fetch) { ... }
>
>          are equivalent. Let's avoid renaming the Boolean values "true" and
>     -    "false" here and remove the two REFSPEC_ constants mentioned above.
>     +    "false" here and remove the two REFSPEC_ macros mentioned above.
>
>          Since this value is truly a Boolean and will only ever take on a value
>          of 0 or 1, we can declare it as a single bit unsigned field. In
>     @@ builtin/pull.c: static const char *get_tracking_branch(const char *remote, const
>         if (!*spec_src || !strcmp(spec_src, "HEAD"))
>                 spec_src = "HEAD";
>
>     - ## git-diff-pairs (new) ##
>     - Binary files /dev/null and git-diff-pairs differ
>     -
>       ## refspec.c ##
>      @@ refspec.c: void refspec_clear(struct refspec *rs)
>       int valid_fetch_refspec(const char *fetch_refspec_str)
> 2:  fd2354dade = 2:  c3021b82ce refspec: replace `refspec_init()` with fetch/push variants
> 3:  49b470de61 = 3:  88f6a91c46 refspec: remove refspec_item_init_or_die()
> 4:  95783265fd = 4:  f0c323988f refspec: replace `refspec_item_init()` with fetch/push variants
>
> base-commit: c702dd48567cfebca3d4a06b691de97da3f8dc4a
> --
> 2.49.0.3.gbb7a4a684c.dirty

I read through the four patches, and it seems like a straightforward
translation of the previous state to essentially a boolean.  I usually
would have picked an enum based on avoiding passing a 0 or 1 to
functions as you have in the intermediate state, but you didn't stop
at that intermediate state and refactored the function names which
makes the end result pretty nice.  Series looks good to me.

  parent reply	other threads:[~2025-03-19 15:32 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-30  3:49 Tags are no longer fetched when fetching specific commit Igor Todorovski
2025-02-13 22:38 ` Taylor Blau
2025-02-14 13:53   ` Bence Ferdinandy
2025-02-14 18:35   ` Junio C Hamano
2025-02-21  7:25     ` Jeff King
2025-03-07 23:27 ` [PATCH] fetch: fix following tags when fetching specific OID Taylor Blau
2025-03-07 23:32   ` Taylor Blau
2025-03-08  0:10   ` Junio C Hamano
2025-03-08  3:23   ` Bence Ferdinandy
2025-03-09  3:01   ` [PATCH 0/9] fetch: further ref-prefix cleanups and optimizations Jeff King
2025-03-09  3:01     ` [PATCH 1/9] t5702: fix typo in test name Jeff King
2025-03-12 21:30       ` Taylor Blau
2025-03-13  5:37         ` Jeff King
2025-03-09  3:01     ` [PATCH 2/9] t5516: prefer "oid" to "sha1" in some test titles Jeff King
2025-03-09  3:02     ` [PATCH 3/9] t5516: drop NEEDSWORK about v2 reachability behavior Jeff King
2025-03-12 21:30       ` Taylor Blau
2025-03-09  3:02     ` [PATCH 4/9] t5516: beef up exact-oid ref prefixes test Jeff King
2025-03-09  3:07     ` [PATCH 5/9] refspec_ref_prefixes(): clean up refspec_item logic Jeff King
2025-03-12 21:38       ` Taylor Blau
2025-03-13  5:41         ` Jeff King
2025-03-13 13:26           ` Junio C Hamano
2025-03-17 22:24             ` [PATCH 0/4] refspec: treat 'fetch' as a Boolean value Taylor Blau
2025-03-17 22:24               ` [PATCH 1/4] " Taylor Blau
2025-03-18  0:24                 ` Jeff King
2025-03-18  0:26                   ` Jeff King
2025-03-18 22:44                   ` Taylor Blau
2025-03-17 22:24               ` [PATCH 2/4] refspec: replace `refspec_init()` with fetch/push variants Taylor Blau
2025-03-17 22:24               ` [PATCH 3/4] refspec: remove refspec_item_init_or_die() Taylor Blau
2025-03-17 22:24               ` [PATCH 4/4] refspec: replace `refspec_item_init()` with fetch/push variants Taylor Blau
2025-03-17 23:26               ` [PATCH 0/4] refspec: treat 'fetch' as a Boolean value Junio C Hamano
2025-03-18 22:40                 ` Taylor Blau
2025-03-18 22:50             ` [PATCH v2 " Taylor Blau
2025-03-18 22:50               ` [PATCH v2 1/4] " Taylor Blau
2025-03-18 22:50               ` [PATCH v2 2/4] refspec: replace `refspec_init()` with fetch/push variants Taylor Blau
2025-03-18 22:50               ` [PATCH v2 3/4] refspec: remove refspec_item_init_or_die() Taylor Blau
2025-03-18 22:50               ` [PATCH v2 4/4] refspec: replace `refspec_item_init()` with fetch/push variants Taylor Blau
2025-03-19 15:31               ` Elijah Newren [this message]
2025-03-17 22:00           ` [PATCH 5/9] refspec_ref_prefixes(): clean up refspec_item logic Taylor Blau
2025-03-17 23:25             ` Junio C Hamano
2025-03-18 22:47               ` Taylor Blau
2025-03-09  3:08     ` [PATCH 6/9] fetch: ask server to advertise HEAD for config-less fetch Jeff King
2025-03-12 21:43       ` Taylor Blau
2025-03-13  5:46         ` Jeff King
2025-03-13 12:26           ` Junio C Hamano
2025-03-17 22:23             ` Taylor Blau
2025-03-09  3:10     ` [PATCH 7/9] fetch: stop protecting additions to ref-prefix list Jeff King
2025-03-12 21:45       ` Taylor Blau
2025-03-09  3:20     ` [PATCH 8/9] fetch: avoid ls-refs only to ask for HEAD symref update Jeff King
2025-03-13 15:53       ` Junio C Hamano
2025-03-17 18:06         ` Jeff King
2025-03-17 19:01           ` Junio C Hamano
2025-03-18  5:39             ` [PATCH 0/2] limiting followRemoteHEAD being used Jeff King
2025-03-18  5:40               ` [PATCH 1/2] fetch: only respect followRemoteHEAD with configured refspecs Jeff King
2025-03-18 23:02                 ` Taylor Blau
2025-03-18  5:41               ` [PATCH 2/2] fetch: don't ask for remote HEAD if followRemoteHEAD is "never" Jeff King
2025-03-18 19:18               ` [PATCH 0/2] limiting followRemoteHEAD being used Junio C Hamano
2025-03-18 23:02                 ` Taylor Blau
2025-03-09  3:21     ` [PATCH 9/9] fetch: use ref prefix list to skip ls-refs Jeff King
2025-03-12 21:29     ` [PATCH 0/9] fetch: further ref-prefix cleanups and optimizations Taylor Blau
2025-03-12 21:49       ` Taylor Blau
2025-03-13  5:50         ` 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=CABPp-BE6JmiXB+pUL1Z4ewVDbG2RBxCdA2m5-WTYtoKMTtu_Xw@mail.gmail.com \
    --to=newren@gmail.com \
    --cc=bence@ferdinandy.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=itodorov@ca.ibm.com \
    --cc=me@ttaylorr.com \
    --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).