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

conflict resolution of pd/bash-4-completion [Re: What's cooking in git.git (Dec 2010, #05; Thu, 16)]

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Dec 17, 2010, 11:18 UTC
Message-ID
<20101217111856.GA9304@neumann>
In-Reply-To
<7vk4j8kfwy.fsf@alter.siamese.dyndns.org>
Hi,
On Thu, Dec 16, 2010 at 11:38:21PM -0800, Junio C Hamano wrote:
Show 7 quoted lines
> * pd/bash-4-completion (2010-12-15) 3 commits
>  - Merge branch 'master' (early part) into pd/bash-4-completion
>  - bash: simple reimplementation of _get_comp_words_by_ref
>  - bash: get --pretty=m<tab> completion to work with bash v4
> 
> Updated by Jonathan; this still has some conflicts around "notes"
> completion I tried to resolve near the tip of 'pu'.

The resolution of that conflict is not quite correct. I'm not sure how I should send a proper conflict resolution... but I'll try anyway.

So the patch below applies to today's pu (i.e. db92f24) and fixes the current merge conflict resolution in the completion function for 'git notes'.

I also have a few comments to the patches in this topic, but it's quite hard to find the time to think them through and sum them up properly in this pre-Xmas frenzy...

Best, Gábor

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index bd5b322..e0c40c3 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1707,20 +1707,15 @@ _git_notes ()
 {
 	local subcommands='add append copy edit list prune remove show'
 	local subcommand="$(__git_find_on_cmdline "$subcommands")"
-	local words cword
-	_get_comp_words_by_ref -n =: words cword
-	local cur=${words[cword-1]}
-	if [ -z "$subcommand" ]; then
-		__gitcomp "$subcommands"
-		return
-	fi
+	local cur words cword
+	_get_comp_words_by_ref -n =: cur words cword
 
 	case "$subcommand,$cur" in
 	,--*)
 		__gitcomp '--ref'
 		;;
 	,*)
-		case "${COMP_WORDS[COMP_CWORD-1]}" in
+		case "${words[cword-1]}" in
 		--ref)
 			__gitcomp "$(__git_refs)"
 			;;
@@ -1748,7 +1743,7 @@ _git_notes ()
 	prune,*)
 		;;
 	*)
-		case "${COMP_WORDS[COMP_CWORD-1]}" in
+		case "${words[cword-1]}" in
 		-m|-F)
 			;;
 		*)
-- 
1.7.3.4.547.g524288
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 4 in “What's cooking in git.git (Dec 2010, #05; Thu, 16)”
  1. Junio C HamanoDec 17, 2010
  2. conflict resolution of pd/bash-4-completion [Re: What's cooking in git.git (Dec 2010, #05; Thu, 16)]SZEDER Gábor, Dec 17, 2010
  3. Junio C HamanoDec 17, 2010
  4. Ramsay JonesDec 18, 2010

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.