All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rose via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Rose <83477269+AtariDreams@users.noreply.github.com>,
	Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH] git: replace two checks with one not equal check
Date: Mon, 09 Jan 2023 18:57:00 +0000	[thread overview]
Message-ID: <pull.1432.git.git.1673290620410.gitgitgadget@gmail.com> (raw)

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%2FAtariDreams%2Fversion-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1432/AtariDreams/version-v1
Pull-Request: https://github.com/git/git/pull/1432

 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 0e0b9fb95bc..ae5cbfdc407 100644
--- a/builtin/show-index.c
+++ b/builtin/show-index.c
@@ -38,7 +38,7 @@ int cmd_show_index(int argc, const char **argv, const char *prefix)
 		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 c0d7dd93f46..428f572a263 100644
--- a/packfile.c
+++ b/packfile.c
@@ -121,7 +121,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: a38d39a4c50d1275833aba54c4dbdfce9e2e9ca1
-- 
gitgitgadget

             reply	other threads:[~2023-01-09 18:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 18:57 Rose via GitGitGadget [this message]
2024-12-18  0:38 ` [PATCH v2] git: replace two checks with one not equal check AreaZR via GitGitGadget
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.git.git.1673290620410.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=83477269+AtariDreams@users.noreply.github.com \
    --cc=doremylover123@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.