From: "AreaZR via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: AreaZR <gfunni234@gmail.com>, Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH v2] git: replace two checks with one not equal check
Date: Wed, 18 Dec 2024 00:38:54 +0000 [thread overview]
Message-ID: <pull.1432.v2.git.git.1734482334390.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1432.git.git.1673290620410.gitgitgadget@gmail.com>
From: Seija Kijin <doremylover123@gmail.com>
(version < 2 || version > 2) looks silly
considering this is an integer.
Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
git: replace two checks with one not equal check
(version < 2 || version > 2) looks silly considering this is an integer.
Signed-off-by: Seija Kijin doremylover123@gmail.com
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1432%2FAreaZR%2Fversion-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1432/AreaZR/version-v2
Pull-Request: https://github.com/git/git/pull/1432
Range-diff vs v1:
1: e9172aea097 ! 1: 07e0d614c21 git: replace two checks with one not equal check
@@ Commit message
Signed-off-by: Seija Kijin <doremylover123@gmail.com>
## builtin/show-index.c ##
-@@ builtin/show-index.c: int cmd_show_index(int argc, const char **argv, const char *prefix)
+@@ builtin/show-index.c: int cmd_show_index(int argc,
die("unable to read header");
if (top_index[0] == htonl(PACK_IDX_SIGNATURE)) {
version = ntohl(top_index[1]);
builtin/show-index.c | 2 +-
packfile.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/show-index.c b/builtin/show-index.c
index f164c01bbea..5fb71a1c425 100644
--- a/builtin/show-index.c
+++ b/builtin/show-index.c
@@ -44,7 +44,7 @@ int cmd_show_index(int argc,
die("unable to read header");
if (top_index[0] == htonl(PACK_IDX_SIGNATURE)) {
version = ntohl(top_index[1]);
- if (version < 2 || version > 2)
+ if (version != 2)
die("unknown index version");
if (fread(top_index, 256 * 4, 1, stdin) != 1)
die("unable to read index");
diff --git a/packfile.c b/packfile.c
index 9c4bd81a8c7..de0662b2353 100644
--- a/packfile.c
+++ b/packfile.c
@@ -114,7 +114,7 @@ int load_idx(const char *path, const unsigned int hashsz, void *idx_map,
if (hdr->idx_signature == htonl(PACK_IDX_SIGNATURE)) {
version = ntohl(hdr->idx_version);
- if (version < 2 || version > 2)
+ if (version != 2)
return error("index file %s is version %"PRIu32
" and is not supported by this binary"
" (try upgrading GIT to a newer version)",
base-commit: 063bcebf0c917140ca0e705cbe0fdea127e90086
--
gitgitgadget
next prev parent reply other threads:[~2024-12-18 0:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 18:57 [PATCH] git: replace two checks with one not equal check Rose via GitGitGadget
2024-12-18 0:38 ` AreaZR via GitGitGadget [this message]
2024-12-18 0:50 ` [PATCH v3] git: replace greater-than and less-than " AreaZR via GitGitGadget
2024-12-18 2:44 ` [PATCH v4] " AreaZR via GitGitGadget
2024-12-18 15:39 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.1432.v2.git.git.1734482334390.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=doremylover123@gmail.com \
--cc=gfunni234@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).