Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply some v2.48 regression bugfixes #5376

Merged
merged 39 commits into from
Jan 23, 2025
Merged
Changes from 6 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
49edce4
show-index: the short help should say the command reads from its input
gitster Dec 20, 2024
0ad3d65
object-file: fix race in object collision check
pks-t Dec 30, 2024
c1acf1a
object-file: rename variables in `check_collision()`
pks-t Jan 6, 2025
cfae50e
object-file: don't special-case missing source file in collision check
pks-t Jan 6, 2025
d7fcbe2
object-file: retry linking file into place when occluding file vanishes
pks-t Jan 6, 2025
8d24d56
test-lib: invert return value of check_test_results_san_file_empty
peff Jan 7, 2025
b9a9df9
test-lib: simplify lsan results check
peff Jan 7, 2025
164a251
test-lib: add a few comments to LSan log checking
peff Jan 7, 2025
0b43274
credential-cache: respect authtype capability
hickford Jan 9, 2025
447cdec
fetch set_head: fix non-mirror remotes in bare repositories
ferdinandyb Jan 12, 2025
71e19a0
object-name: fix resolution of object names containing curly braces
newren Jan 13, 2025
191f0c8
object-name: be more strict in parsing describe-like output
newren Jan 13, 2025
bc67b4a
reftable: write correct max_update_index to header
KarthikNayak Jan 15, 2025
5e58db6
ref-filter: move ahead-behind bases into used_atom
rscharfe Jan 18, 2025
7ee4fd1
ref-filter: move is-base tip to used_atom
rscharfe Jan 18, 2025
c5490ce
ref-filter: remove ref_format_clear()
rscharfe Jan 18, 2025
9c83589
Merge branch 'jk/lsan-race-ignore-false-positive'
gitster Jan 21, 2025
aec5e0e
Merge branch 'ps/object-collision-check'
gitster Jan 17, 2025
75bc40d
bswap.h: squelch potential sparse -Wcast-truncate warnings
gitster Jan 19, 2025
b3c9b61
packfile: factor out --pack_header argument parsing
peff Jan 19, 2025
56c5e82
parse_pack_header_option(): avoid unaligned memory writes
peff Jan 19, 2025
7215d58
index-pack, unpack-objects: use get_be32() for reading pack header
peff Jan 19, 2025
f2d9cf9
index-pack, unpack-objects: use skip_prefix to avoid magic number
peff Jan 19, 2025
7c73034
Merge branch 'jk/pack-header-parse-alignment-fix'
gitster Jan 21, 2025
369aa54
Merge branch 'en/object-name-with-funny-refname-fix'
gitster Jan 17, 2025
a5dd349
Merge branch 'kn/reflog-migration-fix'
gitster Jan 17, 2025
6638779
refs: mark `ref_transaction_update_reflog()` as static
KarthikNayak Jan 21, 2025
a89e12d
refs: use 'uint64_t' for 'ref_update.index'
KarthikNayak Jan 21, 2025
148560f
reftable: prevent 'update_index' changes after adding records
KarthikNayak Jan 21, 2025
fff597d
Merge branch 'kn/reflog-migration-fix-followup'
gitster Jan 21, 2025
120b274
Merge branch 'rs/ref-filter-used-atoms-value-fix'
gitster Jan 21, 2025
1804320
Merge branch 'bf/fetch-set-head-fix' into jch
gitster Jan 21, 2025
b37dd62
Merge branch 'jc/show-index-h-update'
gitster Jan 21, 2025
9b7de7e
Merge branch 'mh/credential-cache-authtype-request-fix'
gitster Jan 21, 2025
1edca76
trace2: prevent segfault on config collection where no value specified
ad-murray Jan 10, 2025
b7a9905
grep: prevent `^$` false match at end of file
peff Jan 13, 2025
86d0c30
update-ref: do set reflog's `old_oid`
peff Jan 21, 2025
14ed4ad
Merge branch 'fixes-from-the-git-mailing-list'
dscho Jan 22, 2025
290ad15
fixup! reftable: write correct max_update_index to header
KarthikNayak Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 12 additions & 18 deletions builtin/index-pack.c
Original file line number Diff line number Diff line change
@@ -379,16 +379,18 @@ static const char *open_pack_file(const char *pack_name)

static void parse_pack_header(void)
{
struct pack_header *hdr = fill(sizeof(struct pack_header));
unsigned char *hdr = fill(sizeof(struct pack_header));

/* Header consistency check */
if (hdr->hdr_signature != htonl(PACK_SIGNATURE))
if (get_be32(hdr) != PACK_SIGNATURE)
die(_("pack signature mismatch"));
if (!pack_version_ok(hdr->hdr_version))
hdr += 4;
if (!pack_version_ok_native(get_be32(hdr)))
die(_("pack version %"PRIu32" unsupported"),
ntohl(hdr->hdr_version));
get_be32(hdr));
hdr += 4;

nr_objects = ntohl(hdr->hdr_entries);
nr_objects = get_be32(hdr);
use(sizeof(struct pack_header));
}

