# [PATCH] completion: complete 'git worktree repair'

6 messages from 2026-09-12 to 2026-09-23. Participants: Yoichi NAKAYAMA via GitGitGadget, Patrick Steinhardt, Yoichi Nakayama.
Thread: https://gitlist.dev/t/66314

## Yoichi NAKAYAMA via GitGitGadget, 2026-09-12 00:12

Subject: [PATCH] completion: complete 'git worktree repair'
Message-ID: <pull.2218.git.1789171955370.gitgitgadget@gmail.com>

```
From: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>

Added completion support for the 'repair' subcommand of worktree. It
optionally receives a list of paths to linked worktrees or paths to
worktrees with broken links.

Signed-off-by: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>
---
    completion: complete 'git worktree repair'

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2218%2Fyoichi%2Fcomplete-worktree-repair-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2218/yoichi/complete-worktree-repair-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2218

 contrib/completion/git-completion.bash | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9f8b9b50ff..c3a49e2e22 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3816,7 +3816,7 @@ __git_complete_worktree_paths ()
 
 _git_worktree ()
 {
-	local subcommands="add list lock move prune remove unlock"
+	local subcommands="add list lock move prune remove repair unlock"
 	local subcommand subcommand_idx
 
 	subcommand="$(__git_find_on_cmdline --show-idx "$subcommands")"
@@ -3866,7 +3866,7 @@ _git_worktree ()
 			;;
 		esac
 		;;
-	lock,*|remove,*|unlock,*)
+	lock,*|remove,*|repair,*|unlock,*)
 		__git_complete_worktree_paths
 		;;
 	move,*)

base-commit: 47ce80527c56f462cb97db4ca8125342204d3783
-- 
gitgitgadget

```

## Patrick Steinhardt, 2026-09-14 06:29

Subject: Re: [PATCH] completion: complete 'git worktree repair'
Message-ID: <aqeUWrx7pbzDVbVt@pks.im>
In-Reply-To: <pull.2218.git.1789171955370.gitgitgadget@gmail.com>

```
On Sat, Sep 12, 2026 at 12:12:35AM +0000, Yoichi NAKAYAMA via GitGitGadget wrote:
> From: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>
> 
> Added completion support for the 'repair' subcommand of worktree. It
> optionally receives a list of paths to linked worktrees or paths to
> worktrees with broken links.

We typically write commit messages in imperative mood, as if instructing
the code to change. We also briefly describe the status quo, even though
it's not as important in this particular case. An example could be:

  Our Bash completion does not know to complete the "repair" subcommand
  for git-worktree(1). Add support for it.

One could also try to add in your bit about worktree paths, but that's
something that's quite obviously visible from the diff anyway. So this
may or may not be valuable.

Other than that the patch looks good to me.

Thanks!

Patrick

```

## Yoichi Nakayama, 2026-09-14 12:08

Subject: Re: [PATCH] completion: complete 'git worktree repair'
Message-ID: <CAF5D8-v2FSJX_dHFmNzaudAtPu76pVX0n5GhMnGjjnT2f3g3Ng@mail.gmail.com>
In-Reply-To: <aqeUWrx7pbzDVbVt@pks.im>

```
On Mon, Sep 14, 2026 at 3:29 PM Patrick Steinhardt <ps@pks.im> wrote:
>
> On Sat, Sep 12, 2026 at 12:12:35AM +0000, Yoichi NAKAYAMA via GitGitGadget wrote:
> > From: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>
> >
> > Added completion support for the 'repair' subcommand of worktree. It
> > optionally receives a list of paths to linked worktrees or paths to
> > worktrees with broken links.
>
> We typically write commit messages in imperative mood, as if instructing
> the code to change. We also briefly describe the status quo, even though
> it's not as important in this particular case. An example could be:
>
>   Our Bash completion does not know to complete the "repair" subcommand
>   for git-worktree(1). Add support for it.
>
> One could also try to add in your bit about worktree paths, but that's
> something that's quite obviously visible from the diff anyway. So this
> may or may not be valuable.

Thank you for your comment.
Since this is not limited to bash, it also adds completion support
for zsh and tcsh via git-completion.{zsh,tcsh}.
So I'd like to modify the body of the commit message as follows:

  The completion scripts do not complete the "repair" subcommand for
  git-worktree(1). Add support for it.

Thanks

> Other than that the patch looks good to me.
>
> Thanks!
>
> Patrick



-- 
Yoichi NAKAYAMA

```

## Yoichi NAKAYAMA via GitGitGadget, 2026-09-14 19:35

