Thread (103 messages) 103 messages, 6 authors, 2021-04-22

[PATCH v2 08/10] hash-object: refactor nested else/if/if into else if/else if

STALE1992d

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-04-20 13:00:44
Subsystem: the rest · Maintainer: Linus Torvalds

Refactor code that was changed to this form in 4a3d85dcf67 (add
--no-filters option to git hash-object, 2008-08-03), seemingly for no
good reason.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/hash-object.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index 4d3b8c49d2..4b337e0d25 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -130,12 +130,10 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix)
 			errstr = "Can't specify files with --stdin-paths";
 		else if (vpath)
 			errstr = "Can't use --stdin-paths with --path";
-	}
-	else {
-		if (hashstdin > 1)
-			errstr = "Multiple --stdin arguments are not supported";
-		if (vpath && no_filters)
-			errstr = "Can't use --path with --no-filters";
+	} else if (hashstdin > 1) {
+		errstr = "Multiple --stdin arguments are not supported";
+	} else if (vpath && no_filters) {
+		errstr = "Can't use --path with --no-filters";
 	}
 
 	if (errstr) {
-- 
2.31.1.723.ga5d7868e4a
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help