Skip to content

Commit 0891c66

Browse files
authored
Merge branch 'git:master' into master
2 parents 685fe18 + 2c78326 commit 0891c66

34 files changed

Lines changed: 1481 additions & 624 deletions

‎.github/workflows/main.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,8 @@ jobs:
460460
if: needs.ci-config.outputs.enabled == 'yes'
461461
env:
462462
jobname: StaticAnalysis
463-
CI_JOB_IMAGE: ubuntu-22.04
464-
runs-on: ubuntu-22.04
463+
CI_JOB_IMAGE: ubuntu-latest
464+
runs-on: ubuntu-latest
465465
concurrency:
466466
group: static-analysis-${{ github.ref }}
467467
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}

‎.gitlab-ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ test:fuzz-smoke-tests:
227227
- ./ci/run-build-and-minimal-fuzzers.sh
228228

229229
static-analysis:
230-
image: ubuntu:22.04
230+
image: ubuntu:latest
231231
stage: analyze
232232
needs: [ ]
233233
variables:

‎.mailmap‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ Chris Shoemaker <c.shoemaker@cox.net>
3939
Chris Wright <chrisw@sous-sol.org> <chrisw@osdl.org>
4040
Christian Ludwig <chrissicool@gmail.com> <chrissicool@googlemail.com>
4141
Cord Seele <cowose@gmail.com> <cowose@googlemail.com>
42-
Christian Couder <chriscool@tuxfamily.org> <christian.couder@gmail.com>
42+
Christian Couder <christian.couder@gmail.com> <chriscool@tuxfamily.org>
4343
Christian Stimming <stimming@tuhh.de> <chs@ckiste.goetheallee>
4444
Christopher Díaz Riveros <chrisadr@gentoo.org> Christopher Diaz Riveros
4545
Clemens Buchacher <drizzd@gmx.net> <drizzd@aon.at>
4646
Clemens Buchacher <drizzd@gmx.net> <clemens.buchacher@intel.com>
4747
Csaba Henk <csaba@gluster.com> <csaba@lowlife.hu>
48+
D. Ben Knoble <ben.knoble@gmail.com> <ben.knoble+github@gmail.com>
4849
Dan Johnson <computerdruid@gmail.com>
4950
Dana L. How <danahow@gmail.com> <how@deathvalley.cswitch.com>
5051
Dana L. How <danahow@gmail.com> Dana How

‎Documentation/RelNotes/2.56.0.adoc‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ UI, Workflows & Features
7676
filtered on the client based on server-advertised capabilities,
7777
returning empty strings for inapplicable or unsupported fields.
7878

79+
* 'git branch -d' has been taught to report when a branch cannot be
80+
deleted because it is being used in an active bisect run.
81+
7982

8083
Performance, Internal Implementation, Development Support etc.
8184
--------------------------------------------------------------
@@ -280,6 +283,21 @@ Performance, Internal Implementation, Development Support etc.
280283
first refactoring force_object_loose() to use generic ODB write
281284
interfaces instead of loose-backend internals.
282285
286+
* Object database housekeeping in 'git gc' and 'git maintenance' has
287+
been refactored to be pluggable. The files-backend-specific logic,
288+
including incremental and geometric repacking as well as object
289+
pruning, has been moved out of the command implementation and into the
290+
files object database source, enabling future alternative object
291+
database backends to implement their own housekeeping services.
292+
293+
* The image version used by the static-analysis CI job has been bumped
294+
to ubuntu-latest (Ubuntu 24.04), which brings in a newer Coccinelle
295+
version that resolves a severe performance regression. A false
296+
positive warning from the 'CHECK_ASSERTION_SIDE_EFFECTS' build with
297+
GCC 15 in the Bloom filter code has also been silenced to facilitate
298+
the image upgrade.
299+
(merge 1a1579c42d jk/ci-static-analysis-image-bump later to maint).
300+
283301
284302
Fixes since v2.55
285303
-----------------
@@ -445,3 +463,47 @@ Fixes since v2.55
445463
'gitweb' has been corrected to work even when the index line carries
446464
a trailing file mode.
447465
(merge fda513d6fe tl/gitweb-shorten-hashes-with-modes later to maint).
466+
467+
* When the push remote is specified as a URL, the fetch refspec of a
468+
uniquely matching configured remote is now used to find and update
469+
the remote-tracking branch (e.g., '@{push}').
470+
471+
* Traversals with '--exclude-first-parent-only' have been corrected
472+
to properly stop after the first parent even when it has already
473+
been marked as 'SEEN'.
474+
(merge 47382f7398 jc/exclude-first-parent-seen later to maint).
475+
476+
* A segfault when 'git clone --revision' talks to a server that does not
477+
support protocol v2 (falling back to protocol v0) has been corrected.
478+
(merge 1034ad383f af/clone-revision-v0-segfault-fix later to maint).
479+
480+
* rewrites_release() in 'remote.c' has been updated to free 'struct
481+
rewrite' instances, their '.instead_of' arrays, and their contents.
482+
(merge dcef3bf041 jc/remote-insteadof-leakfix later to maint).
483+
484+
* The remote-matching logic for submodules has been corrected to resolve
485+
'url.*.insteadOf' aliases before comparing the inventoried URL from
486+
'.gitmodules' with the URLs of configured remotes.
487+
488+
* 'git diff --relative' running with '--cached' has been corrected to
489+
avoid a segfault when encountering unmerged paths outside the
490+
prefix.
491+
(merge 447126ed7d jk/diff-relative-cached-unmerged later to maint).
492+
493+
* Two bugs in how 'git rebase' handles skipped 'fixup' and 'squash'
494+
commands have been fixed. One bug caused an incorrect commit count to
495+
be shown in the template message when multiple commands were skipped,
496+
and another prevented the editor from opening when the final command
497+
in a chain containing 'fixup -c' was skipped.
498+
499+
* The alias tests in 't/t0014-alias.sh' have been updated to dynamically
500+
query the list of deprecated commands using 'git
501+
--list-cmds=deprecated' to avoid test failures when running with
502+
'WITH_BREAKING_CHANGES' in a build directory that contains stale
503+
executables of formerly deprecated commands.
504+
(merge bc57ecb915 jk/t0014-dynamic-deprecated-cmds later to maint).
505+
506+
* Git for Windows has been updated to avoid auto-detecting the symlink
507+
type if the target path starts with a slash, preventing NTLM
508+
credential leaks when checking out repositories with crafted
509+
symbolic links pointing to network shares.

