bash: refactor 'git log --pretty=<format>' options
Both 'git log' and 'show' have the same '--pretty=<format>' option with the same formats. So refactor these formats into a common variable. While at it, also add 'format:' to the list. 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
Jan 16, 2009 at 17:02 UTC
3d279863dedf6c07eefe307b27fb3a08e519140f
1 file changed
+4
-4
contrib/completion/git-completion.bash
+4
-4
@@ -947,6 +947,8 @@ _git_ls_tree ()
947
__git_complete_file
948
}
949
950
+__git_log_pretty_formats="oneline short medium full fuller email raw format:"
951
+
952
_git_log ()
953
{
954
__git_has_doubledash && return
@@ -954,8 +956,7 @@ _git_log ()
956
local cur="${COMP_WORDS[COMP_CWORD]}"
957
case "$cur" in
958
--pretty=*)
957
- __gitcomp "
958
- oneline short medium full fuller email raw
959
+ __gitcomp "$__git_log_pretty_formats
960
" "" "${cur##--pretty=}"
961
return
962
;;
@@ -1483,8 +1484,7 @@ _git_show ()
1484
local cur="${COMP_WORDS[COMP_CWORD]}"
1485
case "$cur" in
1486
--pretty=*)
1486
- __gitcomp "
1487
- oneline short medium full fuller email raw
1487
+ __gitcomp "$__git_log_pretty_formats
1488
" "" "${cur##--pretty=}"
1489
return
1490
;;