Skip to content

Commit 9d0aca2

Browse files
committed
style(git): clang-format the worktree status parser
.clang-format sets IndentCaseLabels: false; the status_code_ok switch and a few wrapped calls in the new parser did not match it. Formatting only; no behaviour change. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 3a1b5a1 commit 9d0aca2

1 file changed

Lines changed: 27 additions & 30 deletions

File tree

‎src/git/git_context.c‎

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -492,34 +492,33 @@ typedef struct {
492492
* header, so a malformed stream fails closed instead of being misread. */
493493
static bool status_code_ok(char c) {
494494
switch (c) {
495-
case ' ':
496-
case 'M':
497-
case 'A':
498-
case 'D':
499-
case 'R':
500-
case 'C':
501-
case 'U':
502-
case '?':
503-
case '!':
504-
case 'T':
505-
case 'm':
506-
case 'a':
507-
case 'd':
508-
case 'r':
509-
case 'c':
510-
case 'u':
511-
case 't':
512-
return true;
513-
default:
514-
return false;
495+
case ' ':
496+
case 'M':
497+
case 'A':
498+
case 'D':
499+
case 'R':
500+
case 'C':
501+
case 'U':
502+
case '?':
503+
case '!':
504+
case 'T':
505+
case 'm':
506+
case 'a':
507+
case 'd':
508+
case 'r':
509+
case 'c':
510+
case 'u':
511+
case 't':
512+
return true;
513+
default:
514+
return false;
515515
}
516516
}
517517

518518
/* Retain one bounded sample; the running total always advances so the caller
519519
* sees the true stream count even when samples are capped or OOM. */
520-
static void status_add_sample(int *total, char ***samples, int *sample_count,
521-
bool *truncated, int max_samples, const char *path,
522-
size_t path_len) {
520+
static void status_add_sample(int *total, char ***samples, int *sample_count, bool *truncated,
521+
int max_samples, const char *path, size_t path_len) {
523522
(*total)++;
524523
if (*sample_count >= max_samples) {
525524
*truncated = true;
@@ -552,8 +551,8 @@ static bool status_parse_record(cbm_worktree_status_t *out, status_parser_t *par
552551
parser->expecting_source = false;
553552
return true; /* second path of a rename/copy record — not counted */
554553
}
555-
if (field_len < STATUS_HEADER_LEN || field[2] != ' ' ||
556-
!status_code_ok(field[0]) || !status_code_ok(field[1])) {
554+
if (field_len < STATUS_HEADER_LEN || field[2] != ' ' || !status_code_ok(field[0]) ||
555+
!status_code_ok(field[1])) {
557556
return false;
558557
}
559558
const char *path = field + STATUS_HEADER_LEN;
@@ -567,9 +566,8 @@ static bool status_parse_record(cbm_worktree_status_t *out, status_parser_t *par
567566
if (field[0] == 'R' || field[0] == 'C' || field[1] == 'R' || field[1] == 'C') {
568567
parser->expecting_source = true;
569568
}
570-
status_add_sample(&out->tracked_count, &out->tracked_paths,
571-
&out->tracked_sample_count, &out->tracked_truncated,
572-
parser->max_samples, path, path_len);
569+
status_add_sample(&out->tracked_count, &out->tracked_paths, &out->tracked_sample_count,
570+
&out->tracked_truncated, parser->max_samples, path, path_len);
573571
return true;
574572
}
575573

@@ -591,8 +589,7 @@ static void status_feed(status_parser_t *parser, const char *data, size_t data_l
591589
parser->partial_len += take;
592590
i += take;
593591
if (i < data_len && data[i] == '\0') {
594-
if (!status_parse_record(parser->out, parser, parser->partial,
595-
parser->partial_len)) {
592+
if (!status_parse_record(parser->out, parser, parser->partial, parser->partial_len)) {
596593
parser->parse_ok = false;
597594
return;
598595
}

0 commit comments

Comments
 (0)