Skip to content

Commit b9dc54e

Browse files
author
Raghuveer Devulapalli
committed
Use branch names instead
1 parent fc08f05 commit b9dc54e

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

scripts/branch-compare.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,27 @@ set -e
33
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44
BASE_DIR=$(dirname $SCRIPT_DIR)
55
branch=$(git rev-parse --abbrev-ref HEAD)
6-
br_commit=$(git rev-parse $branch)
7-
main_commit=$(git rev-parse main)
6+
#br_commit=$(git rev-parse $branch)
7+
#main_commit=$(git rev-parse main)
88
echo "Comparing main branch with $branch"
99

1010
build_branch() {
1111
dir_name=$1
1212
if [ ! -d $dir_name ]; then
1313
git clone -b $branch ${BASE_DIR} $dir_name
14+
else
15+
# if it exists, just update it
16+
cd $dir_name
17+
git fetch origin
18+
git rebase origin/$branch
19+
# rebase fails with conflict, delete and start over
20+
if [ "$?" != 0 ]; then
21+
cd ..
22+
rm -rf $branch
23+
git clone -b $branch ${BASE_DIR} $dir_name
24+
else
25+
cd ..
26+
fi
1427
fi
1528
cd $dir_name
1629
meson setup --warnlevel 0 --buildtype plain builddir
@@ -25,10 +38,10 @@ if [ ! -d google-benchmark ]; then
2538
git clone https://github.com/google/benchmark google-benchmark
2639
fi
2740
compare=$(realpath google-benchmark/tools/compare.py)
28-
build_branch $br_commit
29-
build_branch $main_commit
30-
baseline=$(realpath ${main_commit}/builddir/benchexe)
31-
contender=$(realpath ${br_commit}/builddir/benchexe)
41+
build_branch $branch
42+
build_branch "main"
43+
baseline=$(realpath ${branch}/builddir/benchexe)
44+
contender=$(realpath main/builddir/benchexe)
3245

3346
if [ -z "$1" ]; then
3447
echo "Comparing all benchmarks .."

0 commit comments

Comments
 (0)