]> git.ipfire.org Git - thirdparty/git.git/commitdiff
name-rev: wrap both blocks in braces
authorKristoffer Haugsbakk <code@khaugsbakk.name>
Fri, 20 Mar 2026 13:09:34 +0000 (14:09 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Mar 2026 17:11:08 +0000 (10:11 -0700)
See `CodingGuidelines`:

    - When there are multiple arms to a conditional and some of them
      require braces, enclose even a single line block in braces for
      consistency. [...]

Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/name-rev.c

index 6188cf98ce0157efe14ae3c5d8533bca82454f15..171e7bd0e98a46d78915ac7484672fb1b08be3a1 100644 (file)
@@ -466,9 +466,9 @@ static const char *get_rev_name(const struct object *o, struct strbuf *buf)
        if (!n)
                return NULL;
 
-       if (!n->generation)
+       if (!n->generation) {
                return n->tip_name;
-       else {
+       else {
                strbuf_reset(buf);
                strbuf_addstr(buf, n->tip_name);
                strbuf_strip_suffix(buf, "^0");
@@ -516,9 +516,9 @@ static void name_rev_line(char *p, struct name_ref_data *data)
 
        for (p_start = p; *p; p++) {
 #define ishex(x) (isdigit((x)) || ((x) >= 'a' && (x) <= 'f'))
-               if (!ishex(*p))
+               if (!ishex(*p)) {
                        counter = 0;
-               else if (++counter == hexsz &&
+               else if (++counter == hexsz &&
                         !ishex(*(p+1))) {
                        struct object_id oid;
                        const char *name = NULL;