checkout: refer to other-worktree branch, not ref

We can only check out commits or branches, not refs in general. And the problem here is if another worktree is using the branch that we want to check out. Let’s be more direct and just talk about branches instead of refs. Also replace “be held” with “in use”. Further, “in use” is not restricted to a branch being checked out (e.g. the branch could be busy on a rebase), hence generalize to “or otherwise in use” in the option description. Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kristoffer Haugsbakk committed Oct 10, 2024 at 20:39 UTC b8139c8f4e761bd24f4ffc3170203e82c75165e2
2 files changed +5 -5
Documentation/git-checkout.txt
+4 -4
@@ -290,10 +290,10 @@ Note that this option uses the no overlay mode by default (see also
290 `--overlay`), and currently doesn't support overlay mode.
291
292 --ignore-other-worktrees::
293 - `git checkout` refuses when the wanted ref is already checked
294 - out by another worktree. This option makes it check the ref
295 - out anyway. In other words, the ref can be held by more than one
296 - worktree.
293 + `git checkout` refuses when the wanted branch is already checked
294 + out or otherwise in use by another worktree. This option makes
295 + it check the branch out anyway. In other words, the branch can
296 + be in use by more than one worktree.
297
298 --overwrite-ignore::
299 --no-overwrite-ignore::
builtin/checkout.c
+1 -1
@@ -1716,7 +1716,7 @@ static struct option *add_common_switch_branch_options(
1716 N_("update ignored files (default)"),
1717 PARSE_OPT_NOCOMPLETE),
1718 OPT_BOOL(0, "ignore-other-worktrees", &opts->ignore_other_worktrees,
1719 - N_("do not check if another worktree is holding the given ref")),
1719 + N_("do not check if another worktree is using this branch")),
1720 OPT_END()
1721 };
1722 struct option *newopts = parse_options_concat(prevopts, options);