Skip to content

Commit 1ee5259

Browse files
committed
Pull in latest version of run-script-framework
1 parent 347aca8 commit 1ee5259

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

.run/commands/currentbranch.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# vim: set ft=bash ts=3 sw=3 expandtab:
2+
# Return the current Git branch
3+
4+
command_currentbranch() {
5+
git branch -a | grep '^\*' | sed 's/^\* //'
6+
}
7+

.run/commands/defaultbranch.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# vim: set ft=bash ts=3 sw=3 expandtab:
2+
# Return the default Git branch
3+
4+
# There is no canonical way to determine the default Git branch. This version
5+
# is slow, but seems more reliable than most. At least by pulling it into a
6+
# command (vs. setting a variable via util.sh), only the commands or tasks that
7+
# need it will take the hit.
8+
#
9+
# See: https://stackoverflow.com/questions/28666357/how-to-get-default-git-branch
10+
11+
command_defaultbranch() {
12+
LC_ALL=C git remote show $(git remote) | grep 'HEAD branch' | cut -d' ' -f5
13+
}

.run/commands/tagrelease.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ command_tagrelease() {
2525
COPYRIGHT="${EARLIEST_YEAR}-${LATEST_YEAR}"
2626
fi
2727

28-
DEFAULT_BRANCH=$(default_branch)
29-
CURRENT_BRANCH=$(current_branch)
28+
DEFAULT_BRANCH=$(run_command defaultbranch)
29+
CURRENT_BRANCH=$(run_command currentbranch)
3030
if [ "$CURRENT_BRANCH" != "$DEFAULT_BRANCH" ]; then
3131
echo "*** You are not on $DEFAULT_BRANCH; you cannot release from this branch"
3232
exit 1

.run/util.sh

-14
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,6 @@ task_help() {
106106
fi
107107
}
108108

109-
# Return the default Git branch
110-
default_branch() {
111-
# There is no canonical way to determine the default Git branch. This version is
112-
# slow, but seems more reliable than most. At least by pulling it into a function
113-
# (vs. a variable) only the commands or tasks that need it will take the hit.
114-
# See: https://stackoverflow.com/questions/28666357/how-to-get-default-git-branch
115-
LC_ALL=C git remote show $(git remote) | grep 'HEAD branch' | cut -d' ' -f5
116-
}
117-
118-
# Return the current Git branch
119-
current_branch() {
120-
git branch -a | grep '^\*' | sed 's/^\* //'
121-
}
122-
123109
# Setup the runtime environment
124110
setup_environment() {
125111
local EARLIEST_YEAR LATEST_YEAR

0 commit comments

Comments
 (0)