Fix vm run guest checkout ownership
Extract the host worktree overlay with tar -o so the guest repo stays owned by root instead of inheriting host UID/GID metadata. That avoids Git's dubious ownership check on /root/<repo> after vm run.\n\nAlso register the guest checkout as a safe.directory during repo setup so opencode and manual git commands can read branch state reliably after attach.\n\nValidation: GOCACHE=/tmp/banger-gocache go test ./... and make build.
This commit is contained in:
parent
2ebc6f99c6
commit
0ad3dae502
2 changed files with 6 additions and 2 deletions
|
|
@ -1589,7 +1589,7 @@ func importVMRunRepoToGuest(ctx context.Context, client vmRunGuestClient, spec v
|
|||
return formatVMRunStepError("prepare guest checkout", err, scriptLog.String())
|
||||
}
|
||||
var overlayLog bytes.Buffer
|
||||
remoteCommand := fmt.Sprintf("tar -C %s --strip-components=1 -xf -", shellQuote(vmRunGuestDir(spec.RepoName)))
|
||||
remoteCommand := fmt.Sprintf("tar -o -C %s --strip-components=1 -xf -", shellQuote(vmRunGuestDir(spec.RepoName)))
|
||||
if err := client.StreamTarEntries(ctx, spec.RepoRoot, spec.OverlayPaths, remoteCommand, &overlayLog); err != nil {
|
||||
return formatVMRunStepError("overlay host working tree", err, overlayLog.String())
|
||||
}
|
||||
|
|
@ -1640,6 +1640,7 @@ func vmRunCloneScript(spec vmRunRepoSpec) string {
|
|||
fmt.Fprintf(&script, "git -C \"$DIR\" checkout --detach %s\n", shellQuote(spec.HeadCommit))
|
||||
}
|
||||
script.WriteString("find \"$DIR\" -mindepth 1 -maxdepth 1 ! -name .git -exec rm -rf {} +\n")
|
||||
script.WriteString("git config --global --add safe.directory \"$DIR\"\n")
|
||||
return script.String()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue