File tree 1 file changed +16
-5
lines changed 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -6,14 +6,25 @@ this_dir=${BASH_SOURCE[0]%/*}
6
6
# shellcheck source=tools/lib/git.sh
7
7
. " ${this_dir} " /lib/git.sh
8
8
9
+ divider_line=' ================================================================'
9
10
10
11
# One-time setup to let git submodule + flutter SDK know that we're
11
12
# using the main channel (main branch).
12
- # We should do a quick check that there's no changes.
13
+ # Otherwise, `flutter doctor` complains about being on a user branch.
14
+ # We do a quick check that there's no changes.
13
15
if ! submodule_is_clean " vendor/flutter" ; then
14
- echo >&2 " There are changes in the 'vendor/flutter' tree or it is not initialized."
15
- echo >&2 " Please run 'git submodule update --init' then run this script again."
16
- exit 1
16
+ echo " Initializing 'vendor/flutter' submodule:"
17
+ echo " ${divider_line} "
18
+ if ! git submodule update --init ; then
19
+ echo " ${divider_line} "
20
+ echo >&2 " Failed to initialize the 'vendor/flutter' submodule, please resolve the issues indicated above then run this script again."
21
+ exit 1
22
+ else
23
+ echo " ${divider_line} "
24
+ fi
25
+ fi
26
+ # Check if current branch is main, if not, switch to main
27
+ if [[ $( git -C vendor/flutter branch --show-current) == " main" ]]; then
28
+ exit 0
17
29
fi
18
-
19
30
git -C vendor/flutter checkout -B main HEAD
You can’t perform that action at this time.
0 commit comments