Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8824975
git: avoid segfault on "git --shallow-file" without a value
chriscool Aug 11, 2026
dd6b35f
serve: reject valueless promisor-remote capability
newren Aug 12, 2026
14058ed
sequencer: remove unnecessary variable setting
newren Aug 12, 2026
5fb9b8b
t7900: adapt some tests to use a throwaway repository
pks-t Aug 12, 2026
2775d8b
t7900: fix flaky "maintenance.strategy" test
pks-t Aug 12, 2026
93aab89
http: die on curl_easy_duphandle failure in get_active_slot
dscho Aug 12, 2026
633ac34
config: propagate launch_editor() failure in show_editor()
dscho Aug 12, 2026
47568fe
reftable: handle block-writer initialization errors
dscho Aug 12, 2026
f8121b7
reftable/block: check deflateInit() return value
dscho Aug 12, 2026
e3ddc2e
reftable tests: check reftable_table_init_ref_iterator() return
dscho Aug 12, 2026
ec428c6
last-modified: handle repo_parse_commit() failures
dscho Aug 12, 2026
02b9662
compat/pread: check initial lseek for errors
dscho Aug 12, 2026
af62506
transport-helper: check dup() return in get_exporter
dscho Aug 12, 2026
78ef560
transport-helper: warn when export-marks file cannot be finalized
dscho Aug 12, 2026
2f93092
bisect: check strbuf_getline_lf return when reading terms
dscho Aug 12, 2026
211ba0c
bisect: check get_terms return at all call sites
dscho Aug 12, 2026
5f87f65
bisect: handle dup() failure when redirecting stdout
dscho Aug 12, 2026
073d4d6
diff-delta: widen `struct delta_index`' size fields to `size_t`
dscho Aug 13, 2026
92b77c4
delta: widen `create_delta_index()` parameter to `size_t`
dscho Aug 13, 2026
cfd8970
pack-objects: widen delta-cache accounting to `size_t`
dscho Aug 13, 2026
e0af3c8
pack-objects: widen `free_unpacked()` return to `size_t`
dscho Aug 13, 2026
58f35ee
pack-objects: widen `mem_usage` and `try_delta()`'s out-param to `siz…
dscho Aug 13, 2026
9efb6d5
delta: widen `create_delta()` and `diff_delta()` to `size_t`
dscho Aug 13, 2026
4211a2b
packfile, git-zlib: widen `use_pack()` and zstream avail fields to `s…
dscho Aug 13, 2026
335f996
archive-zip: widen `zlib_deflate_raw()`'s maxsize local to `size_t`
dscho Aug 13, 2026
1f324b9
diff: widen `deflate_it()`'s bound local from int to `size_t`
dscho Aug 13, 2026
9cb9f41
http-push: widen `start_put()`'s size local from `ssize_t` to `size_t`
dscho Aug 13, 2026
aed4048
t/helper/test-pack-deltas: widen `do_compress()`'s maxsize local to `…
dscho Aug 13, 2026
b4b9a8c
git-zlib: widen `git_deflate_bound()` to `size_t`
dscho Aug 13, 2026
d50ac11
packfile: widen `unpack_object_header_buffer()` to `size_t`
dscho Aug 13, 2026
764243b
diff: avoid misleading statement about -l option
newren Aug 14, 2026
fcc8c93
Merge branch 'js/coverity-unchecked-returns-fix'
gitster Aug 24, 2026
15b23b5
Merge branch 'en/sequencer-lose-pretty-given'
gitster Aug 24, 2026
32f49ed
Merge branch 'cc/git-shallow-file-wo-value'
gitster Aug 24, 2026
781fd4e
Merge branch 'js/pack-objects-delta-size-t'
gitster Aug 24, 2026
bc4c566
Merge branch 'en/serve-promisor-remote-fix'
gitster Aug 24, 2026
18ce227
Merge branch 'ps/t7900-deflake-maintenance'
gitster Aug 24, 2026
66573db
Merge branch 'en/diff-l-opt-help'
gitster Aug 24, 2026
2c3adbb
The 18th batch
gitster Aug 24, 2026
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
31 changes: 31 additions & 0 deletions Documentation/RelNotes/2.56.0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ UI, Workflows & Features
is now terminated with a newline so that Perl avoids appending its
internal source location data.

* The '--shallow-file' option of 'git' command requires a value, but the
code did not check the presence of a value and instead segfaulted
without one, which has been corrected.


