-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgit.expand
executable file
·31 lines (27 loc) · 1.61 KB
/
git.expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#------------------------------------------------------------------------------#
# vi: set sw=4 ts=4 ai: ("set modeline" in ~/.exrc) #
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
# V e r s i o n i n f o r m a t i o n #
#------------------------------------------------------------------------------#
# $Id:: git.expand 6 2011-03-09 14:16:37 tonk $: #
# $Revision:: 6 $: #
# $Author:: Ton Kersten <[email protected]> $: #
# $Date:: 2011-03-09 14:18:51 +0100 (Wed, 09 Mar 2011) $: #
# $Hash:: $: #
#------------------------------------------------------------------------------#
# E n d o f v e r s i o n i n f o r m a t i o n #
#------------------------------------------------------------------------------#
len="${GIT_LEN:-66}"
spc="$(printf "%80s" "")"
who=${SUDO_USER:-${LOGNAME}}
id1=$(git show -s --pretty=format:"%H (${who})")
id2=$(git show -s --pretty=format:"%h %ci (%an)")
id3=$(git show -s --pretty=format:"%h @%ct %aN%n")
id1s="${id1}${spc}"
id2s="${id2}${spc}"
id3s="${id3}${spc}"
sed -e 's!\([[:space:]]*\$[H]ash::\).*\$:!\1 '"${id1s:0:${len}}"'\$:!' \
-e 's!\([[:space:]]*\$[N]SId\).*\$!\1: '"${id2}"' \$!' \
-e 's!\([[:space:]]*\$[U]RL::\).*\$:!\1: '"${GIT_FNAME%% *} - ${id3}"' \$:!'