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

[PATCH] bash: support pretty format aliases

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Oct 10, 2010, 21:34 UTC
Message-ID
<1286746461-7338-1-git-send-email-szeder@ira.uka.de>

Users can have their own pretty format aliases since 8028184 (pretty: add aliases for pretty formats, 2010-05-02), so let's offer those after '--pretty=', too.

Similar to the completion of aliases, this will invoke 'git config' each time pretty aliases needs to be completed, so changes in pretty.* configuration will be reflected immediately.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6756990..3022213 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1368,7 +1368,16 @@ _git_log ()
 	fi
 	case "$cur" in
 	--pretty=*)
-		__gitcomp "$__git_log_pretty_formats
+		local pretty_aliases
+		for i in $(git --git-dir="$(__gitdir)" config --get-regexp "pretty\..*" 2>/dev/null); do
+			case "$i" in
+			pretty.*)
+				i="${i#pretty.}"
+				pretty_aliases="$pretty_aliases ${i/ */}"
+				;;
+			esac
+		done
+		__gitcomp "$__git_log_pretty_formats $pretty_aliases
 			" "" "${cur##--pretty=}"
 		return
 		;;
-- 
1.7.3.1.148.g2fffa
Next: Jonathan Nieder
Message 1 of 8 in “bash: support pretty format aliases”
  1. bash: support pretty format aliasesSZEDER Gábor, Oct 10, 2010
  2. Jonathan NiederOct 10, 2010
  3. bash: support pretty format aliasesSZEDER Gábor, Oct 10, 2010
  4. SZEDER GáborOct 14, 2010
  5. 1/2 bash: add helper function to get config variables for completionSZEDER Gábor, Oct 14, 2010
  6. Jonathan NiederOct 14, 2010
  7. SZEDER GáborOct 20, 2010
  8. 2/2 bash: support pretty format aliasesSZEDER Gábor, Oct 14, 2010

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.