‎Documentation/config/branch.adoc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ This option defaults to `never`.
5555
repository), you would want to set `remote.pushDefault` to
5656
specify the remote to push to for all branches, and use this
5757
option to override it for a specific branch.
58+
The value may be the name of a configured remote or a repository URL.
5859
5960
`branch.<name>.merge`::
6061
Defines, together with `branch.<name>.remote`, the upstream branch

‎Documentation/revisions.adoc‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ some output processing may assume ref names in UTF-8.
127127
`git push` were run while `branchname` was checked out (or the current
128128
`HEAD` if no branchname is specified). Like for '@\{upstream\}', we report
129129
the remote-tracking branch that corresponds to that branch at the remote.
130+
If the push destination is a URL and exactly one configured remote uses
131+
that URL for pushing, '@\{push}' reports that remote's remote-tracking
132+
branch.
130133
+
131134
Here's an example to make it more clear:
132135
+

‎bloom.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,10 @@ int bloom_filter_contains_vec(const struct bloom_filter *filter,
610610
uint32_t test_bloom_murmur3_seeded(uint32_t seed, const char *data, size_t len,
611611
int version)
612612
{
613-
assert(version == 1 || version == 2);
614-
615613
if (version == 2)
616614
return murmur3_seeded_v2(seed, data, len);
617-
else
615+
else if (version == 1)
618616
return murmur3_seeded_v1(seed, data, len);
617+
else
618+
BUG("unexpected bloom version: %d", version);
619619
}

‎branch.c‎

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,39 @@ int validate_branchname(const char *name, struct strbuf *ref)
385385
static int initialized_checked_out_branches;
386386
static struct strmap current_checked_out_branches = STRMAP_INIT;
387387

388+
enum branch_checkout_kind {
389+
BRANCH_CHECKOUT_KIND_CHECKOUT,
390+
BRANCH_CHECKOUT_KIND_REBASE,
391+
BRANCH_CHECKOUT_KIND_BISECT,
392+
BRANCH_CHECKOUT_KIND_UPDATE_REF,
393+
};
394+
395+
struct checked_out_branch {
396+
char *refname;
397+
char *path;
398+
enum branch_checkout_kind kind;
399+
};
400+
401+
static struct checked_out_branch *checked_out_branches;
402+
static size_t checked_out_branches_alloc, checked_out_branches_nr;
403+
404+
static void register_checked_out_branch(const char *prefix, const char *name,
405+
const char *path,
406+
enum branch_checkout_kind kind)
407+
{
408+
char *refname = xstrfmt("%s%s", prefix, name);
409+
char *path_copy = xstrdup(path);
410+
411+
ALLOC_GROW(checked_out_branches, checked_out_branches_nr + 1,
412+
checked_out_branches_alloc);
413+
checked_out_branches[checked_out_branches_nr].refname = refname;
414+
checked_out_branches[checked_out_branches_nr].path = path_copy;
415+
checked_out_branches[checked_out_branches_nr].kind = kind;
416+
checked_out_branches_nr++;
417+
418+
strmap_put(&current_checked_out_branches, refname, path_copy);
419+
}
420+
388421
static void prepare_checked_out_branches(void)
389422
{
390423
int i = 0;
@@ -397,7 +430,7 @@ static void prepare_checked_out_branches(void)
397430
worktrees = get_worktrees(the_repository);
398431

399432
while (worktrees[i]) {
400-
char *old, *wt_gitdir;
433+
char *wt_gitdir;
401434
struct wt_status_state state = { 0 };
402435
struct worktree *wt = worktrees[i++];
403436
struct string_list update_refs = STRING_LIST_INIT_DUP;
@@ -406,34 +439,25 @@ static void prepare_checked_out_branches(void)
406439
continue;
407440

408441
if (wt->head_ref) {
409-
old = strmap_put(&current_checked_out_branches,
410-
wt->head_ref,
411-
xstrdup(wt->path));
412-
free(old);
442+
register_checked_out_branch("", wt->head_ref, wt->path,
443+
BRANCH_CHECKOUT_KIND_CHECKOUT);
413444
}
414445

415446
if (wt_status_check_rebase(wt, &state) &&
416447
(state.rebase_in_progress || state.rebase_interactive_in_progress) &&
417448
state.branch) {
418-
struct strbuf ref = STRBUF_INIT;
419-
strbuf_addf(&ref, "refs/heads/%s", state.branch);
420-
old = strmap_put(&current_checked_out_branches,
421-
ref.buf,
422-
xstrdup(wt->path));
423-
free(old);
424-
strbuf_release(&ref);
449+
register_checked_out_branch("refs/heads/", state.branch,
450+
wt->path,
451+
BRANCH_CHECKOUT_KIND_REBASE);
425452
}
426453
wt_status_state_free_buffers(&state);
427454

428455
if (wt_status_check_bisect(wt, &state) &&
429456
state.bisecting_from) {
430-
struct strbuf ref = STRBUF_INIT;
431-
strbuf_addf(&ref, "refs/heads/%s", state.bisecting_from);
432-
old = strmap_put(&current_checked_out_branches,
433-
ref.buf,
434-
xstrdup(wt->path));
435-
free(old);
436-
strbuf_release(&ref);
457+
register_checked_out_branch("refs/heads/",
458+
state.bisecting_from,
459+
wt->path,
460+
BRANCH_CHECKOUT_KIND_BISECT);
437461
}
438462
wt_status_state_free_buffers(&state);
439463

@@ -442,10 +466,9 @@ static void prepare_checked_out_branches(void)
442466
&update_refs)) {
443467
struct string_list_item *item;
444468
for_each_string_list_item(item, &update_refs) {
445-
old = strmap_put(&current_checked_out_branches,
446-
item->string,
447-
xstrdup(wt->path));
448-
free(old);
469+
register_checked_out_branch("", item->string,
470+
wt->path,
471+
BRANCH_CHECKOUT_KIND_UPDATE_REF);
449472
}
450473
string_list_clear(&update_refs, 1);
451474
}
@@ -462,6 +485,17 @@ const char *branch_checked_out(const char *refname)
462485
return strmap_get(&current_checked_out_branches, refname);
463486
}
464487

