summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpbs-package-commit15
-rwxr-xr-xpbs-package-postcommit35
-rw-r--r--pbs-plumb-shlib4
3 files changed, 45 insertions, 9 deletions
diff --git a/pbs-package-commit b/pbs-package-commit
index 0f52401..7af6fc5 100755
--- a/pbs-package-commit
+++ b/pbs-package-commit
@@ -7,8 +7,11 @@ 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 'This is like `git commit`, but cascades up out of the submodule.'
+ echo 'It is simply:'
+ echo
+ echo ' git commit "$@"'
+ echo ' pbs-package-postcommit'
echo ''
echo 'Options:'
echo ' -h Show this message'
@@ -26,13 +29,7 @@ main() {
ensure_in_pbs-package
git commit "$@"
- git push
- local msg="$(git log -n1 --pretty=format:%B)"
- local dir="$(pwd)"
-
- cdto_pbs-root
- git add "${dir##*/}"
- git commit -m "$msg"
+ pbs-package-postcommit
}
main "$@"
diff --git a/pbs-package-postcommit b/pbs-package-postcommit
new file mode 100755
index 0000000..e8ff196
--- /dev/null
+++ b/pbs-package-postcommit
@@ -0,0 +1,35 @@
+#!/bin/bash -euE
+
+. pbs-plumb-shlib
+
+cmd=${0##*/}
+usage() {
+ echo "Usage: $cmd [git-commit OPTIONS]"
+ echo 'Call this after doing a `git commit` manually.'
+ echo ''
+ echo 'This cascades the commit up out of the submodule.'
+ echo ''
+ echo 'Options:'
+ echo ' -h Show this message'
+}
+
+main() {
+ if in_array '-h' "$@"; then
+ usage
+ return 0
+ fi
+
+ ensure_in_pbs-package
+
+ # push the commit upstream
+ git push -f origin "$(gitbranch)"
+
+ # update the submodule
+ local msg="$(git log -n1 --pretty=format:%B)"
+ local dir="$(pwd)"
+ cdto_pbs-root
+ git add "$dir"
+ git commit -m "$msg"
+}
+
+main "$@"
diff --git a/pbs-plumb-shlib b/pbs-plumb-shlib
index c51ddd0..ccbdffb 100644
--- a/pbs-plumb-shlib
+++ b/pbs-plumb-shlib
@@ -16,6 +16,10 @@ gitroot() {
git rev-parse --show-toplevel
}
+gitbranch() {
+ git rev-parse --abbrev-ref HEAD
+}
+
have_file() {
local file=$1
if in_git; then