[PATCH 1/2] name-rev: wrap both blocks in braces
From: Kristoffer Haugsbakk <code@khaugsbakk.name>
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>
---
builtin/name-rev.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 6188cf98ce0..9d2774f3723 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -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,10 +516,10 @@ 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 &&
- !ishex(*(p+1))) {
+ } else if (++counter == hexsz &&
+ !ishex(*(p + 1))) {
struct object_id oid;
const char *name = NULL;
char c = *(p+1);
--
2.53.0.32.gf6228eaf9cc