Skip to content

Commit aa4fb24

Browse files
committed
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
2 parents 0349fa0 + 3a7e783 commit aa4fb24

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

builtin/remote.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,10 +1474,13 @@ static int set_head(int argc, const char **argv, const char *prefix,
14741474
};
14751475
argc = parse_options(argc, argv, prefix, options,
14761476
builtin_remote_sethead_usage, 0);
1477-
if (argc) {
1478-
strbuf_addf(&b_head, "refs/remotes/%s/HEAD", argv[0]);
1479-
remote = remote_get(argv[0]);
1480-
}
1477+
1478+
/* All modes require at least a remote name. */
1479+
if (!argc)
1480+
usage_with_options(builtin_remote_sethead_usage, options);
1481+
1482+
strbuf_addf(&b_head, "refs/remotes/%s/HEAD", argv[0]);
1483+
remote = remote_get(argv[0]);
14811484

14821485
if (!opt_a && !opt_d && argc == 2) {
14831486
head_name = xstrdup(argv[1]);

t/unit-tests/clar/clar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ static void
350350
clar_run_suite(const struct clar_suite *suite, const char *filter)
351351
{
352352
const struct clar_func *test = suite->tests;
353-
size_t i, matchlen;
353+
size_t i, matchlen = 0;
354354
struct clar_report *report;
355355
int exact = 0;
356356

0 commit comments

Comments
 (0)