git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Thomas Rast <trast@student.ethz.ch>
Cc: git@vger.kernel.org, Rob Sanheim <rsanheim@gmail.com>,
	"Shawn O. Pearce" <spearce@spearce.org>
Subject: [PATCH] bash: remove fetch, push, pull dashed form leftovers
Date: Fri, 3 Oct 2008 21:34:49 +0200	[thread overview]
Message-ID: <20081003193449.GA24821@neumann> (raw)
In-Reply-To: <1223051705-30347-1-git-send-email-trast@student.ethz.ch>

We don't provide complation for git-commands in dashed form anymore,
so there is no need to keep those cases.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---

On Fri, Oct 03, 2008 at 06:35:05PM +0200, Thomas Rast wrote:
> Actually it's not enough, you need to teach fetch, pull and push to
> recognise the new alias too, as in this patch.  I do wonder if there's
> a better approach to those functions however, so that the "obvious"
> fix suggested by Shawn would work.

Maybe something like this?


 contrib/completion/git-completion.bash |   36 ++++++++------------------------
 1 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 95c81f9..5a4e8c8 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -784,14 +784,9 @@ _git_fetch ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
 
-	case "${COMP_WORDS[0]},$COMP_CWORD" in
-	git-fetch*,1)
+	if [ "$COMP_CWORD" = 2 ]; then
 		__gitcomp "$(__git_remotes)"
-		;;
-	git,2)
-		__gitcomp "$(__git_remotes)"
-		;;
-	*)
+	else
 		case "$cur" in
 		*:*)
 			local pfx=""
@@ -810,8 +805,7 @@ _git_fetch ()
 			__gitcomp "$(__git_refs2 "$remote")"
 			;;
 		esac
-		;;
-	esac
+	fi
 }
 
 _git_format_patch ()
@@ -1051,36 +1045,25 @@ _git_pull ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
 
-	case "${COMP_WORDS[0]},$COMP_CWORD" in
-	git-pull*,1)
-		__gitcomp "$(__git_remotes)"
-		;;
-	git,2)
+	if [ "$COMP_CWORD" = 2 ]; then
 		__gitcomp "$(__git_remotes)"
-		;;
-	*)
+	else
 		local remote
 		case "${COMP_WORDS[0]}" in
 		git-pull)  remote="${COMP_WORDS[1]}" ;;
 		git)       remote="${COMP_WORDS[2]}" ;;
 		esac
 		__gitcomp "$(__git_refs "$remote")"
-		;;
-	esac
+	fi
 }
 
 _git_push ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
 
-	case "${COMP_WORDS[0]},$COMP_CWORD" in
-	git-push*,1)
-		__gitcomp "$(__git_remotes)"
-		;;
-	git,2)
+	if [ "$COMP_CWORD" = 2 ]; then
 		__gitcomp "$(__git_remotes)"
-		;;
-	*)
+	else
 		case "$cur" in
 		*:*)
 			local remote
@@ -1104,8 +1087,7 @@ _git_push ()
 			__gitcomp "$(__git_refs)"
 			;;
 		esac
-		;;
-	esac
+	fi
 }
 
 _git_rebase ()
-- 
1.6.0.2.474.ga74ad.dirty

  reply	other threads:[~2008-10-03 19:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-03  2:51 alias g to git in .gitconfig? Rob Sanheim
2008-10-03  3:10 ` Shawn O. Pearce
2008-10-03 15:25   ` Rob Sanheim
2008-10-03 16:35     ` [FYI PATCH] bash completion: alias 'g' to 'git' with completion Thomas Rast
2008-10-03 19:34       ` SZEDER Gábor [this message]
2008-10-03 20:13         ` [PATCH] bash: remove fetch, push, pull dashed form leftovers Thomas Rast

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=20081003193449.GA24821@neumann \
    --to=szeder@ira.uka.de \
    --cc=git@vger.kernel.org \
    --cc=rsanheim@gmail.com \
    --cc=spearce@spearce.org \
    --cc=trast@student.ethz.ch \
    /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).