blob: c7261675ff71cb3b782b27494d5384d36f2a8498 (
plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/sh
set -e
message="$1"
hostname=`hostname -f 2>/dev/null || hostname`
USER=
if [ -n "$SUDO_USER" ]; then
USER="$SUDO_USER"
else
# try to check tty ownership, in case user su'd to root
TTY="$(tty 2>/dev/null || true)"
if [ -n "$TTY" ] && [ -c "$TTY" ]; then
USER="$(find "$TTY" -printf "%u")"
fi
fi
if [ "$VCS" = git ] && [ -d .git ]; then
if [ -n "$USER" ]; then
export GIT_COMMITTER_NAME="$USER"
export GIT_COMMITTER_EMAIL="$USER@$hostname"
fi
if [ -n "$message" ]; then
git commit $GIT_COMMIT_OPTIONS -m "$message"
else
git commit $GIT_COMMIT_OPTIONS
fi
elif [ "$VCS" = hg ] && [ -d .hg ]; then
if [ -n "$USER" ]; then
export LOGNAME="$USER"
fi
if [ -n "$message" ]; then
hg commit $HG_COMMIT_OPTIONS -m "$message"
else
hg commit $HG_COMMIT_OPTIONS
fi
elif [ "$VCS" = bzr ] && [ -d .bzr ]; then
if [ -n "$USER" ]; then
export EMAIL="$USER <$USER@$hostname>"
BZR_AUTHOR='--author="root <root@$hostname>"'
fi
if [ -n "$message" ]; then
bzr commit "$BZR_AUTHOR" $BZR_COMMIT_OPTIONS -m "$message"
else
bzr commit "$BZR_AUTHOR" $BZR_COMMIT_OPTIONS
fi
elif [ "$VCS" = darcs ] && [ -d _darcs ]; then
if [ -n "$USER" ]; then
USER=root
fi
if [ -n "$message" ]; then
darcs record --author="$USER" $DARCS_COMMIT_OPTIONS -m "$message"
else
darcs record --author="$USER" $DARCS_COMMIT_OPTIONS
fi
unset logfile
fi
|