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

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

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

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