488+
const char *branch_bisecting(const char *refname)
489+
{
490+
prepare_checked_out_branches();
491+
for (size_t i = 0; i < checked_out_branches_nr; i++) {
492+
if (!strcmp(refname, checked_out_branches[i].refname) &&
493+
checked_out_branches[i].kind == BRANCH_CHECKOUT_KIND_BISECT)
494+
return checked_out_branches[i].path;
495+
}
496+
return NULL;
497+
}
498+
465499
/*
466500
* Check if a branch 'name' can be created as a new branch; die otherwise.
467501
* 'force' can be used when it is OK for the named branch already exists.

‎branch.h‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ void create_branches_recursively(struct repository *r, const char *name,
106106
*/
107107
const char *branch_checked_out(const char *refname);
108108

109+
/*
110+
* If the branch at 'refname' is currently used for bisecting in a
111+
* worktree, then return the path to that worktree.
112+
*/
113+
const char *branch_bisecting(const char *refname);
114+
109115
/*
110116
* Check if 'name' can be a valid name for a branch; die otherwise.
111117
* Return 1 if the named branch already exists; return 0 otherwise.

‎builtin/branch.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
266266

267267
if (kinds == FILTER_REFS_BRANCHES) {
268268
const char *path;
269+
if ((path = branch_bisecting(name))) {
270+
error(_("cannot delete branch '%s' "
271+
"used by worktree at '%s' for bisect"),
272+
bname.buf, path);
273+
ret = 1;
274+
continue;
275+
}
269276
if ((path = branch_checked_out(name))) {
270277
error(_("cannot delete branch '%s' "
271278
"used by worktree at '%s'"),

0 commit comments

Comments
 (0)