@matheusbsbs / matheus-bagliano / commits / 9a424b276c
Fork 0

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 <szeder@ira.uka.de> Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Dec 5, 2009 at 01:51 UTC 9a424b276c409a3510e7735b6ecc012f50dc2a49
1 file changed +21 -1
contrib/completion/git-completion.bash
+21 -1
@@ -896,11 +896,31 @@ _git_commit ()
896
897 local cur="${COMP_WORDS[COMP_CWORD]}"
898 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 + ;;
916 --*)
917 __gitcomp "
918 --all --author= --signoff --verify --no-verify
919 --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
924 "
925 return
926 esac