-
Notifications
You must be signed in to change notification settings - Fork 8
/
commit
executable file
·41 lines (35 loc) · 848 Bytes
/
commit
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
#! /bin/sh
# commit (Bourne shell script) -- revision control swiss army knife
#
# TO-DO: pass git options
# TO-DO: support partial commits, i.e. don't run "git add -A"; instead, run "git status" then ask to continue
SELF=$(basename "$0")
fn()
{
set -e
if [ -d .git ] ; then
git add -A
git commit
git push
elif [ -d .svn ] ; then
# svn supports permanent adds so assume that it has been done
## svn add *
svn ci
else
echo "$SELF: WARNING: no revision control directory found in $PWD" >&2
fi
}
# *** MAINLINE ***
if [ -n "$1" ] ; then
# Process each argument by recursively calling this script
for dir do
if [ -d "$dir" ] ; then
(set -e ; cd "$dir" ; "$0")
else
echo "$SELF: ERROR: '$dir' isn't a directory" >&2
fi
done
else
# No arguments so just get the job done
fn
fi