* [PATCH 1/2] completion: handle unstuck form of base git options
@ 2013-06-22 11:25 John Keeping
2013-06-22 11:25 ` [PATCH 2/2] completion: learn about --man-path John Keeping
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: John Keeping @ 2013-06-22 11:25 UTC (permalink / raw)
To: git; +Cc: SZEDER Gábor, John Keeping
git-completion.bash's parsing of the command name relies on everything
preceding it starting with '-' unless it is the "-c" option. This
allows users to use the stuck form of "--work-tree=<path>" and
"--namespace=<path>" but not the unstuck forms "--work-tree <path>" and
"--namespace <path>". Fix this.
Similarly, the completion only handles the stuck form "--git-dir=<path>"
and not "--git-dir <path>", so fix this as well.
Signed-off-by: John Keeping <john@keeping.me.uk>
---
contrib/completion/git-completion.bash | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6c3bafe..8fbf941 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2492,9 +2492,10 @@ __git_main ()
i="${words[c]}"
case "$i" in
--git-dir=*) __git_dir="${i#--git-dir=}" ;;
+ --git-dir) ((c++)) ; __git_dir="${words[c]}" ;;
--bare) __git_dir="." ;;
--help) command="help"; break ;;
- -c) c=$((++c)) ;;
+ -c|--work-tree|--namespace) ((c++)) ;;
-*) ;;
*) command="$i"; break ;;
esac
--
1.8.3.1.676.gaae6535
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] completion: learn about --man-path
2013-06-22 11:25 [PATCH 1/2] completion: handle unstuck form of base git options John Keeping
@ 2013-06-22 11:25 ` John Keeping
2013-06-30 11:41 ` SZEDER Gábor
2013-06-22 12:30 ` [PATCH 1/2] completion: handle unstuck form of base git options SZEDER Gábor
2013-06-28 8:20 ` John Keeping
2 siblings, 1 reply; 7+ messages in thread
From: John Keeping @ 2013-06-22 11:25 UTC (permalink / raw)
To: git; +Cc: SZEDER Gábor, John Keeping
Signed-off-by: John Keeping <john@keeping.me.uk>
---
contrib/completion/git-completion.bash | 2 ++
t/t9902-completion.sh | 1 +
2 files changed, 3 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8fbf941..c3290af 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2513,11 +2513,13 @@ __git_main ()
--exec-path
--exec-path=
--html-path
+ --man-path
--info-path
--work-tree=
--namespace=
--no-replace-objects
--help
+ -c
"
;;
*) __git_compute_porcelain_commands
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 81a1657..14d605a 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -231,6 +231,7 @@ test_expect_success 'double dash "git" itself' '
--exec-path Z
--exec-path=
--html-path Z
+ --man-path Z
--info-path Z
--work-tree=
--namespace=
--
1.8.3.1.676.gaae6535
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] completion: handle unstuck form of base git options
2013-06-22 11:25 [PATCH 1/2] completion: handle unstuck form of base git options John Keeping
2013-06-22 11:25 ` [PATCH 2/2] completion: learn about --man-path John Keeping
@ 2013-06-22 12:30 ` SZEDER Gábor
2013-06-22 12:35 ` SZEDER Gábor
2013-06-28 8:20 ` John Keeping
2 siblings, 1 reply; 7+ messages in thread
From: SZEDER Gábor @ 2013-06-22 12:30 UTC (permalink / raw)
To: John Keeping; +Cc: git
Hi,
On Sat, Jun 22, 2013 at 12:25:17PM +0100, John Keeping wrote:
> git-completion.bash's parsing of the command name relies on everything
> preceding it starting with '-' unless it is the "-c" option. This
> allows users to use the stuck form of "--work-tree=<path>" and
> "--namespace=<path>" but not the unstuck forms "--work-tree <path>" and
> "--namespace <path>". Fix this.
I never use these commands, so I looked up what --namespace means.
While doing so I noticed that --exec-path takes a path just like these
options, so that option should be handled similarly as well.
Otherwise it makes sense.
Gábor
> Similarly, the completion only handles the stuck form "--git-dir=<path>"
> and not "--git-dir <path>", so fix this as well.
>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
> contrib/completion/git-completion.bash | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 6c3bafe..8fbf941 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2492,9 +2492,10 @@ __git_main ()
> i="${words[c]}"
> case "$i" in
> --git-dir=*) __git_dir="${i#--git-dir=}" ;;
> + --git-dir) ((c++)) ; __git_dir="${words[c]}" ;;
> --bare) __git_dir="." ;;
> --help) command="help"; break ;;
> - -c) c=$((++c)) ;;
> + -c|--work-tree|--namespace) ((c++)) ;;
> -*) ;;
> *) command="$i"; break ;;
> esac
> --
> 1.8.3.1.676.gaae6535
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] completion: handle unstuck form of base git options
2013-06-22 12:30 ` [PATCH 1/2] completion: handle unstuck form of base git options SZEDER Gábor
@ 2013-06-22 12:35 ` SZEDER Gábor
0 siblings, 0 replies; 7+ messages in thread
From: SZEDER Gábor @ 2013-06-22 12:35 UTC (permalink / raw)
To: John Keeping; +Cc: git
On Sat, Jun 22, 2013 at 02:30:33PM +0200, SZEDER Gábor wrote:
> Hi,
>
> On Sat, Jun 22, 2013 at 12:25:17PM +0100, John Keeping wrote:
> > git-completion.bash's parsing of the command name relies on everything
> > preceding it starting with '-' unless it is the "-c" option. This
> > allows users to use the stuck form of "--work-tree=<path>" and
> > "--namespace=<path>" but not the unstuck forms "--work-tree <path>" and
> > "--namespace <path>". Fix this.
>
> I never use these commands, so I looked up what --namespace means.
> While doing so I noticed that --exec-path takes a path just like these
> options, so that option should be handled similarly as well.
Never mind, I misunderstood the docs: --exec-path either takes a path
as --exec-path=<path> or it doesn't take one at all, but there is no
'--exec-path <path>'.
Gábor
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] completion: handle unstuck form of base git options
2013-06-22 11:25 [PATCH 1/2] completion: handle unstuck form of base git options John Keeping
2013-06-22 11:25 ` [PATCH 2/2] completion: learn about --man-path John Keeping
2013-06-22 12:30 ` [PATCH 1/2] completion: handle unstuck form of base git options SZEDER Gábor
@ 2013-06-28 8:20 ` John Keeping
2 siblings, 0 replies; 7+ messages in thread
From: John Keeping @ 2013-06-28 8:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, SZEDER Gábor
Hi Junio, I don't think you've picked this up. Are you expecting a
re-roll or did it just get lost in the noise?
On Sat, Jun 22, 2013 at 12:25:17PM +0100, John Keeping wrote:
> git-completion.bash's parsing of the command name relies on everything
> preceding it starting with '-' unless it is the "-c" option. This
> allows users to use the stuck form of "--work-tree=<path>" and
> "--namespace=<path>" but not the unstuck forms "--work-tree <path>" and
> "--namespace <path>". Fix this.
>
> Similarly, the completion only handles the stuck form "--git-dir=<path>"
> and not "--git-dir <path>", so fix this as well.
>
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
> contrib/completion/git-completion.bash | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 6c3bafe..8fbf941 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2492,9 +2492,10 @@ __git_main ()
> i="${words[c]}"
> case "$i" in
> --git-dir=*) __git_dir="${i#--git-dir=}" ;;
> + --git-dir) ((c++)) ; __git_dir="${words[c]}" ;;
> --bare) __git_dir="." ;;
> --help) command="help"; break ;;
> - -c) c=$((++c)) ;;
> + -c|--work-tree|--namespace) ((c++)) ;;
> -*) ;;
> *) command="$i"; break ;;
> esac
> --
> 1.8.3.1.676.gaae6535
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] completion: learn about --man-path
2013-06-22 11:25 ` [PATCH 2/2] completion: learn about --man-path John Keeping
@ 2013-06-30 11:41 ` SZEDER Gábor
2013-06-30 22:59 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: SZEDER Gábor @ 2013-06-30 11:41 UTC (permalink / raw)
To: John Keeping, Junio C Hamano; +Cc: git
Hi,
On Sat, Jun 22, 2013 at 12:25:18PM +0100, John Keeping wrote:
> Signed-off-by: John Keeping <john@keeping.me.uk>
> ---
> contrib/completion/git-completion.bash | 2 ++
> t/t9902-completion.sh | 1 +
> 2 files changed, 3 insertions(+)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 8fbf941..c3290af 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2513,11 +2513,13 @@ __git_main ()
> --exec-path
> --exec-path=
> --html-path
> + --man-path
> --info-path
> --work-tree=
> --namespace=
> --no-replace-objects
> --help
> + -c
There are a couple of issues with this '-c' here:
- We normally offer only --long-options in the completion script.
- The log message doesn't mention it.
- And finally the most important: it will never be offered for
completion. This is the condition of this case branch:
case "$cur" in
--*) __gitcomp "
i.e. this case branch is executed only when the current word on the
command line begins with '--', but then '-c' will never match.
Without the '-c' part it's "obviously correct" and together with patch
1/2 is
Acked-by: SZEDER Gábor <szeder@ira.uka.de>
> "
> ;;
> *) __git_compute_porcelain_commands
> diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
> index 81a1657..14d605a 100755
> --- a/t/t9902-completion.sh
> +++ b/t/t9902-completion.sh
> @@ -231,6 +231,7 @@ test_expect_success 'double dash "git" itself' '
> --exec-path Z
> --exec-path=
> --html-path Z
> + --man-path Z
> --info-path Z
> --work-tree=
> --namespace=
> --
> 1.8.3.1.676.gaae6535
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] completion: learn about --man-path
2013-06-30 11:41 ` SZEDER Gábor
@ 2013-06-30 22:59 ` Junio C Hamano
0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2013-06-30 22:59 UTC (permalink / raw)
To: SZEDER Gábor; +Cc: John Keeping, git
SZEDER Gábor <szeder@fzi.de> writes:
> Without the '-c' part it's "obviously correct" and together with patch
> 1/2 is
>
> Acked-by: SZEDER Gábor <szeder@ira.uka.de>
Thanks, both. Will queue.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-06-30 22:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-22 11:25 [PATCH 1/2] completion: handle unstuck form of base git options John Keeping
2013-06-22 11:25 ` [PATCH 2/2] completion: learn about --man-path John Keeping
2013-06-30 11:41 ` SZEDER Gábor
2013-06-30 22:59 ` Junio C Hamano
2013-06-22 12:30 ` [PATCH 1/2] completion: handle unstuck form of base git options SZEDER Gábor
2013-06-22 12:35 ` SZEDER Gábor
2013-06-28 8:20 ` John Keeping
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).