Skip to content

fix: convert restored snapshots to bare mirrors with correct upstream URL#175

Draft
jrobotham-square wants to merge 1 commit intomainfrom
fix/snapshot-restore-mirror-conversion
Draft

fix: convert restored snapshots to bare mirrors with correct upstream URL#175
jrobotham-square wants to merge 1 commit intomainfrom
fix/snapshot-restore-mirror-conversion

Conversation

@jrobotham-square
Copy link
Contributor

Snapshots are non-bare clones with remote.origin.url pointing to the cachew server URL so end-user git pulls route through the proxy. When tryRestoreSnapshot restores these into the mirror path, backgroundFetch attempts to fetch from the cachew URL, creating a self-referential loop that times out after 600 seconds.

This adds a convertSnapshotToMirror step after snapshot restore that:

  • Detects non-bare snapshots (presence of .git/ subdir) and converts them to bare layout
  • Resets remote.origin.url to the actual upstream GitHub URL
  • Sets core.bare = true

… URL

Snapshots are non-bare clones with remote.origin.url pointing to the
cachew server URL (so end-user git pulls route through the proxy).
When tryRestoreSnapshot restores these into the mirror path,
backgroundFetch would attempt to fetch from the cachew URL, creating
a self-referential loop that times out after 600 seconds.

After restoring a snapshot, convert it to a bare repository layout
and reset remote.origin.url to the actual upstream GitHub URL.

Amp-Thread-ID: https://ampcode.com/threads/T-019cdb7b-f7b3-7028-a6d6-80369d19965a
Co-authored-by: Amp <amp@ampcode.com>
@jrobotham-square jrobotham-square requested a review from a team as a code owner March 11, 2026 06:07
@jrobotham-square jrobotham-square requested review from js-murph and removed request for a team March 11, 2026 06:07
@jrobotham-square jrobotham-square marked this pull request as draft March 11, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant