Article View: linux.kernel.git
Article #4199Re: [PATCH v5 0/5] worktree: treat a branch being rebased or bisected as checked out
From: Phillip Wood
Date: Tue, 01 Dec 2026 15:00
Date: Tue, 01 Dec 2026 15:00
550 lines
37380 bytes
37380 bytes
Hi Jasper
On 11/11/2026 15:28, Jasper Mayone wrote:
>
> Changes since v4 [1]:
>
> * Patch 1: each item in the list of cases that need --force is now a
> complete sentence, and all the commands are in the same font, as
> Phillip asked. Ben was happy with the old wording, and I hope this
> suits both of you.
>
> * Patch 2: no change.
>
> * Patch 3: branch.c records the branches in a map, so
> branch_checked_out_worktree() is one map lookup in place of a loop
> over every worktree for each ref.
These three patches look fine to me. Keeping these three and dropping
patches 4 & 5 makes sense.
Thanks for working on it
Phillip
> * Patch 4 is new. It adds %(currentworktree), which Phillip
> suggested. It uses a second map in branch.c for the branches that
> the current worktree has.
>
> * Patch 5 replaces v4's patch 4. The default "git branch" format now
> uses %(currentworktree), so print_ref_list() is unchanged and the
> patch is a few lines in build_format().
>
> [1] https://lore.kernel.org/git/20261102182930.3511-1-me@jaspermayone.com/
>
> Jasper Mayone (5):
> worktree remove: refuse a worktree in the middle of an operation
> doc: for-each-ref: say how to read %(worktreepath) safely
> ref-filter: name the worktree of a branch being rebased or bisected
> ref-filter: add %(currentworktree)
> branch: do not mark the branch the current worktree is rebasing
>
> Documentation/git-branch.adoc | 6 +-
> Documentation/git-for-each-ref.adoc | 19 +++++-
> Documentation/git-worktree.adoc | 17 +++--
> branch.c | 33 ++++++++--
> branch.h | 16 +++++
> builtin/branch.c | 10 ++-
> builtin/worktree.c | 37 ++++++++++-
> ref-filter.c | 84 ++++---------------------
> t/t2403-worktree-move.sh | 94 ++++++++++++++++++++++++++++
> t/t3203-branch-output.sh | 49 +++++++++++++++
> t/t6302-for-each-ref-filter.sh | 97 +++++++++++++++++++++++++++++
> 11 files changed, 373 insertions(+), 89 deletions(-)
>
> Range-diff against v4:
> 1: bca692b844 ! 1: 69668bf9b1 worktree remove: refuse a worktree in the middle of an operation
> @@ Documentation/git-worktree.adoc: the new working tree location.
> -with submodules can be removed with `--force`. The main worktree cannot be
> -removed.
> +Remove a worktree. The main worktree cannot be removed. Without
> -+`--force`, a worktree is not removed when:
> ++`--force`, a worktree is not removed in these cases:
> ++
> +--
> -+* it has untracked files or modifications in tracked files,
> -+* it has submodules, or
> -+* it is in the middle of a rebase, a `git am` session, a bisect, a
> -+ cherry-pick or a revert, because removing it loses the state of that
> -+ operation.
> ++* The worktree has untracked files or modifications in tracked files.
> ++* The worktree has submodules.
> ++* The worktree is in the middle of a `git rebase`, `git am`,
> ++ `git bisect`, `git cherry-pick` or `git revert`. Removing the
> ++ worktree would lose the state of that operation.
> +--
>
> `repair [<path>...]`::
> 2: 39eb92d441 = 2: 35035d30e2 doc: for-each-ref: say how to read %(worktreepath) safely
> 3: 990a19fd11 ! 3: 4484dfff22 ref-filter: name the worktree of a branch being rebased or bisected
> @@ Commit message
>
> branch.c already knows the answer, as prepare_checked_out_branches()
> records the branch that each worktree has checked out, is rebasing or
> - is bisecting. Add branch_checked_out_worktree() to look a branch up in
> - that list, and use it for %(worktreepath) in place of the map that
> - ref-filter.c builds from the HEAD of each worktree.
> + is bisecting. Record those branches in a map as well, add
> + branch_checked_out_worktree() to look a branch up in it, and use that
> + for %(worktreepath) in place of the map that ref-filter.c builds from
> + the HEAD of each worktree.
>
> The new function skips the branches that "rebase --update-refs" will
> update. branch_checked_out() includes them, so that they cannot be
> @@ Documentation/git-for-each-ref.adoc: but if used together the last option is sel
> use one of the quoting options such as `--shell`, or follow
>
> ## branch.c ##
> +@@ branch.c: int validate_branchname(const char *name, struct strbuf *ref)
> +
> + static int initialized_checked_out_branches;
> + static struct strmap current_checked_out_branches = STRMAP_INIT;
> ++/* Like current_checked_out_branches, without the "update-ref" branches. */
> ++static struct strmap checked_out_worktrees = STRMAP_INIT;
> +
> + enum branch_checkout_kind {
> + BRANCH_CHECKOUT_KIND_CHECKOUT,
> +@@ branch.c: static void register_checked_out_branch(const char *prefix, const char *name,
> + checked_out_branches_nr++;
> +
> + strmap_put(¤t_checked_out_branches, refname, path_copy);
> ++ if (kind != BRANCH_CHECKOUT_KIND_UPDATE_REF)
> ++ strmap_put(&checked_out_worktrees, refname, path_copy);
> + }
> +
> + static void prepare_checked_out_branches(void)
> @@ branch.c: const char *branch_checked_out(const char *refname)
> return strmap_get(¤t_checked_out_branches, refname);
> }
>
> +const char *branch_checked_out_worktree(const char *refname)
> +{
> -+ const char *path = NULL;
> -+
> + prepare_checked_out_branches();
> -+ for (size_t i = 0; i < checked_out_branches_nr; i++) {
> -+ if (checked_out_branches[i].kind != BRANCH_CHECKOUT_KIND_UPDATE_REF &&
> -+ !strcmp(refname, checked_out_branches[i].refname))
> -+ path = checked_out_branches[i].path;
> -+ }
> -+ return path;
> ++ return strmap_get(&checked_out_worktrees, refname);
> +}
> +
> const char *branch_bisecting(const char *refname)
> 4: 56e29c448f ! 4: 944ce70324 branch: do not mark the branch the current worktree is rebasing
> @@ Metadata
> Author: Jasper Mayone <me@jaspermayone.com>
>
> ## Commit message ##
> - branch: do not mark the branch the current worktree is rebasing
> + ref-filter: add %(currentworktree)
>
> - Since the previous commit, "git branch" marks a branch with "+" when a
> - worktree is rebasing or bisecting it. In that worktree itself, the
> - list already starts with "* (no branch, rebasing topic)", so the
> - "+ topic" line below it says the same thing twice.
> + %(worktreepath) names the worktree that has a branch checked out, or
> + is rebasing or bisecting it, but a format cannot tell if that worktree
> + is the current one. Comparing %(worktreepath) with a fixed path in
> + %(if:equals=...) does not work for every path, because a ")" ends the
> + atom.
>
> - The default format cannot tell that apart: %(worktreepath) gives the
> - same path either way, and comparing it with %(if:equals=...) is not
> - safe because a path, or a branch name, can contain the ")" that ends
> - the atom. So build a second format that has no "+" marker and no
> - "(path)" for -vv, and use it for each branch that
> - branch_checked_out_worktree() maps to the current worktree. A branch
> - that is checked out normally in the current worktree also gets that
> - format, but %(HEAD) still marks it with "*" and -vv already hides
> - its path, so its output does not change.
> + Add %(currentworktree), which gives the path of the current worktree
> + when that worktree has the branch, and an empty string otherwise.
> + branch.c records these branches when it reads the worktrees, in a
> + second map next to the one that %(worktreepath) uses, so the lookup is
> + one map lookup per ref.
>
> - To pick a format for each branch, print_ref_list() now formats the
> - branches itself in place of print_formatted_ref_array(), keeping
> - --omit-empty. A format given with --format is used for every branch,
> - as before.
> + The next commit uses it in "git branch".
>
> Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
> Signed-off-by: Jasper Mayone <me@jaspermayone.com>
>
> - ## builtin/branch.c ##
> -@@ builtin/branch.c: static const char *quote_literal_for_format(const char *s)
> - return buf.buf;
> - }
> + ## Documentation/git-for-each-ref.adoc ##
> +@@ Documentation/git-for-each-ref.adoc: but if used together the last option is selected.
> + the `NUL` after the path and then for the `LF` that ends each
> + record.
>
> --static char *build_format(struct ref_filter *filter, int maxwidth, const char *remote_prefix)
> -+/*
> -+ * With "show_worktree" unset, the format does not mark a branch that is
> -+ * checked out in a worktree, nor show the path of that worktree. It is
> -+ * used for a branch that the current worktree is rebasing or bisecting,
> -+ * because the "(no branch, ...)" line already names it.
> -+ */
> -+static char *build_format(struct ref_filter *filter, int maxwidth,
> -+ const char *remote_prefix, int show_worktree)
> - {
> - struct strbuf fmt = STRBUF_INIT;
> - struct strbuf local = STRBUF_INIT;
> - struct strbuf remote = STRBUF_INIT;
> -
> -- strbuf_addf(&local, "%%(if)%%(HEAD)%%(then)* %s%%(else)%%(if)%%(worktreepath)%%(then)+ %s%%(else) %s%%(end)%%(end)",
> -- branch_get_color(BRANCH_COLOR_CURRENT),
> -- branch_get_color(BRANCH_COLOR_WORKTREE),
> -- branch_get_color(BRANCH_COLOR_LOCAL));
> -+ if (show_worktree)
> -+ strbuf_addf(&local, "%%(if)%%(HEAD)%%(then)* %s%%(else)%%(if)%%(worktreepath)%%(then)+ %s%%(else) %s%%(end)%%(end)",
> -+ branch_get_color(BRANCH_COLOR_CURRENT),
> -+ branch_get_color(BRANCH_COLOR_WORKTREE),
> -+ branch_get_color(BRANCH_COLOR_LOCAL));
> -+ else
> -+ strbuf_addf(&local, "%%(if)%%(HEAD)%%(then)* %s%%(else) %s%%(end)",
> -+ branch_get_color(BRANCH_COLOR_CURRENT),
> -+ branch_get_color(BRANCH_COLOR_LOCAL));
> - strbuf_addf(&remote, " %s",
> - branch_get_color(BRANCH_COLOR_REMOTE));
> -
> -@@ builtin/branch.c: static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
> -
> - if (filter->verbose > 1)
> - {
> -- strbuf_addf(&local, "%%(if:notequals=*)%%(HEAD)%%(then)%%(if)%%(worktreepath)%%(then)(%s%%(worktreepath)%s) %%(end)%%(end)",
> -- branch_get_color(BRANCH_COLOR_WORKTREE), branch_get_color(BRANCH_COLOR_RESET));
> -+ if (show_worktree)
> -+ strbuf_addf(&local, "%%(if:notequals=*)%%(HEAD)%%(then)%%(if)%%(worktreepath)%%(then)(%s%%(worktreepath)%s) %%(end)%%(end)",
> -+ branch_get_color(BRANCH_COLOR_WORKTREE), branch_get_color(BRANCH_COLOR_RESET));
> - strbuf_addf(&local, "%%(if)%%(upstream)%%(then)[%s%%(upstream:short)%s%%(if)%%(upstream:track)"
> - "%%(then): %%(upstream:track,nobracket)%%(end)] %%(end)%%(contents:subject)",
> - branch_get_color(BRANCH_COLOR_UPSTREAM), branch_get_color(BRANCH_COLOR_RESET));
> -@@ builtin/branch.c: static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
> - return strbuf_detach(&fmt, NULL);
> - }
> -
> -+static char *current_worktree_path(void)
> -+{
> -+ struct worktree **worktrees = get_worktrees(the_repository);
> -+ char *path = NULL;
> ++`currentworktree`::
> ++ The absolute path to the current worktree, if the ref is checked
> ++ out there, in the same sense as for `worktreepath`. Empty string
> ++ otherwise, also when the ref is checked out only in other
> ++ worktrees. Use it with `%(if)` to treat the current worktree
> ++ differently from the others.
> +
> -+ for (size_t i = 0; worktrees[i]; i++) {
> -+ if (worktrees[i]->is_current) {
> -+ path = xstrdup(worktrees[i]->path);
> -+ break;
> -+ }
> -+ }
> -+ free_worktrees(worktrees);
> -+ return path;
> -+}
> -+
> -+/*
> -+ * Is "refname" checked out in the worktree at "here", or is that
> -+ * worktree rebasing or bisecting it?
> -+ */
> -+static int checked_out_here(const char *refname, const char *here)
> -+{
> -+ const char *path = branch_checked_out_worktree(refname);
> -+
> -+ return path && !strcmp(path, here);
> -+}
> -+
> - static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sorting,
> - struct ref_format *format, struct string_list *output)
> - {
> -@@ builtin/branch.c: static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
> - int maxwidth = 0;
> - const char *remote_prefix = "";
> - char *to_free = NULL;
> -+ struct ref_format here_format = REF_FORMAT_INIT;
> -+ char *here_to_free = NULL, *here = NULL;
> -+ struct strbuf out = STRBUF_INIT, err = STRBUF_INIT;
> -
> - /*
> - * If we are listing more than just remote branches,
> -@@ builtin/branch.c: static void print_ref_list(struct ref_filter *filter, struct ref_sorting *sortin
> - if (filter->verbose)
> - maxwidth = calc_maxwidth(&array, strlen(remote_prefix));
> -
> -- if (!format->format)
> -- format->format = to_free = build_format(filter, maxwidth, remote_prefix);
> -+ if (!format->format) {
> -+ format->format = to_free = build_format(filter, maxwidth,
> -+ remote_prefix, 1);
> -+ here = current_worktree_path();
> -+ here_format = *format;
> -+ here_format.format = here_to_free = build_format(filter, maxwidth,
> -+ remote_prefix, 0);
> -+ }
> - format->use_color = branch_use_color;
> -+ here_format.use_color = branch_use_color;
> -
> -- if (verify_ref_format(format))
> -+ if (verify_ref_format(format) ||
> -+ (here && verify_ref_format(&here_format)))
> - die(_("unable to parse format string"));
> -
> - filter_ahead_behind(the_repository, &array);
> - ref_array_sort(sorting, &array);
> -
> -- if (column_active(colopts)) {
> -- struct strbuf out = STRBUF_INIT, err = STRBUF_INIT;
> --
> -+ if (column_active(colopts))
> - assert(!filter->verbose && "--column and --verbose are incompatible");
> -
> -- for (i = 0; i < array.nr; i++) {
> -- strbuf_reset(&err);
> -- strbuf_reset(&out);
> -- if (format_ref_array_item(array.items[i], format, &out, &err))
> -- die("%s", err.buf);
> -+ for (i = 0; i < array.nr; i++) {
> -+ struct ref_array_item *item = array.items[i];
> -+ struct ref_format *f = format;
> -
> -+ if (here && checked_out_here(item->refname, here))
> -+ f = &here_format;
> -+
> -+ strbuf_reset(&err);
> -+ strbuf_reset(&out);
> -+ if (format_ref_array_item(item, f, &out, &err))
> -+ die("%s", err.buf);
> -+
> -+ if (column_active(colopts))
> - /* format to a string_list to let print_columns() do its job */
> - string_list_append(output, out.buf);
> -+ else if (out.len || !format->array_opts.omit_empty) {
> -+ fwrite(out.buf, 1, out.len, stdout);
> -+ putchar('\n');
> - }
> --
> -- strbuf_release(&err);
> -- strbuf_release(&out);
> -- } else {
> -- print_formatted_ref_array(&array, format);
> - }
> -
> -+ strbuf_release(&err);
> -+ strbuf_release(&out);
> - ref_array_clear(&array);
> - free(to_free);
> -+ free(here_to_free);
> -+ free(here);
> - }
> -
> - static void print_current_branch_name(void)
> + `ahead-behind:<commit-ish>`::
> + Two integers, separated by a space, demonstrating the number of
> + commits ahead and behind, respectively, when comparing the output
>
> - ## t/t3203-branch-output.sh ##
> -@@ t/t3203-branch-output.sh: test_expect_success 'branch being rebased in a worktree is marked' '
> + ## branch.c ##
> +@@ branch.c: static int initialized_checked_out_branches;
> + static struct strmap current_checked_out_branches = STRMAP_INIT;
> + /* Like current_checked_out_branches, without the "update-ref" branches. */
> + static struct strmap checked_out_worktrees = STRMAP_INIT;
> ++/* The subset of checked_out_worktrees that the current worktree has. */
> ++static struct strmap current_worktree_branches = STRMAP_INIT;
> +
> + enum branch_checkout_kind {
> + BRANCH_CHECKOUT_KIND_CHECKOUT,
> +@@ branch.c: static struct checked_out_branch *checked_out_branches;
> + static size_t checked_out_branches_alloc, checked_out_branches_nr;
> +
> + static void register_checked_out_branch(const char *prefix, const char *name,
> +- const char *path,
> ++ const struct worktree *wt,
> + enum branch_checkout_kind kind)
> + {
> + char *refname = xstrfmt("%s%s", prefix, name);
> +- char *path_copy = xstrdup(path);
> ++ char *path_copy = xstrdup(wt->path);
> +
> + ALLOC_GROW(checked_out_branches, checked_out_branches_nr + 1,
> + checked_out_branches_alloc);
> +@@ branch.c: static void register_checked_out_branch(const char *prefix, const char *name,
> + checked_out_branches_nr++;
> +
> + strmap_put(¤t_checked_out_branches, refname, path_copy);
> +- if (kind != BRANCH_CHECKOUT_KIND_UPDATE_REF)
> ++ if (kind != BRANCH_CHECKOUT_KIND_UPDATE_REF) {
> + strmap_put(&checked_out_worktrees, refname, path_copy);
> ++ if (wt->is_current)
> ++ strmap_put(¤t_worktree_branches, refname, path_copy);
> ++ }
> + }
> +
> + static void prepare_checked_out_branches(void)
> +@@ branch.c: static void prepare_checked_out_branches(void)
> + continue;
> +
> + if (wt->head_ref) {
> +- register_checked_out_branch("", wt->head_ref, wt->path,
> ++ register_checked_out_branch("", wt->head_ref, wt,
> + BRANCH_CHECKOUT_KIND_CHECKOUT);
> + }
> +
> +@@ branch.c: static void prepare_checked_out_branches(void)
> + (state.rebase_in_progress || state.rebase_interactive_in_progress) &&
> + state.branch) {
> + register_checked_out_branch("refs/heads/", state.branch,
> +- wt->path,
> ++ wt,
> + BRANCH_CHECKOUT_KIND_REBASE);
> + }
> + wt_status_state_free_buffers(&state);
> +@@ branch.c: static void prepare_checked_out_branches(void)
> + state.bisecting_from) {
> + register_checked_out_branch("refs/heads/",
> + state.bisecting_from,
> +- wt->path,
> ++ wt,
> + BRANCH_CHECKOUT_KIND_BISECT);
> + }
> + wt_status_state_free_buffers(&state);
> +@@ branch.c: static void prepare_checked_out_branches(void)
> + struct string_list_item *item;
> + for_each_string_list_item(item, &update_refs) {
> + register_checked_out_branch("", item->string,
> +- wt->path,
> ++ wt,
> + BRANCH_CHECKOUT_KIND_UPDATE_REF);
> + }
> + string_list_clear(&update_refs, 1);
> +@@ branch.c: const char *branch_checked_out_worktree(const char *refname)
> + return strmap_get(&checked_out_worktrees, refname);
> + }
> +
> ++const char *branch_checked_out_current_worktree(const char *refname)
> ++{
> ++ prepare_checked_out_branches();
> ++ return strmap_get(¤t_worktree_branches, refname);
> ++}
> ++
> + const char *branch_bisecting(const char *refname)
> + {
> + prepare_checked_out_branches();
> +
> + ## branch.h ##
> +@@ branch.h: const char *branch_checked_out(const char *refname);
> + */
> + const char *branch_checked_out_worktree(const char *refname);
> +
> ++/*
> ++ * Like branch_checked_out_worktree(), but only for the current
> ++ * worktree: return its path if it has the branch 'refname' checked
> ++ * out, or is rebasing or bisecting it. Otherwise return NULL.
> ++ */
> ++const char *branch_checked_out_current_worktree(const char *refname);
> ++
> + /*
> + * If the branch at 'refname' is currently used for bisecting in a
> + * worktree, then return the path to that worktree.
> +
> + ## ref-filter.c ##
> +@@ ref-filter.c: enum atom_type {
> + ATOM_HEAD,
> + ATOM_COLOR,
> + ATOM_WORKTREEPATH,
> ++ ATOM_CURRENTWORKTREE,
> + ATOM_ALIGN,
> + ATOM_END,
> + ATOM_IF,
> +@@ ref-filter.c: static struct {
> + [ATOM_HEAD] = { "HEAD", SOURCE_NONE, FIELD_STR, head_atom_parser },
> + [ATOM_COLOR] = { "color", SOURCE_NONE, FIELD_STR, color_atom_parser },
> + [ATOM_WORKTREEPATH] = { "worktreepath", SOURCE_NONE },
> ++ [ATOM_CURRENTWORKTREE] = { "currentworktree", SOURCE_NONE },
> + [ATOM_ALIGN] = { "align", SOURCE_NONE, FIELD_STR, align_atom_parser },
> + [ATOM_END] = { "end", SOURCE_NONE },
> + [ATOM_IF] = { "if", SOURCE_NONE, FIELD_STR, if_atom_parser },
> +@@ ref-filter.c: static int populate_value(struct ref_array_item *ref, struct strbuf *err)
> + v->s = xstrdup("");
> + continue;
> + }
> ++ else if (atom_type == ATOM_CURRENTWORKTREE) {
> ++ const char *path = NULL;
> ++
> ++ if (ref->kind == FILTER_REFS_BRANCHES)
> ++ path = branch_checked_out_current_worktree(ref->refname);
> ++ v->s = xstrdup(path ? path : "");
> ++ continue;
> ++ }
> + else if (atom_type == ATOM_SYMREF)
> + refname = get_symref(atom, ref);
> + else if (atom_type == ATOM_UPSTREAM) {
> +
> + ## t/t6302-for-each-ref-filter.sh ##
> +@@ t/t6302-for-each-ref-filter.sh: test_expect_success 'worktree atom ignores the HEAD of a bare repository' '
> test_cmp expect actual
> '
>
> -+test_expect_success 'branch being rebased is not marked in its own worktree' '
> -+ test_when_finished "git -C rebase_dir rebase --abort; rm -rf rebase_dir; git worktree prune; git branch -D rebasing" &&
> -+ git worktree add -b rebasing rebase_dir branch-two &&
> -+ (
> -+ cd rebase_dir &&
> -+ git commit --allow-empty -m rebase-me &&
> -+ test_must_fail git rebase -f -x false HEAD~1 &&
> -+ git branch --list rebasing >actual &&
> -+ echo " rebasing" >expect &&
> -+ test_cmp expect actual &&
> -+ git branch -vv --list rebasing >actual &&
> -+ test_grep ! "$(pwd)" actual &&
> -+ git branch >actual &&
> -+ test_grep "^\* (no branch, rebasing rebasing)" actual
> -+ )
> ++test_expect_success 'currentworktree atom' '
> ++ test_when_finished "git -C current rebase --abort; rm -rf current; git worktree prune; git branch -D current" &&
> ++ git worktree add -b current current main &&
> ++ git -C current commit --allow-empty -m rebase-me &&
> ++ test_must_fail git -C current rebase -f -x false main &&
> ++ git for-each-ref --format="%(refname:short) [%(currentworktree)]" \
> ++ refs/heads/main refs/heads/current >actual &&
> ++ cat >expect <<-EOF &&
> ++ current []
> ++ main [$(pwd)]
> ++ EOF
> ++ test_cmp expect actual &&
> ++ git -C current for-each-ref --format="%(refname:short) [%(currentworktree)]" \
> ++ refs/heads/main refs/heads/current >actual &&
> ++ cat >expect <<-EOF &&
> ++ current [$(pwd)/current]
> ++ main []
> ++ EOF
> ++ test_cmp expect actual
> +'
> +
> - test_expect_success 'branch being bisected in a worktree is marked' '
> - test_when_finished "git -C bisect_dir bisect reset; rm -rf bisect_dir; git worktree prune; git branch -D bisecting" &&
> - git worktree add -b bisecting bisect_dir branch-two &&
> -@@ t/t3203-branch-output.sh: test_expect_success 'branch being bisected in a worktree is marked' '
> - git commit --allow-empty -m bisect-one &&
> - git commit --allow-empty -m bisect-two &&
> - git bisect start HEAD HEAD~2 &&
> -- test_must_fail git symbolic-ref -q HEAD
> -+ test_must_fail git symbolic-ref -q HEAD &&
> -+ git branch --list bisecting >actual &&
> -+ echo " bisecting" >expect &&
> -+ test_cmp expect actual
> - ) &&
> - git branch --list bisecting >actual &&
> - echo "+ bisecting" >expect &&
> + test_expect_success 'start after with empty value' '
> + cat >expect <<-\EOF &&
> + refs/heads/main
> -: ---------- > 5: 4177c84d31 branch: do not mark the branch the current worktree is rebasing
Technical Details
Message-ID:
<5f7111ef-f6de-41ab-9a94-50eca30176f9@gmail.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76788-linux-kernel-git=dewy.ruReferences:
<20261102182930.3511-1-me@jaspermayone.com> <20261111152811.99986-1-me@jaspermayone.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76788-linux-kernel-git=dewy.ru
From: phillip.wood123@gmail.com (Phillip Wood)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v5 0/5] worktree: treat a branch being rebased or bisected
as checked out
Date: Tue, 1 Dec 2026 15:00:46 +0000
Organization: Usenet Network
Message-ID: <5f7111ef-f6de-41ab-9a94-50eca30176f9@gmail.com>
References: <20261102182930.3511-1-me@jaspermayone.com>
<20261111152811.99986-1-me@jaspermayone.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="1742620"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:j+j4Vfn6D8TRavQo9ZdsPzfQkSg= sha256:UFQDlceXfAIusJJK/U1hmk/KL7I3KQvvaDlBiKkNFzk=
sha1:WMXAMQxfefwW979oZLqv3FfN0f8= sha256:MI0dQiOcwo6SXpa6WRy9TpTyxaxybNrZz3DVUbIQDrg=
Content-Language: en-US
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 27A8D1173FF; Tue, 1 Dec 2026 18:01:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.048
X-Spam-Status: No, score=-2.048 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 0q5jb8Vr6rRt;
Tue, 1 Dec 2026 18:01:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-76788-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mail.dewy.ru (Postfix) with ESMTPS id EB7221173F6; Tue, 1 Dec 2026 18:00:56 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by tor.lore.kernel.org (Postfix) with ESMTP id 8CE31283BE; Tue, 1 Dec 2026 15:00:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796137251;
b=NsYqKngGI//xE+H0X5/D/0gg/ACfTA30O5Hw/zVlSMlUD7bil1X7a0yipkVB2eJmRdSD
lGnFM34ujCZyZrB03XdxBUvR+56zyaT6HgXtaaeOa8W5zu9w9Pd03XJN5ZagKfsQWg8zO
bVI5BCjDM+0dEi4vlFJl1CrG7W8HYEAV3cMoUtZxKNsDPkS4xcxoMmZhgMjosA3SXRxtc
y5MoLKsZgW7EIvopvjWuFjOmfOpYjkz5PhqxOs6Zl8Kpt/RcWFdILFWIBrmGV3+BEF11X
YGfL3RYhJxJJ4WeGL7FoYpW2cRDAwVmK2azjAIqSxWGoP3NsGscmwpRj2nbgZQ0nuvQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796137251;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:User-Agent:Reply-To:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=DwG0/n3eLx9GkWeSTBcxYncJMzmBeLFQyfKyQkdTN24=;
b=kgsvDvzvtZEHNWz3t6LhqyHtllvnxG4yHVmMovUauzaAS9+T2s+LqVFFTbOT9JFvVIgE
1w/KbH/GDCHqSn8iI0pzalLYLT0eSXYraIJmLKS/a3L8667TTGN4DRx2veDyAZEPpJrbA
TVaz1Vt+N5WhnRYR6bnkN/jGquixA+q5ZSUXJMRGT9mOxRigstUgWVILIx5FK7GuXflfl
sYtLLO8WXEAB0qhrb2bJOf3lny8IipOQqarO8ApUheeaa2/KNO85LSu0F2srC+HG4aHtB
1/gZaCIn8UPJJiwSWTsp1aWqEyZKMm3F4RJhDLeofT3NY6IqZ5uPb+tYSr3UkOfFWfA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=a0ip4Icp;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id A7A9C606A320;
Tue, 1 Dec 2026 15:00:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=a0ip4Icp
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.47
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796137250;
b=nVSVBOPSKNbca9Pkz+ZUB7hjn5UIa5t0fKZJLcaq/ym0pF9lTTn/GhdJ/FRMbwHNQRyM
Ht6FTFzyKRXqjqEj4iKERvYa1zO0rmEAHYgritkOOnCy8jJ2l6dgKQt73aBFcS8yYfOzK
znso2s6poG4v60u+w80+HMw+YynglqBMCsah4kmpvjwUxCbdthIrusl1Zh94kjj9vy2gt
B3RIYm2NIZ/3Elwgth/CHsSUfMJMk8GrJa2DORRINgSUvxcGMT5kabb7se3Zf2x5zMGz2
6yLbGaDRE5WY3CPWaL5itOtI7ZDvbhyoq8yWtdftH7ZuFWfWh0B4hKdw0ay5x/MqowQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796137250;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Date:MIME-Version:User-Agent:Reply-To:Subject:To:Cc:
References:Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=DwG0/n3eLx9GkWeSTBcxYncJMzmBeLFQyfKyQkdTN24=;
b=rD0jinCQIxGIQpp0ed2FOifDTfnBmQIjndwuEG1ssch7nSivsx9cO9yJJpPRokpLlqNa
AXZ4X/vZPPK6iEjrLLR+d1AlCidn69ddo30UDYYuNCPRWsYrvx3Ufek1VXRYqutlZuWFx
tqP0SC7yU6c3x8dGdWY1gX6ySc6EjnSHsbLjlbxyNeVQPdtmU5vFhNhwNRcy/t0LwIaM4
kW3/eXz1E5zbS54/L9LuOAH3lwhTPjywTtXZmi4qwrlLzuJTrrq/SfwehS+OmeNHIVDex
RscKzIb1jmoDh4SY5PDqXE55axpcu47bldHMAox1x6GuJE9qyv3aPac59sU+AvTfIIA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=a0ip4Icp;
arc=none smtp.remote-ip=209.85.221.47
X-Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C5DB606A31A
for <git@vger.kernel.org>; Tue, 1 Dec 2026 15:00:49 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2C5DB606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-48dee593f18so11347925f8f.3
for <git@vger.kernel.org>; Tue, 01 Dec 2026 07:00:49 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796137248; x=1796742048; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:reply-to:user-agent
:mime-version:date:message-id:from:to:cc:subject:date:message-id
:reply-to:content-type;
bh=DwG0/n3eLx9GkWeSTBcxYncJMzmBeLFQyfKyQkdTN24=;
b=a0ip4IcpXbCing0wPnGxhKewyfn7NadgnFmLXIA9/Qf6X7Nsj4d2AcYvbRT1LituBN
Eh5/oNvPKBriDCe5teo7YqSgKMGaM/CdUqHOvQCH95YipmpUGCsNCuDiZH9gDdW9HC/2
yZEX3kWFDzBV5wjNsducSWlVVFCmucZ3p7yXiyCGOAFNQtTGquFCHgh4209hHFhI4SAj
CseF0xjX87+SYFz68FhR8tBHKG036pGKsqYd1DGG9Kfxc5LTI/n6Hh29FrZbKAi29Ai2
FwIN26/5eQhH5O6QOPcFn701D0sgzMHnn3r5dmip6dFnzHva3F1ER/naJ5tDh0XmZCiR
sHPA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796137248; x=1796742048;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:reply-to:user-agent
:mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to:content-type;
bh=DwG0/n3eLx9GkWeSTBcxYncJMzmBeLFQyfKyQkdTN24=;
b=zt2CYdjeR5UkV4eYucdBD5LDy2VbPwChJPiUxWPuBQzspIi66l0lGxskLvAM4yYXzd
oFpihT2nISk91eVKnL7RX0GalmS0khUnzX1hE7a3aRU6PhXWMAvfIStIf4YTtqOu3WZP
BFiZpBjk+bqhbTUsbbpNIkEirlTIQP5xbuYEQIfAsjc4hrxgMnKNQ0UJN1DeVhPbJh9t
PGPbHRb8jj7uWh11JXpGsNYKEioT4UzdlIPVdIHKpmY1EFxwLkyxlitOChMUYkJp/HO5
ftp5wplRXPhl6hR6PZgsyEmNMvTEIf8YiFQe0GCNWiOMIMdQqQoXDORh2q5JKLqcQoXd
hk3A==
X-Forwarded-Encrypted: i=1; AL+hErFKO3ONXNxPXvxa0Bw6xuZszKIP8i/NrRX1Gnr0+X1naRV8VxcIP6mG0wGB7a5EcrNFRmQ=@vger.kernel.org
X-Gm-Message-State: APuU4Z/v+M6vQhpjOjdYpZtDdoTAFjQk7WOgX9ZLd5PQB51Lz+4V6USw
86wt5jrz7hbb682jasGLfnd1cBSrXwmVPqTbn1Pe85l796WIWTPcQ9qX
X-Gm-Gg: AZFdTZc7bBfFj7dYfgWSM2k512mX3b2FnCNHwXuT65zDTKtZlErjG6AaE9SKVFf6Kql
pN6BIKFQV89Z/heaOFnb055xEsSGdcrMdbIz3JOkBRen0YxxuKJBglyCOX1dCjOA8wsr0cPHwFv
OHyXNk3Zpw7Huo4bnVul3OydwLC8OsA/P0BlzYwCgeH1AvDRtl/sub1JgZ9uOW4VCU/OgazrC1Z
04x18cSmrQIGv3NqPvMe04E7mtiDBLqODUgwzAscfHyZ73Y7oL5nqn1NDqcArrNfWybtaqGFguk
IOUQv6oIlVn+2wAikOza+Dzp9VK4yoWxYKH8spXWo7YmPTzEeZGyBvYy+f5fI+sjaaHdoXosMrn
R33+tbKFE2ZDM1CTVhHJnyYghLKS3dDnsoZbHy7nk7tVwa6zAIPwxatVCIK68te3bXmGvIhivSl
DaWub3D95+Qv5hkKmOiBZDOQkYWlnZIYrvwgRGRSxMYPqMWr4pjhTOynkwcfWQ2Ycd4/KnUEYYv
pVoKSarmGaOFRcy2j6dxkLj9qaEm4/jnrvJc70oecnxz/F43kcFr2PL8dRYqloLZ4jDF6XS1MO/
8yGX6u6h1KuuEjAYLNEc8sMNNJIpnKlc29FG4l38U4U+1Ux4PTL3xKnemT2yLlrS3Ha76nkVBMn
W2GRh9UKmVqXk96WWAdopPi1RDgE=
X-Received: by 2002:a05:6000:4617:b0:48e:2bdc:5e5e with SMTP id ffacd0b85a97d-4abb30b83aamr72213622f8f.29.1796137248090;
Tue, 01 Dec 2026 07:00:48 -0800 (PST)
X-Received: from ?IPV6:2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f? ([2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6b205443sm75701458f8f.39.2026.12.01.07.00.46
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Tue, 01 Dec 2026 07:00:47 -0800 (PST)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Reply-To: phillip.wood@dunelm.org.uk
X-Cc: gitster@pobox.com, sunshine@sunshineco.com,
kristofferhaugsbakk@fastmail.com, ben.knoble@gmail.com,
haraldnordgren@gmail.com
X-In-Reply-To: <20261111152811.99986-1-me@jaspermayone.com>