Normalize equivalent git remotes in allod patch identity checks #92

Closed
opened 2026-07-08 20:20:18 +01:00 by vnprc-agent · 0 comments
Contributor

Problem

allod patch receive rejects a valid patch transfer when the source and destination clones use different URL forms for the same GitHub repository.

Observed while transferring a TriangleBitDevs commit from nix-dev to nexus:

$ allod patch receive nix-dev:/home/vnprc/work/TriangleBitDevs.github.io ~/work/TriangleBitDevs.github.io/
/tmp/allod-patch.bwlmJATYIV/0001-Populate-seminar-54-agenda-topics.patch
allod: fetched 1 patch(es) (4f70c059..a3778154)
allod: artifact dir: /tmp/allod-patch-receive.oO732HcBLN/artifact
allod: repo identity mismatch
allod: manifest remote: https://github.com/TriangleBitDevs/TriangleBitDevs.github.io.git
allod: destination remote: git@github.com:TriangleBitDevs/TriangleBitDevs.github.io.git
allod: artifact dir: /tmp/allod-patch-receive.oO732HcBLN/artifact

The manifest remote and destination remote identify the same GitHub repo, but patch_apply compares raw origin URLs byte-for-byte.

Expected behavior

allod patch apply / receive should accept equivalent remote identities across common Git URL forms, at least:

https://github.com/org/repo.git
git@github.com:org/repo.git
ssh://git@github.com/org/repo.git

It should still reject truly different repos.

Implementation notes

Current flow:

  • patch_fetch records repo_remote=$(git -C "$repo" remote get-url origin) in manifest.json.
  • patch_apply reads .repo_remote, reads destination git remote get-url origin, and exits 13 if the strings differ.

A small normalization helper before comparison would likely be enough. Normalize scheme/user/host/path for known safe forms, lowercase the host, strip a trailing .git, and compare canonical host/owner/repo identities. For unrecognized URL forms, keep the current exact-string behavior or fail closed.

Workaround

Align the source and destination origin URLs manually, or apply the preserved artifact after changing one remote URL.

## Problem `allod patch receive` rejects a valid patch transfer when the source and destination clones use different URL forms for the same GitHub repository. Observed while transferring a TriangleBitDevs commit from `nix-dev` to `nexus`: ```text $ allod patch receive nix-dev:/home/vnprc/work/TriangleBitDevs.github.io ~/work/TriangleBitDevs.github.io/ /tmp/allod-patch.bwlmJATYIV/0001-Populate-seminar-54-agenda-topics.patch allod: fetched 1 patch(es) (4f70c059..a3778154) allod: artifact dir: /tmp/allod-patch-receive.oO732HcBLN/artifact allod: repo identity mismatch allod: manifest remote: https://github.com/TriangleBitDevs/TriangleBitDevs.github.io.git allod: destination remote: git@github.com:TriangleBitDevs/TriangleBitDevs.github.io.git allod: artifact dir: /tmp/allod-patch-receive.oO732HcBLN/artifact ``` The manifest remote and destination remote identify the same GitHub repo, but `patch_apply` compares raw `origin` URLs byte-for-byte. ## Expected behavior `allod patch apply` / `receive` should accept equivalent remote identities across common Git URL forms, at least: ```text https://github.com/org/repo.git git@github.com:org/repo.git ssh://git@github.com/org/repo.git ``` It should still reject truly different repos. ## Implementation notes Current flow: - `patch_fetch` records `repo_remote=$(git -C "$repo" remote get-url origin)` in `manifest.json`. - `patch_apply` reads `.repo_remote`, reads destination `git remote get-url origin`, and exits 13 if the strings differ. A small normalization helper before comparison would likely be enough. Normalize scheme/user/host/path for known safe forms, lowercase the host, strip a trailing `.git`, and compare canonical `host/owner/repo` identities. For unrecognized URL forms, keep the current exact-string behavior or fail closed. ## Workaround Align the source and destination `origin` URLs manually, or apply the preserved artifact after changing one remote URL.
vnprc closed this issue 2026-07-08 20:36:51 +01:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
allod/tools#92
No description provided.