From 7ecfeb61b417d36a6d7b128031ff074629428aa0 Mon Sep 17 00:00:00 2001 From: dev-anon <6645389+dev-anon@users.noreply.github.com> Date: Mon, 11 Feb 2019 11:24:22 -0600 Subject: [PATCH] new method retrieving current branch name modified swg-main/utils/buld_java.sh create method for retrieving the current branch name using git symbolic-ref replaced hard coded master branch name with the new method --- utils/build_java.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utils/build_java.sh b/utils/build_java.sh index 376e2e0..c6b6216 100755 --- a/utils/build_java.sh +++ b/utils/build_java.sh @@ -1,5 +1,11 @@ #/bin/bash +get_current_branch() +{ + git --git-dir=dsrc/.git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,' +} +CBRANCH=$(get_current_branch) + DIR="$( dirname "${BASH_SOURCE[0]}" )" WDIR="$(pwd)" #working dir (normally /home/swg/swg-main ) @@ -33,7 +39,7 @@ for filename in $filenames; do items[$k]=1 #add $k to our list to compile (at the end of the script) done < <(grep -Rinwl . -e $l) #find all scripts using the variable "$l" cd $WDIR #cd back to working directory after grep - done < <(git --git-dir=$WDIR/dsrc/.git --work-tree=$WDIR/dsrc diff origin/master -U0 | grep -o "public static final .*=") #find all 'public static final' declarations in our changed scripts vs origin/master + done < <(git --git-dir=$WDIR/dsrc/.git --work-tree=$WDIR/dsrc diff origin/$CBRANCH -U0 | grep -o "public static final .*=") #find all 'public static final' declarations in our changed scripts vs origin/$CBRANCH fi if [[ ! -z $result ]]; then