git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/4] Unify pack header checking between index-pack and unpack-objects

From
Dan McGee <dpmcgee@gmail.com>
Date
Mar 31, 2011, 01:24 UTC
Message-ID
<1301534674-31981-4-git-send-email-dpmcgee@gmail.com>
In-Reply-To
<1301534674-31981-1-git-send-email-dpmcgee@gmail.com>

Both of these builtins share a lot of common code; taking steps to bring them closer together before a likely future commit to unify some of the shared code.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
 builtin/unpack-objects.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index a9e681e..a0dde7f 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -471,10 +471,10 @@ static uint32_t unpack_all(void)
 
 	nr_objects = ntohl(hdr->hdr_entries);
 
-	if (ntohl(hdr->hdr_signature) != PACK_SIGNATURE)
-		die("bad pack file");
+	if (hdr->hdr_signature != htonl(PACK_SIGNATURE))
+		die("pack signature mismatch");
 	if (!pack_version_ok(hdr->hdr_version))
-		die("unknown pack file version %"PRIu32,
+		die("pack version %"PRIu32" unsupported",
 			ntohl(hdr->hdr_version));
 	use(sizeof(struct pack_header));
 
-- 
1.7.4.2
Previous: Dan McGeeNext: Junio C Hamano
Message 4 of 6 in “write_idx_file should use an unsigned nr_objects parameter”
  1. 1/4 write_idx_file should use an unsigned nr_objects parameterDan McGee, Mar 31, 2011
  2. 2/4 Use uint32_t for unpack-objects countersDan McGee, Mar 31, 2011
  3. 3/4 Use uint32_t for index-pack countersDan McGee, Mar 31, 2011
  4. 4/4 Unify pack header checking between index-pack and unpack-objectsDan McGee, Mar 31, 2011
  5. Junio C HamanoApr 1, 2011
  6. Dan McGeeApr 1, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.