Performance, Internal Implementation, Development Support etc.
--------------------------------------------------------------
Expand Down Expand Up @@ -407,6 +411,14 @@ Performance, Internal Implementation, Development Support etc.
early when one side's exclusive commits in the queue are exhausted,
yielding significant speedups for queries with one-sided histories.
* A handful of code paths have been corrected to check return values
from functions like curl_easy_duphandle(), deflateInit(), lseek(),
dup(), and strbuf_getline_lf(), resolving several Coverity warnings
about unchecked returns.
* The setting of a now-unused member '.pretty_given' in the sequencer
machinery has been removed.
Fixes since v2.55
-----------------
Expand Down Expand Up @@ -638,3 +650,22 @@ Fixes since v2.55
replace outdated terminology, define key terms upfront, and document
how comment lines in the input are treated.
(merge 4515c86fd9 kh/doc-trailers later to maint).

* The 'pack-objects' and delta-encoding code paths have been updated to
use 'size_t' instead of 'unsigned long' for object sizes and offset
limits, avoiding potential truncation issues on 64-bit Windows.
(merge d50ac11724 js/pack-objects-delta-size-t later to maint).

* A client requesting the promisor-remote capability without a value
caused a null pointer dereference, which has been corrected by
rejecting a request without an argument.
(merge dd6b35ff71 en/serve-promisor-remote-fix later to maint).

* Various tests in 't7900-maintenance.sh' have been updated to use a
throwaway repository, and auto-detaching of maintenance tasks is now
disabled for these tests to fix flaky races with concurrent background
maintenance jobs.
(merge 2775d8bcd1 ps/t7900-deflake-maintenance later to maint).

* The help text for the '-l' option of 'git diff' has been updated.
(merge 764243bdf4 en/diff-l-opt-help later to maint).
2 changes: 1 addition & 1 deletion archive-zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static void *zlib_deflate_raw(void *data, unsigned long size,
unsigned long *compressed_size)
{
git_zstream stream;
unsigned long maxsize;
size_t maxsize;
void *buffer;
int result;

Expand Down
6 changes: 4 additions & 2 deletions bisect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,10 +1020,12 @@ void read_bisect_terms(char **read_bad, char **read_good)
die_errno(_("could not read file '%s'"), filename);
}
} else {
strbuf_getline_lf(&str, fp);
if (strbuf_getline_lf(&str, fp) == EOF)
die(_("could not read bad term from file '%s'"), filename);
free(*read_bad);
*read_bad = strbuf_detach(&str, NULL);
strbuf_getline_lf(&str, fp);
if (strbuf_getline_lf(&str, fp) == EOF)
die(_("could not read good term from file '%s'"), filename);
free(*read_good);
*read_good = strbuf_detach(&str, NULL);
}
Expand Down
44 changes: 32 additions & 12 deletions builtin/bisect.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,22 +566,29 @@ static int bisect_next_check(const struct bisect_terms *terms,
return decide_next(terms, current_term, !state.nr_good, !state.nr_bad);
}

