added script to push out a subtree w/ burnettk

This commit is contained in:
jasquat 2022-10-21 10:48:02 -04:00
parent f9a1003a88
commit 00534ec09e
3 changed files with 39 additions and 1 deletions

10
bin/get_subtree_prefixes Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
git log | grep git-subtree-dir | tr -d ' ' | cut -d ":" -f2 | sort | uniq | xargs -I {} bash -c 'if [ -d $(git rev-parse --show-toplevel)/{} ] ; then echo {}; fi'

View File

@ -1,4 +1,11 @@
#!/bin/sh
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
for subtree in "SpiffWorkflow" \
"spiffworkflow-backend" \

21
bin/push_subtree Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
function error_handler() {
>&2 echo "Exited with BAD EXIT CODE '${2}' in ${0} script at line: ${1}."
exit "$2"
}
trap 'error_handler ${LINENO} $?' ERR
set -o errtrace -o errexit -o nounset -o pipefail
script_dir="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
valid_subtree_prefixes=$("${script_dir}/get_subtree_prefixes")
subtree="${1:-}"
if ! grep -qE "^${subtree}$" <<<"$valid_subtree_prefixes"; then
>&2 echo "usage: $(basename "$0") [subtree]"
>&2 echo
>&2 echo -e "\tvalid_subtrees:\n\t\t$(tr '\n' ' ' <<<"$valid_subtree_prefixes" | sed 's/ /\n\t\t/g')"
exit 1
fi
git subtree push --prefix="${subtree}" "git@github.com:sartography/${subtree}.git" main