Subject: [PATCH v2] completion: complete 'git worktree repair'
Message-ID: <pull.2218.v2.git.1789414536838.gitgitgadget@gmail.com>
In-Reply-To: <pull.2218.git.1789171955370.gitgitgadget@gmail.com>

```
From: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>

The completion scripts do not complete the "repair" subcommand for
git-worktree(1). Add support for it.

Signed-off-by: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>
---
    completion: complete 'git worktree repair'

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2218%2Fyoichi%2Fcomplete-worktree-repair-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2218/yoichi/complete-worktree-repair-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2218

Range-diff vs v1:

 1:  84cfa0da2d ! 1:  4f3f233065 completion: complete 'git worktree repair'
     @@ Metadata
       ## Commit message ##
          completion: complete 'git worktree repair'
      
     -    Added completion support for the 'repair' subcommand of worktree. It
     -    optionally receives a list of paths to linked worktrees or paths to
     -    worktrees with broken links.
     +    The completion scripts do not complete the "repair" subcommand for
     +    git-worktree(1). Add support for it.
      
          Signed-off-by: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>
      


 contrib/completion/git-completion.bash | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9f8b9b50ff..c3a49e2e22 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3816,7 +3816,7 @@ __git_complete_worktree_paths ()
 
 _git_worktree ()
 {
-	local subcommands="add list lock move prune remove unlock"
+	local subcommands="add list lock move prune remove repair unlock"
 	local subcommand subcommand_idx
 
 	subcommand="$(__git_find_on_cmdline --show-idx "$subcommands")"
@@ -3866,7 +3866,7 @@ _git_worktree ()
 			;;
 		esac
 		;;
-	lock,*|remove,*|unlock,*)
+	lock,*|remove,*|repair,*|unlock,*)
 		__git_complete_worktree_paths
 		;;
 	move,*)

base-commit: 47ce80527c56f462cb97db4ca8125342204d3783
-- 
gitgitgadget

```

## Patrick Steinhardt, 2026-09-23 12:57

Subject: Re: [PATCH v2] completion: complete 'git worktree repair'
Message-ID: <arPMLIi7FL52CVJk@pks.im>
In-Reply-To: <pull.2218.v2.git.1789414536838.gitgitgadget@gmail.com>

```
On Mon, Sep 14, 2026 at 07:35:36PM +0000, Yoichi NAKAYAMA via GitGitGadget wrote:
> From: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>
> 
> The completion scripts do not complete the "repair" subcommand for
> git-worktree(1). Add support for it.
> 
> Signed-off-by: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>

Thanks, this looks good to me!

Patrick

```

## Patrick Steinhardt, 2026-09-23 13:06

Subject: Re: [PATCH] completion: complete 'git worktree repair'
Message-ID: <arPO6GzJVjjdndTN@pks.im>
In-Reply-To: <CAF5D8-v2FSJX_dHFmNzaudAtPu76pVX0n5GhMnGjjnT2f3g3Ng@mail.gmail.com>

```
On Mon, Sep 14, 2026 at 09:08:15PM +0900, Yoichi Nakayama wrote:
> On Mon, Sep 14, 2026 at 3:29 PM Patrick Steinhardt <ps@pks.im> wrote:
> >
> > On Sat, Sep 12, 2026 at 12:12:35AM +0000, Yoichi NAKAYAMA via GitGitGadget wrote:
> > > From: Yoichi NAKAYAMA <yoichi.nakayama@gmail.com>
> > >
> > > Added completion support for the 'repair' subcommand of worktree. It
> > > optionally receives a list of paths to linked worktrees or paths to
> > > worktrees with broken links.
> >
> > We typically write commit messages in imperative mood, as if instructing
> > the code to change. We also briefly describe the status quo, even though
> > it's not as important in this particular case. An example could be:
> >
> >   Our Bash completion does not know to complete the "repair" subcommand
> >   for git-worktree(1). Add support for it.
> >
> > One could also try to add in your bit about worktree paths, but that's
> > something that's quite obviously visible from the diff anyway. So this
> > may or may not be valuable.
> 
> Thank you for your comment.
> Since this is not limited to bash, it also adds completion support
> for zsh and tcsh via git-completion.{zsh,tcsh}.
> So I'd like to modify the body of the commit message as follows:
> 
>   The completion scripts do not complete the "repair" subcommand for
>   git-worktree(1). Add support for it.

Ah, fair. We know to reuse the Bash completion scripts for both of
these.

Patrick

```
