Skip to content

Unable to parse Git repositories with insteadOf and pushInsteadOf URI "rewrites" #253

Open
@hyperupcall

Description

@hyperupcall

Hello!

With the following remote configuration:

$ git remote -v
me [email protected]:reconquest/shdoc (fetch)
me [email protected]:reconquest/shdoc (push)

Clicking the "View Repository" button yields https://reconquest/shdoc - I expected it to redirecredirect to https://github.com/reconquest/shdoc.

With the following remote configuration:

#!/usr/bin/env sh
git init

# GitHub allows for re-writing remote URls on the fly with 'insteadOf' and 'pushInsteadOf' fields.
# This is what trips up vscord. Normally, these are globally configured.
git config --local --add url.'[email protected]:'.insteadOf 'gh:'
git config --local --add url.'[email protected]:'.pushInsteadOf 'gh:'
git remote add me gh:fox-projects/repro-vscode-weird-url

# vscord seems to require a "minimum git history" for showing the "View Repository" button.
# This sets that up.
touch file.txt && git add file.txt && git commit --no-edit --no-template --allow-empty-message
git commit --no-edit --no-template --allow-empty --allow-empty-message
$ git remote -v
me      [email protected]:fox-projects/repro-vscode-weird-url (fetch)
me      [email protected]:fox-projects/repro-vscode-weird-url (push)
$ cat .git/config
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[url "[email protected]:"]
        insteadOf = gh:
        pushInsteadOf = gh:
[remote "me"]
        url = gh:fox-projects/repro-vscode-weird-url
        fetch = +refs/heads/*:refs/remotes/me/*

It seems that there is a parsing error when parsing the value of remote.me.url. You might useful a similar issue/fix I made at xournalpp/xournalpp.

Clicking the "View Repository" button yields https://fox-projects/repro-vscode-weird-url - I expected it to redirect to https://github.com/fox-projects/repro-vscode-weird-url.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions