aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2025-05-15 13:11:45 +0000
committerJunio C Hamano <gitster@pobox.com>2025-05-15 13:46:47 -0700
commit3d39bcd98ecce0fce77b00fd680bd245b2161ddf (patch)
tree42d0595e15c652871e5651a6e61b7cce3754b18b
parentfetch: avoid unnecessary work when there is no current branch (diff)
downloadgit-3d39bcd98ecce0fce77b00fd680bd245b2161ddf.tar.gz
git-3d39bcd98ecce0fce77b00fd680bd245b2161ddf.zip
Avoid redundant conditions
While `if (i <= 0) ... else if (i > 0) ...` is technically equivalent to `if (i <= 0) ... else ...`, the latter is vastly easier to read because it avoids writing out a condition that is unnecessary. Let's drop such unnecessary conditions. Pointed out by CodeQL. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--help.c2
-rw-r--r--transport-helper.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/help.c b/help.c
index 6ef90838f1..21b778707a 100644
--- a/help.c
+++ b/help.c
@@ -214,7 +214,7 @@ void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes)
else if (cmp == 0) {
ei++;
free(cmds->names[ci++]);
- } else if (cmp > 0)
+ } else
ei++;
}
diff --git a/transport-helper.c b/transport-helper.c
index 69391ee7d2..0789e5bca5 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -1437,7 +1437,7 @@ static int udt_do_read(struct unidirectional_transfer *t)
transfer_debug("%s EOF (with %i bytes in buffer)",
t->src_name, (int)t->bufuse);
t->state = SSTATE_FLUSHING;
- } else if (bytes > 0) {
+ } else {
t->bufuse += bytes;
transfer_debug("Read %i bytes from %s (buffer now at %i)",
(int)bytes, t->src_name, (int)t->bufuse);