summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-07-08 21:28:15 -0400
committerEdward Thomson <ethomson@edwardthomson.com>2022-07-08 21:28:15 -0400
commit73deea7e0cef7761588df25c396c156ae901725a (patch)
treea5d5bd3e040540bff3ee6c96e2272046ade5a449
parente598432b3109ff8a5a7ece933da7b2214c35da8d (diff)
downloadlibgit2-73deea7e0cef7761588df25c396c156ae901725a.tar.gz
pack: don't pretend we support pack files v3
Pack files v3 are introduced in the SHA256 hash transition document https://github.com/git/git/blob/master/Documentation/technical/hash-function-transition.txt Obviously we do not support these yet. Stop pretending that we do.
-rw-r--r--src/libgit2/pack.h2
-rw-r--r--tests/libgit2/pack/indexer.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/libgit2/pack.h b/src/libgit2/pack.h
index c8dc5df43..6c9dbf20b 100644
--- a/src/libgit2/pack.h
+++ b/src/libgit2/pack.h
@@ -33,7 +33,7 @@ typedef int git_pack_foreach_entry_offset_cb(
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
#define PACK_VERSION 2
-#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
+#define pack_version_ok(v) ((v) == htonl(2))
struct git_pack_header {
uint32_t hdr_signature;
uint32_t hdr_version;
diff --git a/tests/libgit2/pack/indexer.c b/tests/libgit2/pack/indexer.c
index b531b2bff..8633b201a 100644
--- a/tests/libgit2/pack/indexer.c
+++ b/tests/libgit2/pack/indexer.c
@@ -59,7 +59,7 @@ static const unsigned int corrupt_thin_pack_len = 67;
* Packfile with a missing trailer.
*/
static const unsigned char missing_trailer_pack[] = {
- 0x50, 0x41, 0x43, 0x4b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x50, 0xf4, 0x3b,
+ 0x50, 0x41, 0x43, 0x4b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x50, 0xf4, 0x3b,
};
static const unsigned int missing_trailer_pack_len = 12;
@@ -68,7 +68,7 @@ static const unsigned int missing_trailer_pack_len = 12;
* the stream reader.
*/
static const unsigned char leaky_pack[] = {
- 0x50, 0x41, 0x43, 0x4b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
+ 0x50, 0x41, 0x43, 0x4b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03,
0xf4, 0xbd, 0x51, 0x51, 0x51, 0x51, 0x51, 0x72, 0x65, 0x41, 0x4b, 0x63,
0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0xbd, 0x41, 0x4b
};