Commit 1ee5259 1 parent 347aca8 commit 1ee5259 Copy full SHA for 1ee5259
File tree 4 files changed +22
-16
lines changed
4 files changed +22
-16
lines changed Original file line number Diff line number Diff line change
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
+
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ command_tagrelease() {
25
25
COPYRIGHT=" ${EARLIEST_YEAR} -${LATEST_YEAR} "
26
26
fi
27
27
28
- DEFAULT_BRANCH=$( default_branch )
29
- CURRENT_BRANCH=$( current_branch )
28
+ DEFAULT_BRANCH=$( run_command defaultbranch )
29
+ CURRENT_BRANCH=$( run_command currentbranch )
30
30
if [ " $CURRENT_BRANCH " != " $DEFAULT_BRANCH " ]; then
31
31
echo " *** You are not on $DEFAULT_BRANCH ; you cannot release from this branch"
32
32
exit 1
Original file line number Diff line number Diff line change @@ -106,20 +106,6 @@ task_help() {
106
106
fi
107
107
}
108
108
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
-
123
109
# Setup the runtime environment
124
110
setup_environment () {
125
111
local EARLIEST_YEAR LATEST_YEAR
You can’t perform that action at this time.
0 commit comments