File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,15 @@ if ((Test-Path "$flutterRoot\DEPS" -PathType Leaf) -and (Test-Path "$flutterRoot
27
27
# Calculate the engine hash from tracked git files.
28
28
$branch = (git - C " $flutterRoot " rev- parse -- abbrev- ref HEAD)
29
29
if ($null -eq $Env: LUCI_CONTEXT ) {
30
- $engineVersion = (git - C " $flutterRoot " merge-base HEAD upstream/ master)
30
+ $ErrorActionPreference = " Continue"
31
+ git - C " $flutterRoot " remote get-url upstream * > $null
32
+ $exitCode = $?
33
+ $ErrorActionPreference = " Stop"
34
+ if ($exitCode ) {
35
+ $engineVersion = (git - C " $flutterRoot " merge-base HEAD upstream/ master)
36
+ } else {
37
+ $engineVersion = (git - C " $flutterRoot " merge-base HEAD origin/ master)
38
+ }
31
39
}
32
40
else {
33
41
$engineVersion = (git - C " $flutterRoot " rev- parse HEAD)
Original file line number Diff line number Diff line change @@ -27,7 +27,17 @@ if [ -f "$FLUTTER_ROOT/DEPS" ] && [ -f "$FLUTTER_ROOT/engine/src/.gn" ]; then
27
27
BRANCH=$( git -C " $FLUTTER_ROOT " rev-parse --abbrev-ref HEAD)
28
28
# In a fusion repository; the engine.version comes from the git hashes.
29
29
if [ -z " ${LUCI_CONTEXT} " ]; then
30
- ENGINE_VERSION=$( git -C " $FLUTTER_ROOT " merge-base HEAD upstream/master)
30
+ set +e
31
+ # Run the git command and capture the exit code
32
+ git -C " $flutterRoot " remote get-url upstream > /dev/null 2>&1
33
+ exit_code=$?
34
+ set -e
35
+
36
+ if [[ $exit_code -eq 0 ]]; then
37
+ ENGINE_VERSION=$( git -C " $FLUTTER_ROOT " merge-base HEAD upstream/master)
38
+ else
39
+ ENGINE_VERSION=$( git -C " $FLUTTER_ROOT " merge-base HEAD origin/master)
40
+ fi
31
41
else
32
42
ENGINE_VERSION=$( git -C " $FLUTTER_ROOT " rev-parse HEAD)
33
43
fi
You can’t perform that action at this time.
0 commit comments