fix(install-e2e): read the transport url through the real git, not the shim
arm_source_redirect installs a git PATH shim that deliberately reports the OFFICIAL origin for `remote get-url origin` so fork detection stays quiet; the file:// redirect is only visible through the real binary it exports in HERMES_E2E_REAL_GIT. The check asserted on the shimmed view, so it could never pass. Observed: 'origin transport https://github.com/NousResearch/ hermes-agent.git is not redirected'.
This commit is contained in:
@@ -240,7 +240,12 @@ assert_redirect_is_transport_only() {
|
||||
"$official_https"|"$official_ssh") ;;
|
||||
*) fail "origin is configured as '$configured', not an official URL — the redirect is not transport-only" ;;
|
||||
esac
|
||||
observed="$(git -C "$INSTALL_DIR" remote get-url origin)"
|
||||
# `git` on PATH is the shim here (it reports the official origin so fork
|
||||
# detection sees it), so read the TRANSPORT url through the real git that
|
||||
# arm_source_redirect exported — otherwise `remote get-url origin` returns
|
||||
# the official URL and this check would always fail.
|
||||
local real="${HERMES_E2E_REAL_GIT:-git}"
|
||||
observed="$("$real" -C "$INSTALL_DIR" remote get-url origin)"
|
||||
case "$observed" in
|
||||
file://*|*serve.git*) ;;
|
||||
*) fail "origin transport '$observed' is not redirected to the staged repo" ;;
|
||||
|
||||
@@ -1057,8 +1057,9 @@ function Assert-RedirectIsTransportOnly {
|
||||
'git@github.com:NousResearch/hermes-agent.git')
|
||||
$configured = (Invoke-Git @('-C', $InstallDir, 'config', '--get', 'remote.origin.url') | Out-String).Trim()
|
||||
Assert-True ($official -contains $configured) "origin stays configured as an official URL (got '$configured')"
|
||||
$observed = (Invoke-Git @('-C', $InstallDir, 'remote', 'get-url', 'origin') | Out-String).Trim()
|
||||
Assert-True ($observed -match 'serve\.git|^file://') "origin transport is redirected to the staged repo (got '$observed')"
|
||||
$real = if ($env:HERMES_E2E_REAL_GIT) { $env:HERMES_E2E_REAL_GIT } else { 'git' }
|
||||
$observed = (& $real -C $InstallDir remote get-url origin 2>$null | Out-String).Trim()
|
||||
Assert-True ($observed -match 'serve\.git|^file://') "git transport is redirected to the staged repo (got '$observed')"
|
||||
}
|
||||
|
||||
function Assert-UserShims {
|
||||
|
||||
Reference in New Issue
Block a user