Skip to content

Commit 503f663

Browse files
Seija KijinAZero13
authored andcommitted
git: replace greater-than and less-than checks with one not equal check
(version < 2 || version > 2) looks silly considering this is an integer. Signed-off-by: Seija Kijin <[email protected]>
1 parent 063bceb commit 503f663

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

builtin/show-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int cmd_show_index(int argc,
4444
die("unable to read header");
4545
if (top_index[0] == htonl(PACK_IDX_SIGNATURE)) {
4646
version = ntohl(top_index[1]);
47-
if (version < 2 || version > 2)
47+
if (version != 2)
4848
die("unknown index version");
4949
if (fread(top_index, 256 * 4, 1, stdin) != 1)
5050
die("unable to read index");

packfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ int load_idx(const char *path, const unsigned int hashsz, void *idx_map,
114114

115115
if (hdr->idx_signature == htonl(PACK_IDX_SIGNATURE)) {
116116
version = ntohl(hdr->idx_version);
117-
if (version < 2 || version > 2)
117+
if (version != 2)
118118
return error("index file %s is version %"PRIu32
119119
" and is not supported by this binary"
120120
" (try upgrading GIT to a newer version)",

0 commit comments

Comments
 (0)