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

[DRAFT] for testing : Fix 4Gb limit for large files on Git for Windows #2179

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
12 changes: 6 additions & 6 deletions builtin/index-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static void *unpack_raw_entry(struct object_entry *obj,
unsigned char *p;
size_t size, c;
off_t base_offset;
unsigned shift;
size_t shift;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done, but let's not state that this is for Windows. This is a data type cleanup that benefits 64-bit systems where long is 32 bit wide.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

void *data;

obj->idx.offset = consumed_bytes;
Expand Down Expand Up @@ -1598,10 +1598,10 @@ static void read_idx_option(struct pack_idx_option *opts, const char *pack_name)
static void show_pack_info(int stat_only)
{
int i, baseobjects = nr_objects - nr_ref_deltas - nr_ofs_deltas;
unsigned long *chain_histogram = NULL;
size_t *chain_histogram = NULL;

if (deepest_delta)
chain_histogram = xcalloc(deepest_delta, sizeof(unsigned long));
chain_histogram = xcalloc(deepest_delta, sizeof(size_t));

for (i = 0; i < nr_objects; i++) {
struct object_entry *obj = &objects[i];
Expand Down Expand Up @@ -1631,11 +1631,11 @@ static void show_pack_info(int stat_only)
for (i = 0; i < deepest_delta; i++) {
if (!chain_histogram[i])
continue;
printf_ln(Q_("chain length = %d: %lu object",
"chain length = %d: %lu objects",
printf_ln(Q_("chain length = %d: %"PRIuMAX" object",
"chain length = %d: %"PRIuMAX" objects",
chain_histogram[i]),
i + 1,
chain_histogram[i]);
(uintmax_t)chain_histogram[i]);
}
}

Expand Down
12 changes: 6 additions & 6 deletions csum-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "progress.h"
#include "csum-file.h"

static void flush(struct hashfile *f, const void *buf, unsigned int count)
static void flush(struct hashfile *f, const void *buf, size_t count)
{
if (0 <= f->check_fd && count) {
unsigned char check_buffer[8192];
Expand Down Expand Up @@ -44,7 +44,7 @@ static void flush(struct hashfile *f, const void *buf, unsigned int count)

void hashflush(struct hashfile *f)
{
unsigned offset = f->offset;
size_t offset = f->offset;

if (offset) {
the_hash_algo->update_fn(&f->ctx, f->buffer, offset);
Expand Down Expand Up @@ -86,12 +86,12 @@ int finalize_hashfile(struct hashfile *f, unsigned char *result, unsigned int fl
return fd;
}

void hashwrite(struct hashfile *f, const void *buf, unsigned int count)
void hashwrite(struct hashfile *f, const void *buf, size_t count)
{
while (count) {
unsigned offset = f->offset;
unsigned left = sizeof(f->buffer) - offset;
unsigned nr = count > left ? left : count;
size_t offset = f->offset;
size_t left = sizeof(f->buffer) - offset;
size_t nr = count > left ? left : count;
const void *data;

if (f->do_crc)
Expand Down
4 changes: 2 additions & 2 deletions csum-file.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct progress;
struct hashfile {
int fd;
int check_fd;
unsigned int offset;
size_t offset;
git_hash_ctx ctx;
off_t total;
struct progress *tp;
Expand Down Expand Up @@ -37,7 +37,7 @@ struct hashfile *hashfd(int fd, const char *name);
struct hashfile *hashfd_check(const char *name);
struct hashfile *hashfd_throughput(int fd, const char *name, struct progress *tp);
int finalize_hashfile(struct hashfile *, unsigned char *, unsigned int);
void hashwrite(struct hashfile *, const void *, unsigned int);
void hashwrite(struct hashfile *, const void *, size_t);
void hashflush(struct hashfile *f);
void crc32_begin(struct hashfile *);
uint32_t crc32_end(struct hashfile *);
Expand Down