Skip to content

Commit

Permalink
bash: refactor 'git log --pretty=<format>' options
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
SZEDER Gábor authored and Junio C Hamano committed Jan 18, 2009
1 parent 8108513 commit 3d27986
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -947,15 +947,16 @@ _git_ls_tree ()
__git_complete_file
}

__git_log_pretty_formats="oneline short medium full fuller email raw format:"

_git_log ()
{
__git_has_doubledash && return

local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--pretty=*)
__gitcomp "
oneline short medium full fuller email raw
__gitcomp "$__git_log_pretty_formats
" "" "${cur##--pretty=}"
return
;;
Expand Down Expand Up @@ -1483,8 +1484,7 @@ _git_show ()
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
--pretty=*)
__gitcomp "
oneline short medium full fuller email raw
__gitcomp "$__git_log_pretty_formats
" "" "${cur##--pretty=}"
return
;;
Expand Down

0 comments on commit 3d27986

Please sign in to comment.