Skip to content

Commit cd5d3b2

Browse files
committed
Allow selecting Arduino branch based on the current lib-builder branch
1 parent 3931f52 commit cd5d3b2

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

tools/update-components.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,26 @@ if [ ! -d "$AR_COMPS/arduino" ]; then
1818
fi
1919

2020
if [ -z $AR_BRANCH ]; then
21-
has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "idf-$IDF_BRANCH"`
22-
if [ "$has_ar_branch" == "1" ]; then
23-
export AR_BRANCH="idf-$IDF_BRANCH"
21+
current_branch=`git branch --show-current`
22+
if [[ "$current_branch" != "master" && `git_branch_exists "$AR_COMPS/arduino" "$current_branch"` == "1" ]]; then
23+
export AR_BRANCH="$current_branch"
2424
else
25-
has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_PR_TARGET_BRANCH"`
25+
has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "idf-$IDF_BRANCH"`
2626
if [ "$has_ar_branch" == "1" ]; then
27-
export AR_BRANCH="$AR_PR_TARGET_BRANCH"
27+
export AR_BRANCH="idf-$IDF_BRANCH"
28+
else
29+
has_ar_branch=`git_branch_exists "$AR_COMPS/arduino" "$AR_PR_TARGET_BRANCH"`
30+
if [ "$has_ar_branch" == "1" ]; then
31+
export AR_BRANCH="$AR_PR_TARGET_BRANCH"
32+
fi
2833
fi
2934
fi
3035
fi
3136

3237
if [ "$AR_BRANCH" ]; then
33-
git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH"
38+
git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \
39+
git -C "$AR_COMPS/arduino" fetch && \
40+
git -C "$AR_COMPS/arduino" pull --ff-only
3441
fi
3542
if [ $? -ne 0 ]; then exit 1; fi
3643

0 commit comments

Comments
 (0)