summaryrefslogtreecommitdiff
path: root/git-lg
blob: a078a5323f73c338fc2365c808d5b756ab02dd93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

width=$((`tput cols` - 29))
width2=$(($width - 2))

if tty -s <&1; then
	PRETTY='--pretty=format:%Cred%h %Creset %s%x00%Cgreen%cd%x00%C(bold black)%an%Creset%C(yellow)%d'
else
	PRETTY='--pretty=format:%h  %s%x00%cd%x00%an%d'
fi

exec	git log --abbrev-commit --date=relative --graph "$PRETTY" "$@"	\
	|gawk --re-interval -F '\\0'					\
		'{ printf "%-'$width's%18s %s\n", gensub(/^(.{'$width2'}).{2,}$/, "\\1… ", 1, $1), $2, $3 }' \
	|less -R