Merge branch 'dl/squelch-maybe-uninitialized'

Squelch false-positive compiler warning.

* dl/squelch-maybe-uninitialized:
  t/unit-tests/clar: fix -Wmaybe-uninitialized with -Og
  remote: bail early from set_head() if missing remote name
This commit is contained in:
Junio C Hamano
2025-08-07 08:14:38 -07:00
2 changed files with 8 additions and 5 deletions

View File

@@ -1474,10 +1474,13 @@ static int set_head(int argc, const char **argv, const char *prefix,
};
argc = parse_options(argc, argv, prefix, options,
builtin_remote_sethead_usage, 0);
if (argc) {
/* All modes require at least a remote name. */
if (!argc)
usage_with_options(builtin_remote_sethead_usage, options);
strbuf_addf(&b_head, "refs/remotes/%s/HEAD", argv[0]);
remote = remote_get(argv[0]);
}
if (!opt_a && !opt_d && argc == 2) {
head_name = xstrdup(argv[1]);

View File

@@ -350,7 +350,7 @@ static void
clar_run_suite(const struct clar_suite *suite, const char *filter)
{
const struct clar_func *test = suite->tests;
size_t i, matchlen;
size_t i, matchlen = 0;
struct clar_report *report;
int exact = 0;