dt / ghlink

9 stars 2 forks source link

Not linking "#number" despite .git/config #11

Closed naholyr closed 5 years ago

naholyr commented 5 years ago

Here is my .git/config:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = git@github.com:NetdirectFR/vitrine.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

As you can see, the origin remote is properly configured and set to a valid repository (private, could this be an issue?). However simple "#issueNumber" texts are not linked:

image

Is it supposed to work? Is there an issue in my config?

naholyr commented 5 years ago

It looks like you're misusing parse-git-config, I see this code:

        // First, check whether `origin` remote is on GitHub.
        const originRepoName = config.remote.origin && urlToRepoName(config.remote.origin.url)

but in parse-git-config's doc we can see this remote property does not exist, you should use config['remote "origin"'] instead of config.remote.origin:

image

naholyr commented 5 years ago

Debugging the extension, config object format seems OK, I may have read doc for the wrong module or wrong version. Whatever. Digging for a PR.

naholyr commented 5 years ago

Gotcha! it was an error in repo name parsing, you were matching only http URLs, not ssh ones, which is the default for me:

image