[GUILT] handle branches with slashes in guilt-graph
[guilt.git] / os.Linux
blob30b9cb0a462839628ebc23d81b07f233add88ba0
1 # usage: touch_date <unix ts> <file>
2 touch_date()
4         touch -d @$1 "$2"
7 # usage: last_modified <file>
8 last_modified()
10         stat -c "%Y" "$1"
13 # usage: format_last_modified <file>
14 format_last_modified()
16         # must strip nano-second part otherwise git gets very
17         # confused, and makes up strange timestamps from the past
18         # (chances are it decides to interpret it as a unix
19         # timestamp).
20         stat -c "%y" "$1" | sed -e '
21 s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\([0-9]\{2\}\)\.[0-9]* \(.*\)$/\1-\2-\3 \4:\5:\6 \7/'
24 # usage: head_n [count]
25 head_n()
27         head -n "$1"
30 # usage: sha1 [file]
31 sha1()
33         sha1sum "$1"
36 # usage: cp_a <src> <dst>
37 cp_a()
39         cp -a "$1" "$2"
42 # usage: _tac
43 _tac()
45         tac
48 _seq()
50         seq "$@"
51         return $?