static int get_terms(struct bisect_terms *terms)
static int get_terms(struct bisect_terms *terms, int file_missing_is_ok)
{
struct strbuf str = STRBUF_INIT;
FILE *fp = NULL;
int res = 0;

fp = fopen(git_path_bisect_terms(), "r");
if (!fp) {
res = -1;
res = file_missing_is_ok ? 0 : -1;
goto finish;
}

free_terms(terms);
strbuf_getline_lf(&str, fp);
if (strbuf_getline_lf(&str, fp) == EOF) {
res = -1;
goto finish;
}
terms->term_bad = strbuf_detach(&str, NULL);
strbuf_getline_lf(&str, fp);
if (strbuf_getline_lf(&str, fp) == EOF) {
res = -1;
FREE_AND_NULL(terms->term_bad);
goto finish;
}
terms->term_good = strbuf_detach(&str, NULL);

finish:
Expand All @@ -593,7 +600,7 @@ static int get_terms(struct bisect_terms *terms)

static int bisect_terms(struct bisect_terms *terms, const char *option)
{
if (get_terms(terms))
if (get_terms(terms, 0))
return error(_("no terms defined"));

if (!option) {
Expand Down Expand Up @@ -1157,7 +1164,8 @@ static int process_replay_line(struct bisect_terms *terms, struct strbuf *line)
rev = word_end + strspn(word_end, " \t");
*word_end = '\0'; /* NUL-terminate the word */

get_terms(terms);
if (get_terms(terms, 1))
return error(_("no terms defined"));
if (check_and_set_terms(terms, p))
return -1;

Expand Down Expand Up @@ -1430,7 +1438,14 @@ static int bisect_run(struct bisect_terms *terms, int argc, const char **argv)

fflush(stdout);
saved_stdout = dup(1);
dup2(temporary_stdout_fd, 1);
if (saved_stdout < 0 ||
dup2(temporary_stdout_fd, 1) < 0) {
res = error_errno(_("could not duplicate stdout"));
if (saved_stdout >= 0)
close(saved_stdout);
close(temporary_stdout_fd);
break;
}

res = bisect_state(terms, 1, &new_state);

Expand Down Expand Up @@ -1510,7 +1525,8 @@ static int cmd_bisect__next(int argc, const char **argv UNUSED, const char *pref
if (argc)
return error(_("'%s' requires 0 arguments"),
"git bisect next");
get_terms(&terms);
if (get_terms(&terms, 1))
return error(_("no terms defined"));
res = bisect_next(&terms, prefix);
free_terms(&terms);
return res;
Expand Down Expand Up @@ -1544,7 +1560,8 @@ static int cmd_bisect__skip(int argc, const char **argv, const char *prefix UNUS
struct bisect_terms terms = { 0 };

set_terms(&terms, "bad", "good");
get_terms(&terms);
if (get_terms(&terms, 1))
return error(_("no terms defined"));
res = bisect_skip(&terms, argc, argv);
free_terms(&terms);
return res;
Expand All @@ -1556,7 +1573,8 @@ static int cmd_bisect__visualize(int argc, const char **argv, const char *prefix
int res;
struct bisect_terms terms = { 0 };

get_terms(&terms);
if (get_terms(&terms, 1))
return error(_("no terms defined"));
res = bisect_visualize(&terms, argc, argv);
free_terms(&terms);
return res;
Expand All @@ -1570,7 +1588,8 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE

if (!argc)
return error(_("'%s' failed: no command provided."), "git bisect run");
get_terms(&terms);
if (get_terms(&terms, 1))
return error(_("no terms defined"));
res = bisect_run(&terms, argc, argv);
free_terms(&terms);
return res;
Expand Down Expand Up @@ -1609,7 +1628,8 @@ int cmd_bisect(int argc,
usage_with_options(git_bisect_usage, options);

set_terms(&terms, "bad", "good");
get_terms(&terms);
if (get_terms(&terms, 1))
return error(_("no terms defined"));
if (check_and_set_terms(&terms, argv[0]) ||
!one_of(argv[0], terms.term_good, terms.term_bad, NULL))
usage_msg_optf(_("unknown command: '%s'"), git_bisect_usage,
Expand Down
5 changes: 4 additions & 1 deletion builtin/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,10 @@ static int show_editor(struct config_location_options *opts)
else if (errno != EEXIST)
die_errno(_("cannot create configuration file %s"), config_file);
}
launch_editor(config_file, NULL, NULL);
if (launch_editor(config_file, NULL, NULL)) {
free(config_file);
return -1;
}
free(config_file);

return 0;
Expand Down
6 changes: 4 additions & 2 deletions builtin/fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ static int store_object(
struct object_entry *e;
unsigned char hdr[96];
struct object_id oid;
unsigned long hdrlen, deltalen;
unsigned long hdrlen, deltalen = 0;
struct git_hash_ctx c;
git_zstream s;
struct repo_config_values *cfg = repo_config_values(the_repository);
Expand Down Expand Up @@ -1016,11 +1016,13 @@ static int store_object(

if (last && last->data.len && last->data.buf && last->depth < max_depth
&& dat->len > the_hash_algo->rawsz) {
size_t deltalen_st;

delta_count_attempts_by_type[type]++;
delta = diff_delta(last->data.buf, last->data.len,
dat->buf, dat->len,
&deltalen, dat->len - the_hash_algo->rawsz);
&deltalen_st, dat->len - the_hash_algo->rawsz);
deltalen = cast_size_t_to_ulong(deltalen_st);
} else
delta = NULL;

Expand Down
9 changes: 6 additions & 3 deletions builtin/last-modified.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ static void process_parent(struct last_modified *lm,
{
struct bitmap *active_p;

repo_parse_commit(lm->rev.repo, parent);
if (repo_parse_commit(lm->rev.repo, parent))
return;
active_p = active_paths_for(lm, parent);

/*
Expand Down Expand Up @@ -414,12 +415,14 @@ static int last_modified_run(struct last_modified *lm)
* Otherwise, make sure that 'c' isn't reachable from anything
* in the '--not' queue.
*/
repo_parse_commit(lm->rev.repo, c);
if (repo_parse_commit(lm->rev.repo, c))
goto cleanup;

while ((n = prio_queue_get(&not_queue))) {
struct commit_list *np;

repo_parse_commit(lm->rev.repo, n);
if (repo_parse_commit(lm->rev.repo, n))
continue;

for (np = n->parents; np; np = np->next) {
if (!(np->item->object.flags & PARENT2)) {
Expand Down
32 changes: 16 additions & 16 deletions builtin/pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ static int exclude_promisor_objects_best_effort;

static int use_delta_islands;

static unsigned long delta_cache_size = 0;
static unsigned long max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE;
static size_t delta_cache_size = 0;
static size_t max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE;
static unsigned long cache_max_small_delta_size = 1000;

static unsigned long window_memory_limit = 0;
Expand Down Expand Up @@ -354,7 +354,8 @@ static void index_commit_for_bitmap(struct commit *commit)

static void *get_delta(struct object_entry *entry)
{
unsigned long size, base_size, delta_size;
unsigned long size, base_size;
size_t delta_size;
void *buf, *base_buf, *delta_buf;
enum object_type type;
size_t size_st = 0, base_size_st = 0;
Expand Down Expand Up @@ -488,7 +489,7 @@ static void copy_pack_data(struct hashfile *f,
off_t len)
{
unsigned char *in;
unsigned long avail;
size_t avail;

while (len) {
in = use_pack(p, w_curs, offset, &avail);
Expand Down Expand Up @@ -2259,8 +2260,7 @@ static void check_object(struct object_entry *entry, uint32_t object_index)
int have_base = 0;
struct object_id base_ref;
struct object_entry *base_entry;
unsigned long used, used_0;
unsigned long avail;
size_t used, used_0, avail;
off_t ofs;
unsigned char *buf, c;
enum object_type type;
Expand Down Expand Up @@ -2688,8 +2688,8 @@ struct unpacked {
unsigned depth;
};

static int delta_cacheable(unsigned long src_size, unsigned long trg_size,
unsigned long delta_size)
static int delta_cacheable(size_t src_size, size_t trg_size,
size_t delta_size)
{
if (max_delta_cache_size && delta_cache_size + delta_size > max_delta_cache_size)
return 0;
Expand Down Expand Up @@ -2772,8 +2772,7 @@ size_t oe_get_size_slow(struct packing_data *pack,
struct pack_window *w_curs;
unsigned char *buf;
enum object_type type;
unsigned long used, avail;
size_t size;
size_t used, avail, size;

if (e->type_ != OBJ_OFS_DELTA && e->type_ != OBJ_REF_DELTA) {
size_t sz;
Expand Down Expand Up @@ -2804,11 +2803,12 @@ size_t oe_get_size_slow(struct packing_data *pack,
}

static int try_delta(struct unpacked *trg, struct unpacked *src,
unsigned max_depth, unsigned long *mem_usage)
unsigned max_depth, size_t *mem_usage)
{
struct object_entry *trg_entry = trg->entry;
struct object_entry *src_entry = src->entry;
unsigned long trg_size, src_size, delta_size, sizediff, max_size, sz;
unsigned long trg_size, src_size, sizediff, max_size, sz;
size_t delta_size;
unsigned ref_depth;
enum object_type type;
void *delta_buf;
Expand Down Expand Up @@ -2972,9 +2972,9 @@ static unsigned int check_delta_limit(struct object_entry *me, unsigned int n)
return m;
}

static unsigned long free_unpacked(struct unpacked *n)
static size_t free_unpacked(struct unpacked *n)
{
unsigned long freed_mem = sizeof_delta_index(n->index);
size_t freed_mem = sizeof_delta_index(n->index);
free_delta_index(n->index);
n->index = NULL;
if (n->data) {
Expand All @@ -2991,7 +2991,7 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
{
uint32_t i, idx = 0, count = 0;
struct unpacked *array;
unsigned long mem_usage = 0;
size_t mem_usage = 0;

CALLOC_ARRAY(array, window);

Expand Down Expand Up @@ -3701,7 +3701,7 @@ static int git_pack_config(const char *k, const char *v,
return 0;
}
if (!strcmp(k, "pack.deltacachesize")) {
max_delta_cache_size = git_config_int(k, v, ctx->kvi);
max_delta_cache_size = git_config_size_t(k, v, ctx->kvi);
return 0;
}
if (!strcmp(k, "pack.deltacachelimit")) {
Expand Down
2 changes: 2 additions & 0 deletions compat/pread.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ssize_t git_pread(int fd, void *buf, size_t count, off_t offset)
ssize_t rc;

current_offset = lseek(fd, 0, SEEK_CUR);
if (current_offset < 0)
return -1;

if (lseek(fd, offset, SEEK_SET) < 0)
return -1;
Expand Down
9 changes: 9 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,15 @@ ssize_t git_config_ssize_t(const char *name, const char *value,
return ret;
}

size_t git_config_size_t(const char *name, const char *value,
const struct key_value_info *kvi)
{
size_t ret;
if (!git_parse_size_t(value, &ret))
die_bad_number(name, value, kvi);
return ret;
}

double git_config_double(const char *name, const char *value,
const struct key_value_info *kvi)
{
Expand Down
3 changes: 3 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ unsigned long git_config_ulong(const char *, const char *,
ssize_t git_config_ssize_t(const char *, const char *,
const struct key_value_info *);

size_t git_config_size_t(const char *, const char *,
const struct key_value_info *);

/**
* Identically to `git_config_double`, but for double-precision floating point
* values.
Expand Down
Loading