Commit 6131807
git-completion.bash: use __gitcomp_builtin() in _git_stash()
The completion for 'git stash' has not changed in a major way since it
was converted from shell script to builtin. Now that it's a builtin, we
can take advantage of the groundwork laid out by parse-options and use
the generated options.
Rewrite _git_stash() to take use __gitcomp_builtin() to generate
completions for subcommands.
The main `git stash` command does not take any arguments directly. If no
subcommand is given, it automatically defaults to `git stash push`. This
means that we can simplify the logic for when no subcommands have been
given yet. We only have to offer subcommand completions when we're
completing a non-option after "stash".
One area that this patch could improve upon is that the `git stash list`
command accepts log-options. It would be nice if the completion for this
were unified with that of _git_log() and _git_show() which would allow
completions to be provided for options such as `--pretty` but that is
outside the scope of this patch.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 42b30bc commit 6131807
1 file changed
+20
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3013 | 3013 | | |
3014 | 3014 | | |
3015 | 3015 | | |
3016 | | - | |
3017 | 3016 | | |
3018 | 3017 | | |
3019 | | - | |
3020 | | - | |
3021 | | - | |
| 3018 | + | |
3022 | 3019 | | |
3023 | | - | |
3024 | | - | |
3025 | | - | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
3026 | 3023 | | |
3027 | | - | |
3028 | | - | |
3029 | | - | |
3030 | | - | |
| 3024 | + | |
| 3025 | + | |
3031 | 3026 | | |
3032 | | - | |
3033 | | - | |
3034 | | - | |
3035 | | - | |
| 3027 | + | |
| 3028 | + | |
3036 | 3029 | | |
3037 | 3030 | | |
3038 | 3031 | | |
3039 | 3032 | | |
3040 | 3033 | | |
3041 | 3034 | | |
3042 | 3035 | | |
3043 | | - | |
| 3036 | + | |
3044 | 3037 | | |
3045 | 3038 | | |
3046 | | - | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
3047 | 3043 | | |
3048 | | - | |
3049 | | - | |
| 3044 | + | |
| 3045 | + | |
3050 | 3046 | | |
3051 | 3047 | | |
3052 | | - | |
| 3048 | + | |
3053 | 3049 | | |
3054 | 3050 | | |
3055 | | - | |
| 3051 | + | |
| 3052 | + | |
3056 | 3053 | | |
3057 | 3054 | | |
3058 | | - | |
| 3055 | + | |
3059 | 3056 | | |
3060 | 3057 | | |
| 3058 | + | |
3061 | 3059 | | |
3062 | 3060 | | |
3063 | 3061 | | |
| |||
0 commit comments