@@ -1954,19 +1956,11 @@ int cmd_index_pack(int argc,
warning(_("no threads support, ignoring %s"), arg);
nr_threads = 1;
}
} else if (starts_with(arg, "--pack_header=")) {
struct pack_header *hdr;
char *c;

hdr = (struct pack_header *)input_buffer;
hdr->hdr_signature = htonl(PACK_SIGNATURE);
hdr->hdr_version = htonl(strtoul(arg + 14, &c, 10));
if (*c != ',')
die(_("bad %s"), arg);
hdr->hdr_entries = htonl(strtoul(c + 1, &c, 10));
if (*c)
die(_("bad %s"), arg);
input_len = sizeof(*hdr);
} else if (skip_prefix(arg, "--pack_header=", &arg)) {
if (parse_pack_header_option(arg,
input_buffer,
&input_len) < 0)
die(_("bad --pack_header: %s"), arg);
} else if (!strcmp(arg, "-v")) {
verbose = 1;
} else if (!strcmp(arg, "--progress-title")) {
31 changes: 12 additions & 19 deletions builtin/unpack-objects.c
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
#include "progress.h"
#include "decorate.h"
#include "fsck.h"
#include "packfile.h"

static int dry_run, quiet, recover, has_errors, strict;
static const char unpack_usage[] = "git unpack-objects [-n] [-q] [-r] [--strict]";
@@ -578,15 +579,16 @@ static void unpack_one(unsigned nr)
static void unpack_all(void)
{
int i;
struct pack_header *hdr = fill(sizeof(struct pack_header));
unsigned char *hdr = fill(sizeof(struct pack_header));

nr_objects = ntohl(hdr->hdr_entries);

if (ntohl(hdr->hdr_signature) != PACK_SIGNATURE)
if (get_be32(hdr) != PACK_SIGNATURE)
die("bad pack file");
if (!pack_version_ok(hdr->hdr_version))
hdr += 4;
if (!pack_version_ok_native(get_be32(hdr)))
die("unknown pack file version %"PRIu32,
ntohl(hdr->hdr_version));
get_be32(hdr));
hdr += 4;
nr_objects = get_be32(hdr);
use(sizeof(struct pack_header));

if (!quiet)
@@ -644,19 +646,10 @@ int cmd_unpack_objects(int argc,
fsck_set_msg_types(&fsck_options, arg);
continue;
}
if (starts_with(arg, "--pack_header=")) {
struct pack_header *hdr;
char *c;

hdr = (struct pack_header *)buffer;
hdr->hdr_signature = htonl(PACK_SIGNATURE);
hdr->hdr_version = htonl(strtoul(arg + 14, &c, 10));
if (*c != ',')
die("bad %s", arg);
hdr->hdr_entries = htonl(strtoul(c + 1, &c, 10));
if (*c)
die("bad %s", arg);
len = sizeof(*hdr);
if (skip_prefix(arg, "--pack_header=", &arg)) {
if (parse_pack_header_option(arg,
buffer, &len) < 0)
die(_("bad --pack_header: %s"), arg);
continue;
}
if (skip_prefix(arg, "--max-input-size=", &arg)) {
24 changes: 12 additions & 12 deletions compat/bswap.h
Original file line number Diff line number Diff line change
@@ -183,23 +183,23 @@ static inline uint64_t get_be64(const void *ptr)
static inline void put_be32(void *ptr, uint32_t value)
{
unsigned char *p = ptr;
p[0] = value >> 24;
p[1] = value >> 16;
p[2] = value >> 8;
p[3] = value >> 0;
p[0] = (value >> 24) & 0xff;
p[1] = (value >> 16) & 0xff;
p[2] = (value >> 8) & 0xff;
p[3] = (value >> 0) & 0xff;
}

static inline void put_be64(void *ptr, uint64_t value)
{
unsigned char *p = ptr;
p[0] = value >> 56;
p[1] = value >> 48;
p[2] = value >> 40;
p[3] = value >> 32;
p[4] = value >> 24;
p[5] = value >> 16;
p[6] = value >> 8;
p[7] = value >> 0;
p[0] = (value >> 56) & 0xff;
p[1] = (value >> 48) & 0xff;
p[2] = (value >> 40) & 0xff;
p[3] = (value >> 32) & 0xff;
p[4] = (value >> 24) & 0xff;
p[5] = (value >> 16) & 0xff;
p[6] = (value >> 8) & 0xff;
p[7] = (value >> 0) & 0xff;
}

#endif /* COMPAT_BSWAP_H */
3 changes: 2 additions & 1 deletion pack.h
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ struct repository;
*/
#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) pack_version_ok_native(ntohl(v))
#define pack_version_ok_native(v) ((v) == 2 || (v) == 3)
struct pack_header {
uint32_t hdr_signature;
uint32_t hdr_version;
20 changes: 20 additions & 0 deletions packfile.c
Original file line number Diff line number Diff line change
@@ -2315,3 +2315,23 @@ int is_promisor_object(struct repository *r, const struct object_id *oid)
}
return oidset_contains(&promisor_objects, oid);
}

int parse_pack_header_option(const char *in, unsigned char *out, unsigned int *len)
{
unsigned char *hdr;
char *c;

hdr = out;
put_be32(hdr, PACK_SIGNATURE);
hdr += 4;
put_be32(hdr, strtoul(in, &c, 10));
hdr += 4;
if (*c != ',')
return -1;
put_be32(hdr, strtoul(c + 1, &c, 10));
hdr += 4;
if (*c)
return -1;
*len = hdr - out;
return 0;
}
6 changes: 6 additions & 0 deletions packfile.h
Original file line number Diff line number Diff line change
@@ -216,4 +216,10 @@ int is_promisor_object(struct repository *r, const struct object_id *oid);
int load_idx(const char *path, const unsigned int hashsz, void *idx_map,
size_t idx_size, struct packed_git *p);

/*
* Parse a --pack_header option as accepted by index-pack and unpack-objects,
* turning it into the matching bytes we'd find in a pack.
*/
int parse_pack_header_option(const char *in, unsigned char *out, unsigned int *len);

#endif