From: Junio C Hamano <gitster@pobox.com>
To: Colin Hinton <colinlewishinton@gmail.com>
Cc: git@vger.kernel.org, m@lfurio.us
Subject: Re: [PATCH v4] fetch.c: defer fetch.followRemoteHEAD validation
Date: Sun, 04 Oct 2026 06:27:27 -0700 [thread overview]
Message-ID: <xmqqa4otvbnk.fsf@gitster.g> (raw)
In-Reply-To: <20261003231422.6004-1-colinlewishinton@gmail.com> (Colin Hinton's message of "Sat, 3 Oct 2026 16:14:22 -0700")
Colin Hinton <colinlewishinton@gmail.com> writes:
> if (!strcmp(k, "fetch.followremotehead")) {
> + free(fetch_config->follow_remote_head_raw);
> if (!v)
> + fetch_config->follow_remote_head_raw = xstrdup("");
> else
> + fetch_config->follow_remote_head_raw = xstrdup(v);
Hmph, this means that the code cannot distinguish between
[fetch] followremotehead
[fetch] followremotehead = ""
It would be less code and more expressive if you lost the
conditional, i.e.,
if (!strcmp(k, "fetch.followremotehead"))
free(fetch_config->follow_remote_head_raw);
fetch_config->follow_remote_head_raw = xstrdup_or_null(v);
}
> +static enum follow_remote_head_settings get_follow_remote_head(const char *setting)
> +{
> + if (!setting || !*setting)
> + die(_("missing value for 'fetch.followRemoteHEAD'"));
Then you can differenciate
if (!setting)
... we got '[fetch] followRemoteHEAD' ...
die() as before, complaining that the this is not a Bool.
else if (!*setting)
... we got '[fetch] followRemoteHEAD = ""' ...
if we wanted to. It probably do not need to check for an empty
string as it will fall through the "else if" cascade below and
eventually end up with the warning + default.
> + else if (!strcmp(setting, "never"))
> + return FOLLOW_REMOTE_NEVER;
> + else if (!strcmp(setting, "create"))
> + return FOLLOW_REMOTE_CREATE;
> + else if (!strcmp(setting, "warn"))
> + return FOLLOW_REMOTE_WARN;
> + else if (!strcmp(setting, "always"))
> + return FOLLOW_REMOTE_ALWAYS;
> + warning(_("unrecognized fetch.followRemoteHEAD value '%s' ignored"), setting);
> + return BUILTIN_FOLLOW_REMOTE_HEAD_DFLT;
> +}
next prev parent reply other threads:[~2026-10-04 13:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 4:00 [PATCH] fetch.c: defer fetch.followRemoteHEAD validation Colin Hinton
2026-09-22 5:32 ` Junio C Hamano
2026-09-23 5:03 ` Colin Hinton
2026-09-24 7:50 ` Matt Hunter
2026-09-25 18:48 ` Colin Hinton
2026-09-24 7:50 ` Matt Hunter
2026-09-25 19:26 ` [PATCH v2] " Colin Hinton
2026-09-25 19:40 ` Junio C Hamano
2026-09-25 20:30 ` Colin Hinton
2026-09-30 4:21 ` Matt Hunter
2026-09-30 18:46 ` Junio C Hamano
2026-10-03 4:50 ` Colin Hinton
2026-09-25 23:06 ` [PATCH v3] " Colin Hinton
2026-10-03 23:14 ` [PATCH v4] " Colin Hinton
2026-10-04 13:27 ` Junio C Hamano [this message]
2026-10-04 15:40 ` Colin Hinton
2026-10-04 17:42 ` Junio C Hamano
2026-10-04 20:14 ` [PATCH v5] " Colin Hinton
2026-10-05 9:05 ` Matt Hunter
2026-10-05 13:07 ` Junio C Hamano
2026-10-06 3:22 ` [PATCH v6] " Colin Hinton
2026-10-07 16:50 ` Junio C Hamano
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=xmqqa4otvbnk.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=colinlewishinton@gmail.com \
--cc=git@vger.kernel.org \
--cc=m@lfurio.us \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.