You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a939d4b
Browse filesBrowse the repository at this point in the historyBrowse files
Source installs must select the requested release commit and leave existing checkouts recoverable when updates fail.
This change qualifies Git refs, carries ref mutability into lockfile selection, restores conflicting rebases, and verifies unchanged state when a pre-rebase hook refuses before rebase metadata exists.
Co-authored-by: Jason O'Neal <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
if! original_head="$(git -C "$repo_dir" rev-parse --verify HEAD 2>/dev/null)";then
1054
+
fail "Could not record repository state before updating from origin/main"
1055
+
fi
1056
+
if! original_status="$(git -C "$repo_dir" status --porcelain=v1 --untracked-files=all 2>/dev/null)";then
1057
+
fail "Could not record repository state before updating from origin/main"
1058
+
fi
1059
+
if! git -C "$repo_dir" rebase origin/main;then
1060
+
if verify_git_rebase_recovery "$repo_dir""$original_head""$original_status";then
1061
+
fail "Could not update repository from origin/main; the checkout was restored to its pre-update state"
1062
+
fi
1063
+
fail "Could not update repository from origin/main; checkout recovery was not verified. Run git -C \"$repo_dir\" rebase --abort and inspect the checkout before retrying"
1064
+
fi
1041
1065
fi
1066
+
GIT_REF_KIND="moving"
1042
1067
return 0
1043
1068
fi
1044
1069
1045
-
git -C "$repo_dir" fetch --tags origin
1046
-
1047
-
if git -C "$repo_dir" rev-parse --verify --quiet "refs/tags/${ref}^{commit}">/dev/null;then
1048
-
git -C "$repo_dir" checkout --detach "$ref"
1049
-
return 0
1070
+
# Normalized release selectors prefer immutable tags. A same-name branch
1071
+
# remains a fallback for operator-supplied v-prefixed branch names.
1072
+
if [[ "$ref"== v[0-9]* ]];then
1073
+
namespaces=(tags heads)
1050
1074
fi
1051
1075
1052
-
if git -C "$repo_dir" rev-parse --verify --quiet "${ref}^{commit}">/dev/null;then
1053
-
git -C "$repo_dir" checkout --detach "$ref"
1054
-
return 0
1055
-
fi
1076
+
local namespace=""
1077
+
local probe_status=0
1078
+
fornamespacein"${namespaces[@]}";do
1079
+
if git -C "$repo_dir" ls-remote --exit-code origin "refs/${namespace}/${ref}">/dev/null 2>&1;then
if! original_head="$(git -C "$repo_dir" rev-parse --verify HEAD 2>/dev/null)";then
2665
+
ui_error "Could not record repository state before updating from origin/main"
2666
+
return 1
2667
+
fi
2668
+
if! original_status="$(git -C "$repo_dir" status --porcelain=v1 --untracked-files=all 2>/dev/null)";then
2669
+
ui_error "Could not record repository state before updating from origin/main"
2670
+
return 1
2671
+
fi
2672
+
if! run_quiet_step "Updating repository" git -C "$repo_dir" rebase origin/main;then
2673
+
if verify_git_rebase_recovery "$repo_dir""$original_head""$original_status";then
2674
+
ui_error "Could not update repository from origin/main; the checkout was restored to its pre-update state"
2675
+
else
2676
+
ui_error "Could not update repository from origin/main; checkout recovery was not verified. Run git -C \"$repo_dir\" rebase --abort and inspect the checkout before retrying"
0 commit comments