Teach git-completion about git p4
PATCH 1/1 Teach git-completion about git p4
From: Ryan Cumming <[email protected]>
git p4 was moved out of contrib in 1.7.11 but it git-completion didn't know about it. Add git p4 completion based on the existing SVN completion. It covers all known subcommands and options except for the -/ option for clone which doesn't use the standard -- prefix.
--- contrib/completion/git-completion.bash | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
contrib/completion/git-completion.bash +44 -0
@@ -1459,6 +1459,50 @@ _git_notes () esac } +_git_p4 () +{ + local subcommands=" + clone sync rebase submit + " + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + local common_opts="--git-dir= --verbose" + local sync_opts=" + --branch= --detect-branches --changes-file= + --silent --detect-labels --import-labels + --import-local --max-changes= --keep-path + --use-client-spec $common_opts + " + local clone_opts=" + --destination= --bare $sync_opts + " + local submit_opts=" + --origin= -M --preserve-user --export-labels + $common_opts + " + + case "$subcommand,$cur" in + clone,--*) + __gitcomp "$clone_opts" + ;; + sync,--*) + __gitcomp "$sync_opts" + ;; + rebase,--*) + __gitcomp "$common_opts --import-labels" + ;; + submit,--*) + __gitcomp "$submit_opts" + ;; + submit,*) + __gitcomp "$(__git_refs)" + ;; + esac + fi +} + _git_pull () { __git_complete_strategy && return
Signature · 1 line
1.7.12.1
Quoted 9 lines · Ryan Cumming
From: Ryan Cumming <[email protected]>
git p4 was moved out of contrib in 1.7.11 but it git-completion didn't know about it. Add git p4 completion based on the existing SVN completion. It covers all known subcommands and options except for the -/ option for clone which doesn't use the standard -- prefix.
Signed-off-by Ryan Cumming <[email protected]>---
Sounds sensible; thanks.
contrib/completion/git-completion.bash _git_notes () · line 1497
Quoted 12 lines
contrib/completion/git-completion.bash +11
-0+_git_p4 () +{ +... + local submit_opts=" + --origin= -M --preserve-user --export-labels + $common_opts + " + + case "$subcommand,$cur" in + submit,--*) + __gitcomp "$submit_opts"
This is taken when $cur begins with --, but $submit_opts includes "-M" which doesn't begin with it. Is that a problem?
Quoted 7 lines
contrib/completion/git-completion.bash +7
-0+ ;; + submit,*) + __gitcomp "$(__git_refs)" + ;; + esac + fi +}
[email protected] wrote on Fri, 21 Sep 2012 14:51 -0700:
Quoted 4 lines
git p4 was moved out of contrib in 1.7.11 but it git-completion didn't know about it. Add git p4 completion based on the existing SVN completion. It covers all known subcommands and options except for the -/ option for clone which doesn't use the standard -- prefix.
Very nice, thank you. A couple nits.
contrib/completion/git-completion.bash _git_notes () · line 1473
Quoted 12 lines
contrib/completion/git-completion.bash +12
-0+_git_p4 () +{ + local subcommands=" + clone sync rebase submit + " + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + local common_opts="--git-dir= --verbose" + local sync_opts=" + --branch= --detect-branches --changes-file=
It's --changesfile (no dash), weird, but true.
contrib/completion/git-completion.bash _git_notes () · line 1484
Quoted 11 lines
contrib/completion/git-completion.bash +11
-0+ --silent --detect-labels --import-labels + --import-local --max-changes= --keep-path + --use-client-spec $common_opts + " + local clone_opts=" + --destination= --bare $sync_opts + " + local submit_opts=" + --origin= -M --preserve-user --export-labels + $common_opts + "
Very recently we added --dry-run and --prepare-p4-only and --conflict to submit. Follow 8db3865^2 to see the patches for those.
contrib/completion/git-completion.bash _git_notes () · line 1494
Quoted 9 lines
contrib/completion/git-completion.bash +9
-0+ case "$subcommand,$cur" in + clone,--*) + __gitcomp "$clone_opts" + ;; + sync,--*) + __gitcomp "$sync_opts" + ;; + rebase,--*) + __gitcomp "$common_opts --import-labels"
This would be prettier if it had its own local rebase_opts.
Quoted 21 lines
contrib/completion/git-completion.bash +10
-0+ submit,--*) + __gitcomp "$submit_opts" + ;; + submit,*) + __gitcomp "$(__git_refs)" + ;; + esac + fi +} + _git_pull () { __git_complete_strategy && returnSignature · 6 lines
1.7.12.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html