Skip to content

Commit 9a424b2

Browse files
szedergitster
authored andcommitted
bash: update 'git commit' completion
I just wanted to add the recently learnt '--reset-author' option, but then noticed that there are many more options missing. This patch adds support for all of 'git commit's options, except '--allow-empty', because it is primarily there for foreign scm interfaces. Furthermore, this patch also adds support for completing the arguments of those options that take a non-filename argument: valid modes are offered for '--cleanup' and '--untracked-files', while refs for '--reuse-message' and '--reedit-message', because these two take a commit as argument. Signed-off-by: SZEDER Gábor <[email protected]> Acked-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3880c18 commit 9a424b2

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

contrib/completion/git-completion.bash

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,11 +896,31 @@ _git_commit ()
896896

897897
local cur="${COMP_WORDS[COMP_CWORD]}"
898898
case "$cur" in
899+
--cleanup=*)
900+
__gitcomp "default strip verbatim whitespace
901+
" "" "${cur##--cleanup=}"
902+
return
903+
;;
904+
--reuse-message=*)
905+
__gitcomp "$(__git_refs)" "" "${cur##--reuse-message=}"
906+
return
907+
;;
908+
--reedit-message=*)
909+
__gitcomp "$(__git_refs)" "" "${cur##--reedit-message=}"
910+
return
911+
;;
912+
--untracked-files=*)
913+
__gitcomp "all no normal" "" "${cur##--untracked-files=}"
914+
return
915+
;;
899916
--*)
900917
__gitcomp "
901918
--all --author= --signoff --verify --no-verify
902919
--edit --amend --include --only --interactive
903-
--dry-run
920+
--dry-run --reuse-message= --reedit-message=
921+
--reset-author --file= --message= --template=
922+
--cleanup= --untracked-files --untracked-files=
923+
--verbose --quiet
904924
"
905925
return
906926
esac

0 commit comments

Comments
 (0)