* [PATCH 1/2] bash: add git-branch options
@ 2008-03-04 18:00 SZEDER Gábor
2008-03-04 18:00 ` [PATCH 2/2] bash: git-branch -d and -m lists only local branches SZEDER Gábor
0 siblings, 1 reply; 3+ messages in thread
From: SZEDER Gábor @ 2008-03-04 18:00 UTC (permalink / raw
To: git; +Cc: gitster, spearce, SZEDER Gábor
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
contrib/completion/git-completion.bash | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8f70e1e..8d6733a 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -506,7 +506,16 @@ _git_bisect ()
_git_branch ()
{
- __gitcomp "$(__git_refs)"
+ case "${COMP_WORDS[COMP_CWORD]}" in
+ --*=*) COMPREPLY=() ;;
+ --*)
+ __gitcomp "
+ --color --no-color --verbose --abbrev= --no-abbrev
+ --track --no-track
+ "
+ ;;
+ *) __gitcomp "$(__git_refs)" ;;
+ esac
}
_git_bundle ()
--
1.5.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] bash: git-branch -d and -m lists only local branches
2008-03-04 18:00 [PATCH 1/2] bash: add git-branch options SZEDER Gábor
@ 2008-03-04 18:00 ` SZEDER Gábor
2008-03-05 5:51 ` Shawn O. Pearce
0 siblings, 1 reply; 3+ messages in thread
From: SZEDER Gábor @ 2008-03-04 18:00 UTC (permalink / raw
To: git; +Cc: gitster, spearce, SZEDER Gábor
But still all branches are listed, if -r is present
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
contrib/completion/git-completion.bash | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8d6733a..49e6df0 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -506,6 +506,17 @@ _git_bisect ()
_git_branch ()
{
+ local i c=1 only_local_ref="n" has_r="n"
+
+ while [ $c -lt $COMP_CWORD ]; do
+ i="${COMP_WORDS[c]}"
+ case "$i" in
+ -d|-m) only_local_ref="y" ;;
+ -r) has_r="y" ;;
+ esac
+ c=$((++c))
+ done
+
case "${COMP_WORDS[COMP_CWORD]}" in
--*=*) COMPREPLY=() ;;
--*)
@@ -514,7 +525,13 @@ _git_branch ()
--track --no-track
"
;;
- *) __gitcomp "$(__git_refs)" ;;
+ *)
+ if [ $only_local_ref = "y" -a $has_r = "n" ]; then
+ __gitcomp "$(__git_heads)"
+ else
+ __gitcomp "$(__git_refs)"
+ fi
+ ;;
esac
}
--
1.5.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] bash: git-branch -d and -m lists only local branches
2008-03-04 18:00 ` [PATCH 2/2] bash: git-branch -d and -m lists only local branches SZEDER Gábor
@ 2008-03-05 5:51 ` Shawn O. Pearce
0 siblings, 0 replies; 3+ messages in thread
From: Shawn O. Pearce @ 2008-03-05 5:51 UTC (permalink / raw
To: Junio C Hamano; +Cc: SZEDER Gábor, git
SZEDER Gbor <szeder@ira.uka.de> wrote:
> But still all branches are listed, if -r is present
>
> Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Nice.
Both patches 1 and 2,
Acked-by: Shawn O. Pearce <spearce@spearce.org>
> ---
> contrib/completion/git-completion.bash | 19 ++++++++++++++++++-
> 1 files changed, 18 insertions(+), 1 deletions(-)
--
Shawn.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-05 5:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-04 18:00 [PATCH 1/2] bash: add git-branch options SZEDER Gábor
2008-03-04 18:00 ` [PATCH 2/2] bash: git-branch -d and -m lists only local branches SZEDER Gábor
2008-03-05 5:51 ` Shawn O. Pearce
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).