Skip to content

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

Merged
worstell merged 1 commit intomainfrom
fix/snapshot-restore-mirror-conversion
Mar 11, 2026
Merged

fix: convert restored snapshots to bare mirrors with correct upstream URL#175
worstell merged 1 commit intomainfrom
fix/snapshot-restore-mirror-conversion

Conversation

@jrobotham-square
Copy link
Copy Markdown
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
@worstell worstell marked this pull request as ready for review March 11, 2026 16:25
@worstell worstell merged commit 9f0d8fd into main Mar 11, 2026
6 checks passed
@worstell worstell deleted the fix/snapshot-restore-mirror-conversion branch March 11, 2026 16:25
worstell pushed a commit that referenced this pull request Mar 12, 2026
… URL (#175)

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`

Co-authored-by: Amp <amp@ampcode.com>
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.

2 participants