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
This commit is contained in:
dev-anon
2019-02-11 11:24:22 -06:00
committed by GitHub
parent a7cddbd8b0
commit 7ecfeb61b4

View File

@@ -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