summaryrefslogtreecommitdiff
path: root/pbs-package-commit
diff options
context:
space:
mode:
Diffstat (limited to 'pbs-package-commit')
-rwxr-xr-xpbs-package-commit41
1 files changed, 41 insertions, 0 deletions
diff --git a/pbs-package-commit b/pbs-package-commit
new file mode 100755
index 0000000..54e944f
--- /dev/null
+++ b/pbs-package-commit
@@ -0,0 +1,41 @@
+#!/bin/bash -euE
+
+. $(which libremessages)
+
+cmd=${0##*/}
+usage() {
+ echo "Usage: $cmd [git-commit OPTIONS]"
+ echo 'Commits to a package (run from the package directory).'
+ echo ''
+ echo 'This is the same as `git commit`, but cascades up out of the'
+ echo 'submodule.'
+ echo ''
+ echo 'Options:'
+ echo ' -h Show this message'
+ echo ''
+ echo ' ====================== `git commit` usage ======================'
+ echo ''
+ git commit -h
+}
+
+main() {
+ if in_array '-h' "$@"; then
+ usage
+ return 0
+ fi
+
+ if [[ ! -f .git ]]; then
+ error "Must be in a package directory"
+ return 1
+ fi
+
+ git commit "$@"
+ git push
+ local msg="$(git log -n1 --pretty=format:%B)"
+ local dir="$(pwd)"
+ cd ..
+ git add "${dir##*/}"
+ git commit -m "$msg"
+}
+
+main "$@"