git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix: fix comment for __git_complete_worktree_paths

From
SGSardorbek Imomaliev via GitGitGadget <gitgitgadget@gmail.com>
Date
Apr 29, 2021, 08:43 UTC
Message-ID
<pull.943.git.1619685833872.gitgitgadget@gmail.com>
From: Sardorbek Imomaliev <sardorbek.imomaliev@gmail.com>
Completion helper function fails for zsh because of wrongly put comment
Signed-off-by: Sardorbek Imomaliev <sardorbek.imomaliev@gmail.com>
---
    Fix: wrongly put comment for __git_complete_worktree_paths completion
    helper function
    
    git completion script fails for zsh
    
    $ git worktree remove [TAB]
    $ git worktree remove __git_complete_worktree_paths:7: command not found: #
    
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-943%2Fimomaliev%2Ffix%2Fgit-completion-worktree-subcommands-comment-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-943/imomaliev/fix/git-completion-worktree-subcommands-comment-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/943
 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 dfa735ea6299..b2e158edaf6b 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3268,9 +3268,9 @@ _git_whatchanged ()
 __git_complete_worktree_paths ()
 {
 	local IFS=$'\n'
+	# Skip the first entry: it's the path of the main worktree,
+	# which can't be moved, removed, locked, etc.
 	__gitcomp_nl "$(git worktree list --porcelain |
-		# Skip the first entry: it's the path of the main worktree,
-		# which can't be moved, removed, locked, etc.
 		sed -n -e '2,$ s/^worktree //p')"
 }
 

base-commit: 311531c9de557d25ac087c1637818bd2aad6eb3a
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 4 in “Fix: fix comment for __git_complete_worktree_paths”
  1. Fix: fix comment for __git_complete_worktree_pathsSardorbek Imomaliev via GitGitGadget, Apr 29, 2021
  2. Junio C HamanoApr 30, 2021
  3. work around zsh comment in __git_complete_worktree_pathsSardorbek Imomaliev via GitGitGadget, May 3, 2021
  4. Junio C HamanoMay 4, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.