diff mbox series

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

Message ID patch-08.10-7bf04edc74-20210420T125416Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series {tag,object}*.c: refactorings + prep for a larger change | expand

Commit Message

Ævar Arnfjörð Bjarmason April 20, 2021, 1 p.m. UTC
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 <avarab@gmail.com>
---
 builtin/hash-object.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
diff mbox series

Patch

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) {