|
@@ -4,8 +4,8 @@
|
4
|
4
|
# Slurp - add everything, slurp into a WIP commit and push
|
5
|
5
|
#
|
6
|
6
|
|
7
|
|
-test -f .git-slurp-ok || {
|
8
|
|
- echo "you don't want this." >&2
|
|
7
|
+die() {
|
|
8
|
+ echo "$@" >&2
|
9
|
9
|
exit 2
|
10
|
10
|
}
|
11
|
11
|
|
|
@@ -18,6 +18,34 @@ mkmsg() {
|
18
|
18
|
echo "WIP slurp, $date at $host"
|
19
|
19
|
}
|
20
|
20
|
|
21
|
|
-git add .
|
22
|
|
-git commit -m "$(mkmsg)"
|
23
|
|
-git push
|
|
21
|
+allowed_anything() {
|
|
22
|
+ #
|
|
23
|
+ # Is anything allowed in this repo?
|
|
24
|
+ #
|
|
25
|
+ test -f "$ok_file"
|
|
26
|
+}
|
|
27
|
+
|
|
28
|
+allowed_push() {
|
|
29
|
+ #
|
|
30
|
+ # Is push allowed in this repo?
|
|
31
|
+ #
|
|
32
|
+ grep -qxF PUSH "$ok_file"
|
|
33
|
+}
|
|
34
|
+
|
|
35
|
+main() {
|
|
36
|
+ local git_root
|
|
37
|
+ local ok_file
|
|
38
|
+ local want_push=false
|
|
39
|
+
|
|
40
|
+ git_root="$(git rev-parse --show-toplevel)" || die
|
|
41
|
+ ok_file="$git_root/.git-slurp-ok"
|
|
42
|
+
|
|
43
|
+ allowed_anything || die "you don't want this."
|
|
44
|
+ allowed_push && want_push=true
|
|
45
|
+
|
|
46
|
+ git add .
|
|
47
|
+ git commit -m "$(mkmsg)"
|
|
48
|
+ $want_push && git push
|
|
49
|
+}
|
|
50
|
+
|
|
51
|
+main
|