git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Felipe Contreras <felipe.contreras@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 3/4] completion: fix branch.autosetup(merge|rebase)
Date: Mon, 30 Dec 2013 20:22:17 +0530	[thread overview]
Message-ID: <1388415138-11011-4-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1388415138-11011-1-git-send-email-artagnon@gmail.com>

When attempting to complete

  $ git config branch.auto<TAB>

'autosetupmerge' and 'autosetuprebase' don't come up. This is because
"$cur" is matched with "branch.*" and a list of branches are
completed. Add 'autosetup(merge|rebase)' to the list of branches using
__gitcomp_2 ().

Also take care to not complete

  $ git config branch.autosetupmerge.<TAB>
  $ git config branch.autosetuprebase.<TAB>

with the usual branch.<name>. candidates.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 contrib/completion/git-completion.bash | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 64b20b8..0bda757 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1851,12 +1851,18 @@ _git_config ()
 		;;
 	branch.*.*)
 		local pfx="${cur%.*}." cur_="${cur##*.}"
+		if [ "$pfx" == "branch.autosetupmerge." ] ||
+			[ "$pfx" == "branch.autosetuprebase." ]; then
+			return
+		fi
 		__gitcomp "remote pushremote merge mergeoptions rebase" "$pfx" "$cur_"
 		return
 		;;
 	branch.*)
 		local pfx="${cur%.*}." cur_="${cur#*.}"
-		__gitcomp_nl "$(__git_heads)" "$pfx" "$cur_" "."
+		__gitcomp_2 "$(__git_heads)" "
+			autosetupmerge autosetuprebase
+			" "$pfx" "$cur_" "."
 		return
 		;;
 	guitool.*.*)
-- 
1.8.5.2.227.g53f3478

  parent reply	other threads:[~2013-12-30 14:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-30 14:52 [PATCH 0/4] Fix branch.autosetup(merge|rebase) completion Ramkumar Ramachandra
2013-12-30 14:52 ` [PATCH 1/4] completion: prioritize ./git-completion.bash Ramkumar Ramachandra
2013-12-30 14:52 ` [PATCH 2/4] completion: introduce __gitcomp_2 () Ramkumar Ramachandra
2014-01-02 23:47   ` Junio C Hamano
2014-01-03  7:51     ` Ramkumar Ramachandra
2014-01-03 17:49       ` Junio C Hamano
2014-01-03 19:09         ` Ramkumar Ramachandra
2013-12-30 14:52 ` Ramkumar Ramachandra [this message]
2014-01-02 23:56   ` [PATCH 3/4] completion: fix branch.autosetup(merge|rebase) Junio C Hamano
2014-01-03  7:36     ` Ramkumar Ramachandra
2014-01-03 17:32       ` Junio C Hamano
2014-01-03 18:58         ` Ramkumar Ramachandra
2014-01-03 19:13           ` Junio C Hamano
2013-12-30 14:52 ` [PATCH 4/4] completion: fix remote.pushdefault Ramkumar Ramachandra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1388415138-11011-4-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).