Given the following git-log
command:
git log --max-count=1 --format='format:%C(cyan)%GG'
Only the first line of the %GG
multiline placeholder value gets colorized. But I want to have the following text to be in the same color until the currently chosen color is reset by the next %C(...)
statement. How can I achieve this?
I'm using Git version 2.1.0 on Fedora Desktop 21.
One solution I came up with in the meantime is the following Bash script snippet:
function foobar {
local -r committish="${1:-HEAD}"
local -r tput_app="$(type -p tput)"
if [[ -n $tput_app ]]; then
local -r color_cyan="$("$tput_app" setaf 6)"
local line=''
while read -r line; do
printf '%s\n' "$color_cyan$line"
done < <(git log --max-count=1 --format='format:%GG' "$committish")
printf '%s\n' "$("$tput_app" sgr0)"
else
git log --max-count=1 --format='format:%GG' "$committish"
fi
}
This solution does not satisfy me because I generally prefer simple solutions to simple problems. But at least it works for me.