git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 5/5] bash: refactor 'git log --pretty=<format>' options

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Jan 16, 2009, 16:02 UTC
Message-ID
<1232121735-10239-1-git-send-email-szeder@ira.uka.de>

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>
---
 contrib/completion/git-completion.bash |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 3a26d2b..b5b40c2 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -947,6 +947,8 @@ _git_ls_tree ()
 	__git_complete_file
 }
 
+__git_log_pretty_formats="oneline short medium full fuller email raw format:"
+
 _git_log ()
 {
 	__git_has_doubledash && return
@@ -954,8 +956,7 @@ _git_log ()
 	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
 		;;
@@ -1487,8 +1488,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
 		;;
-- 
1.6.1.198.geb475f
Next: Shawn O. Pearce
Message 1 of 2 in “bash: refactor 'git log --pretty=<format>' options”
  1. 5/5 bash: refactor 'git log --pretty=<format>' optionsSZEDER Gábor, Jan 16, 2009
  2. Shawn O. PearceJan 16, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.