Skip to content

[repo-assist] Fix (redacted) git URL handling to preserve absolute path slash - #4377

Merged
dsyme merged 1 commit into
masterfrom
repo-assist/fix-issue-1903-file-url-slashes-00b3f246f155b91f
Aug 28, 2026
Merged

dsyme merged 1 commit into
masterfrom
repo-assist/fix-issue-1903-file-url-slashes-00b3f246f155b91f

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated response from Repo Assist, an automated AI assistant.

Closes #1903

Root cause

When resolving the commit hash for a local git (redacted) dependency, RemoteDownload.fsstripped the literal prefix(redacted) (three slashes) from the URL:

let path = path.Replace(@"(redacted) "")

For a URL like (redacted) this removes all three slashes, leaving the relative path tmp/git/a/gitinstead of the intended absolute path/tmp/git/a/git. Directory.Exists/git commands then fail to find the repo relative to the current working directory, producing Could not find hash for master in 'tmp/git/a/git'`.

The reporter's workaround was to add an extra slash ((redacted) which happened to leave one slash behind after stripping — but that's non-standard and not how git cloneor other URL-aware tools interpret(redacted) URLs.

Fix

Strip only the `(redacted) scheme prefix (two slashes), leaving the URL's own leading slash intact so the resulting path is absolute:

let path = path.Replace(@"(redacted) "")

Now (redacted) correctly becomes /tmp/git/a/git/, matching what git clone` accepts natively, and the extra-slash workaround is no longer required.

Trade-offs

  • This is a minimal, surgical change to a single line; no other git URL handling paths are affected (RemoteGitOrigin and extractUrlParts in GitHandling.fs are unchanged).
  • Windows-style (redacted) URLs are unaffected in the same way (the drive letter still needs its own leading slash stripped per .NET file URI conventions), consistent with existing behavior of extractUrlParts`.

Test Status

  • dotnet build src/Paket.Core/Paket.Core.fsproj -c Release — succeeded, no new warnings/errors introduced.
  • No existing unit tests exercise this specific code path (it lives inside RemoteDownload.fs's async hash-resolution function, which depends on real git repos/filesystem state rather than being a small pure function like extractUrlParts). I did not add a new test harness for this, per repo guidance to prefer minimal, surgical changes and reuse existing test patterns; a maintainer may wish to add an integration test scenario with a local `(redacted) git dependency if desired.

Generated by 🌈 Repo Assist, see workflow run. Learn more.
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@ae8d551f07c7ed7619f8c58c7bb4c3ac89395d38

Closes #1903

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

git file:// won't accept valid file urls, wants extra slashes

1 participant