Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 40 lines (34 sloc) 1.189 kb
d5f88bc @masylum gary bernhardization
authored
1 #!/bin/bash
2
3 # Log output:
4 #
5 # * 51c333e (12 days) <Gary Bernhardt> add vim-eunuch
6 #
7 # The time massaging regexes start with ^[^<]* because that ensures that they
8 # only operate before the first "<". That "<" will be the beginning of the
9 # author name, ensuring that we don't destroy anything in the commit message
10 # that looks like time.
11 #
12 # The log format uses } characters between each field, and `column` is later
13 # used to split on them. A } in the commit subject or any other field will
14 # break this.
15
16 HASH="%C(yellow)%h%Creset"
17 RELATIVE_TIME="%Cgreen(%ar)%Creset"
18 AUTHOR="%C(bold blue)<%an>%Creset"
19 REFS="%C(red)%d%Creset"
20 SUBJECT="%s"
21
22 FORMAT="$HASH}$RELATIVE_TIME}$AUTHOR}$REFS $SUBJECT"
23
24 show_git_head() {
25 pretty_git_log -1
26 git show -p --pretty="tformat:"
27 }
28
29 pretty_git_log() {
30 git log --graph --pretty="tformat:${FORMAT}" $* |
31 # Replace (2 years ago) with (2 years)
32 sed -Ee 's/(^[^<]*) ago)/\1)/' |
33 # Replace (2 years, 5 months) with (2 years)
34 sed -Ee 's/(^[^<]*), [[:digit:]]+ .*months?)/\1)/' |
35 # Line columns up based on } delimiter
36 column -s '}' -t |
37 # Page only if we need to
38 less -FXRS
39 }
Something went wrong with that request. Please try again.