git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Jean-Noël AVILA" <avila.jn@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Torsten Bögershausen" <tboegi@web.de>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Jeff King" <peff@peff.net>,
	git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"Felipe Contreras" <felipe.contreras@gmail.com>
Subject: Re: Re* t9902 fails
Date: Sat, 19 Jan 2013 14:43:32 +0100	[thread overview]
Message-ID: <201301191443.32661.avila.jn@gmail.com> (raw)
In-Reply-To: <7vwqv9obie.fsf_-_@alter.siamese.dyndns.org>

Le samedi 19 janvier 2013 08:52:25, Junio C Hamano a écrit :
>  (2) instead of being inclusive, collecting all executable in
>      GIT_EXEC_PATH that happens to be named "git-", add a mode to
>      "git help" that lists those that we know to be standard
>      commands that the users may want to complete from the command
>      line.

Am I wrong when I say that "git help -a" already provides the difference 
between core git commands and other commands available through path?

If we use this, then we can instruct git-completion that we are in test mode 
and that it should not provide additional completions.

---
 contrib/completion/git-completion.bash | 13 +++++++++++--
 t/t9902-completion.sh                  |  2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-
completion.bash
index 14dd5e7..dc0ea5b 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -23,6 +23,8 @@
 #    3) Consider changing your PS1 to also show the current branch,
 #       see git-prompt.sh for details.
 
+__testing_git=$1
+
 case "$COMP_WORDBREAKS" in
 *:*) : great ;;
 *)   COMP_WORDBREAKS="$COMP_WORDBREAKS:"
@@ -533,8 +535,15 @@ __git_complete_strategy ()
 
 __git_list_all_commands ()
 {
-	local i IFS=" "$'\n'
-	for i in $(git help -a|egrep '^  [a-zA-Z0-9]')
+	local i cmdlist IFS=" "$'\n'
+
+	if [ "x$__testing_git" != "xTEST" ]; then
+		cmdlist=$(git help -a|egrep '^  [a-zA-Z0-9]')
+	else
+		cmdlist=$(git help -a| egrep -m 1 -B1000 PATH | egrep '^  [a-zA-Z0-9]')
+	fi
+
+	for i in $cmdlist
 	do
 		case $i in
 		*--*)             : helper pattern;;
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 3cd53f8..51463b2 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -13,7 +13,7 @@ complete ()
 	return 0
 }
 
-. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
+. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" TEST
 
 # We don't need this function to actually join words or do anything special.
 # Also, it's cleaner to avoid touching bash's internal completion variables.
-- 
1.8.1.1.271.g02f55e6

  parent reply	other threads:[~2013-01-19 13:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 13:35 [PATCH] attr: fix off-by-one directory component length calculation Nguyễn Thái Ngọc Duy
2013-01-15 16:17 ` Junio C Hamano
2013-01-15 19:14 ` Jean-Noël AVILA
2013-01-15 19:29   ` Junio C Hamano
2013-01-15 19:53     ` Jean-Noël AVILA
2013-01-15 20:49       ` Junio C Hamano
2013-01-15 23:24         ` Jeff King
2013-01-16  6:15           ` t9902 fails (Was: [PATCH] attr: fix off-by-one directory component length calculation) Torsten Bögershausen
2013-01-17 22:47             ` Jean-Noël AVILA
2013-01-18  0:04               ` Jonathan Nieder
2013-01-18  0:12                 ` t9902 fails Junio C Hamano
2013-01-18  5:20                 ` t9902 fails (Was: [PATCH] attr: fix off-by-one directory component length calculation) Torsten Bögershausen
2013-01-18 16:49                 ` t9902 fails Junio C Hamano
2013-01-18 20:15                   ` Junio C Hamano
2013-01-18 22:23                     ` Jean-Noël AVILA
2013-01-18 22:37                       ` Junio C Hamano
2013-01-18 22:57                         ` Junio C Hamano
2013-01-19  5:38                       ` Torsten Bögershausen
2013-01-19  7:52                         ` Re* " Junio C Hamano
2013-01-19  8:00                           ` [PATCH 1/2] help: include <common-cmds.h> only in one file Junio C Hamano
2013-01-19  8:02                             ` [PATCH 2/2] help --standard: list standard commands Junio C Hamano
2013-01-19 10:32                               ` Jean-Noël AVILA
2013-01-19 13:43                           ` Jean-Noël AVILA [this message]
2013-01-19 10:23                         ` t9902 fails Jean-Noël AVILA
2013-01-16  1:08     ` [PATCH] attr: fix off-by-one directory component length calculation Duy Nguyen
2013-01-16  2:09       ` Duy Nguyen
2013-01-16  2:33         ` Junio C Hamano
2013-01-16  3:12           ` Duy Nguyen
2013-01-16  5:35             ` Junio C Hamano
2013-01-16  6:02               ` Duy Nguyen
2013-01-16 19:07                 ` Junio C Hamano
2013-01-16  1:03   ` Duy Nguyen

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=201301191443.32661.avila.jn@gmail.com \
    --to=avila.jn@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=tboegi@web.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).