123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #!/bin/bash
-
- #
- # Slurp - add everything, slurp into a WIP commit and push
- #
-
- die() {
- echo "$@" >&2
- exit 2
- }
-
- mkmsg() {
- #
- # Create the slurp message
- #
- local host=$(hostname)
- local date=$(date -Isec)
- echo "WIP slurp, $date at $host"
- }
-
- allowed_anything() {
- #
- # Is anything allowed in this repo?
- #
- test -f "$ok_file"
- }
-
- allowed_push() {
- #
- # Is push allowed in this repo?
- #
- grep -qxF PUSH "$ok_file"
- }
-
- main() {
- local git_root
- local ok_file
- local want_push=false
-
- git_root="$(git rev-parse --show-toplevel)" || die
- ok_file="$git_root/.git-slurp-ok"
-
- allowed_anything || die "you don't want this."
- allowed_push && want_push=true
-
- git add .
- git commit -m "$(mkmsg)"
- if $want_push;
- then
- git push
- fi
- }
-
- main
|