Signed-off-by: Thomas Braun <redacted>
---
contrib/completion/git-completion.bash | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index addea89..77343da 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1782,6 +1782,35 @@ _git_stage ()
_git_add
}
+_git_status ()
+{
+ case "$cur" in
+ --ignore-submodules=*)
+ __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
+ return
+ ;;
+ --untracked-files=*)
+ __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
+ return
+ ;;
+ --column=*)
+ __gitcomp "
+ always never auto column row plain dense nodense
+ " "" "${cur##--column=}"
+ return
+ ;;
+ --*)
+ __gitcomp "
+ --short --branch --porcelain --long --verbose
+ --untracked-files= --ignore-submodules= --ignored
+ --column= --no-column
+ "
+ return
+ ;;
+ esac
+ __git_complete_file
+}
+
__git_config_get_set_variables ()
{
local prevword word config_file= c=$cword
Quoting Thomas Braun [off-list ref]:
quoted hunk
Signed-off-by: Thomas Braun <redacted>
---
contrib/completion/git-completion.bash | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index addea89..77343da 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1782,6 +1782,35 @@ _git_stage ()
_git_add
}
+_git_status ()
+{
+ case "$cur" in
+ --ignore-submodules=*)
+ __gitcomp "none untracked dirty all" "" "${cur##--ignore-submodules=}"
+ return
+ ;;
+ --untracked-files=*)
+ __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
+ return
+ ;;
+ --column=*)
+ __gitcomp "
+ always never auto column row plain dense nodense
+ " "" "${cur##--column=}"
+ return
+ ;;
+ --*)
+ __gitcomp "
+ --short --branch --porcelain --long --verbose
+ --untracked-files= --ignore-submodules= --ignored
+ --column= --no-column
+ "
+ return
+ ;;
+ esac
+ __git_complete_file
__git_complete_file()'s job is to complete the '<rev>:<path>' notation,
e.g. 'master:Mak<TAB>', which is not what we want here, because this
notation doesn't make sense for 'git status' and because 'git status
<TAB>' would then offer refs instead of files.
I think there are two choices what to do instead:
- Don't do anything :) Bash will then fall back to filename
completion, which is quite close to what we want here (and in this
case the return statements from the other case arms can go away as
well). The drawback is that all ignored files in the current
working directory will show up after 'git status <TAB>'.
- use __git_complete_index_file() with appropriate options, perhaps
'--cached --others', but I didn't think this through. For bonus
points pass additional options when certain 'git status' options are
already present on the command line, e.g. pass '--ignored', too, if
it is present.
quoted hunk
+}
+
__git_config_get_set_variables ()
{
local prevword word config_file= c=$cword
Am 01.06.2016 um 14:15 schrieb SZEDER Gábor:
Quoting Thomas Braun [off-list ref]:
quoted
Signed-off-by: Thomas Braun <redacted>
---
contrib/completion/git-completion.bash | 29
+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/contrib/completion/git-completion.bash
b/contrib/completion/git-completion.bash
index addea89..77343da 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1782,6 +1782,35 @@ _git_stage ()
_git_add
}
+_git_status ()
+{
+ case "$cur" in
+ --ignore-submodules=*)
+ __gitcomp "none untracked dirty all" """${cur##--ignore-submodules=}"
+ return
+ ;;
+ --untracked-files=*)
+ __gitcomp "$__git_untracked_file_modes" ""
"${cur##--untracked-files=}"
+ return
+ ;;
+ --column=*)
+ __gitcomp "
+ always never auto column row plain dense nodense
+ " "" "${cur##--column=}"
+ return
+ ;;
+ --*)
+ __gitcomp "
+ --short --branch --porcelain --long --verbose
+ --untracked-files= --ignore-submodules= --ignored
+ --column= --no-column
+ "
+ return
+ ;;
+ esac
+ __git_complete_file
__git_complete_file()'s job is to complete the '<rev>:<path>' notation,
e.g. 'master:Mak<TAB>', which is not what we want here, because this
notation doesn't make sense for 'git status' and because 'git status
<TAB>' would then offer refs instead of files.
Correct. I might have been mislead by the name ;)
I think there are two choices what to do instead:
- Don't do anything :) Bash will then fall back to filename
completion, which is quite close to what we want here (and in this
case the return statements from the other case arms can go away as
well). The drawback is that all ignored files in the current
working directory will show up after 'git status <TAB>'.
- use __git_complete_index_file() with appropriate options, perhaps
'--cached --others', but I didn't think this through. For bonus
points pass additional options when certain 'git status' options are
already present on the command line, e.g. pass '--ignored', too, if
it is present.
I went for the bonus points way. If that is too involved I can also go
back to "Don't do anything".
Signed-off-by: Thomas Braun <redacted>
---
contrib/completion/git-completion.bash | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3402475..addea89 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1098,6 +1098,8 @@ _git_clone ()
esac
}
+__git_untracked_file_modes="all no normal"
+
_git_commit ()
{
case "$prev" in@@ -1119,7 +1121,7 @@ _git_commit ()
return
;;
--untracked-files=*)
- __gitcomp "all no normal" "" "${cur##--untracked-files=}"
+ __gitcomp "$__git_untracked_file_modes" "" "${cur##--untracked-files=}"
return
;;
--*)