threads / patch / 21941

patchbash: Support new 'git fetch' options

Subject: [PATCH] bash: Support new 'git fetch' options

## tl;dr

2 messages between Dec 12, 2009 and Dec 12, 2009. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Björn Gustavsson· Dec 12, 2009, 10:21 UTC · lore

Support the new options --all, --prune, and --dry-run for 'git fetch'.

As the --multiple option was primarily introduced to enable 'git remote update' to be re-implemented in terms of 'git fetch' (16679e37) and is not likely to be used much from the command line, it does not seems worthwhile to complicate the code (to support completion of multiple remotes) to handle it.

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
---
 contrib/completion/git-completion.bash |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
Show changes to contrib/completion/git-completion.bash +12 −2
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 7c18b0c..fbfa5f2 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -417,7 +417,17 @@ __git_complete_remote_or_refspec ()
 	while [ $c -lt $COMP_CWORD ]; do
 		i="${COMP_WORDS[c]}"
 		case "$i" in
-		--all|--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;;
+		--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;;
+		--all)
+			case "$cmd" in
+			push) no_complete_refspec=1 ;;
+			fetch)
+				COMPREPLY=()
+				return
+				;;
+			*) ;;
+			esac
+			;;
 		-*) ;;
 		*) remote="$i"; break ;;
 		esac
@@ -1002,7 +1012,7 @@ _git_difftool ()
 
 __git_fetch_options="
 	--quiet --verbose --append --upload-pack --force --keep --depth=
-	--tags --no-tags
+	--tags --no-tags --all --prune --dry-run
 "
 
 _git_fetch ()
-- 
1.6.6.rc2
Shawn O. Pearce· Dec 12, 2009, 21:24 UTC · re: Björn Gustavsson · lore

Re: [PATCH] bash: Support new 'git fetch' options

Bj??rn Gustavsson <bgustavsson@gmail.com> wrote:
Show 10 quoted lines
> Support the new options --all, --prune, and --dry-run for
> 'git fetch'.
> 
> As the --multiple option was primarily introduced to enable
> 'git remote update' to be re-implemented in terms of 'git fetch'
> (16679e37) and is not likely to be used much from the command
> line, it does not seems worthwhile to complicate the code
> (to support completion of multiple remotes) to handle it.
> 
> Signed-off-by: Bj??rn Gustavsson <bgustavsson@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>

Junio, this belongs in 1.6.6 as its completion support for 1.6.6 features...

-- 
Shawn.

← back to recent threads