Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression - incorrect directory passed to function in "git-link-remote-alist" #95

Open
edkolev opened this issue Feb 28, 2022 · 2 comments
Labels

Comments

@edkolev
Copy link

edkolev commented Feb 28, 2022

Hi, I updated the git-link package to the latest one and my custom function in "git-link-remote-alist" stopped working (produces incorrect URLs).

I've been using git-link for 3+ years without any issues with the config pasted below.

The issue is DIRNAME passed to my function is invalid. I've narrowed down the issue to git-link--parse-remote.

Here's how to reproduce it:

(git-link--parse-remote "[email protected]:dir")
;; returns ("my.company.internal" "/")
;; expected ("my.company.internal" "dir")

This is the git config:

$ git config --get remote.origin.url
[email protected]:dir/

Could you please review the parsing in git-link--parse-remote? I suspect it has changed. I haven't binary-searched for the breaking commit, but it should be committed the last 1-2 years. Sorry, I don't know what was the previous version which was working for me. EDIT: last working version is in the comment below.

Thanks for this package, it has been one of my daily tools!

Config ("XXX" obfuscates what I don't want to share):

(use-package git-link
  :ensure t
  :config
  (add-to-list 'git-link-remote-alist '("XXX" git-link-xxx))

  (defun git-link-xxx (hostname dirname filename branch commit start end)
    (format "XXX/%s/%s@%s/-/blob/%s"
            hostname
            dirname
            (or branch commit)
            (concat filename
                    (when start
                      (concat "#"
                              (if end
                                  (format "L%s-%s" start end)
                                (format "L%s" start))))))))
@edkolev
Copy link
Author

edkolev commented Feb 28, 2022

Just did a quick check - v0.8.0 is the last working version, v0.8.1 doesn't work:

(git-link--parse-remote "[email protected]:dir")
;; v0.8.0 returns ("my.company.internal" "dir/")
;; v0.8.1 returns ("my.company.internal" "/")

@sshaw sshaw added the bug label Mar 20, 2022
@sshaw
Copy link
Owner

sshaw commented Mar 20, 2022

Thanks for the info @edkolev. Bad test coverage here unfortunately 🔴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants