Closed hendursaga closed 2 years ago
Hi, can you provide a link to some repos that work with these changes? Thanks!
I wrote this so I could have this in my personal emacsd:
(add-to-list 'git-link-remote-alist
'("git.spwhitton.name" git-link-cgit))
(add-to-list 'git-link-commit-remote-alist
'("git.spwhitton.name" git-link-commit-cgit))
You can search "generated by cgit" for other cgit services. Here's a few examples that work:
(add-to-list 'git-link-remote-alist
'("git.openembedded.org" git-link-cgit))
(add-to-list 'git-link-commit-remote-alist
'("git.openembedded.org" git-link-commit-cgit))
(add-to-list 'git-link-remote-alist
'("git.parabola.nu" git-link-cgit))
(add-to-list 'git-link-commit-remote-alist
'("git.parabola.nu" git-link-commit-cgit))
This what you were asking for?
Or were you meaning adding some tests, @sshaw?
Tests are always nice but I was wondering about public repos that I can use to test the linking.
There was talk of adding cgit support a while back, but the problem is the path portion is dependent on the cgit install. cgit defaults to cgit.cgi
but of course this can be anything. cgit's site does not (did not?) use .cgi
, for example.
How to workaround this issue?
Working with SaaS services, e.g., GitHub makes sense but when the function is for software that anyone can configure, it doesn't seem to make sense to include in the package. Instead this is where a local, user-defined function in git-link-remote-alist
and git-link-commit-remote-alist
makes sense.
That was why I added the optional base-path argument, although I honestly haven't seen any /cgit.cgi/ paths in the wild yet. Wouldn't this be sufficient?
That was why I added the optional base-path argument
So if one needed to link to a repo with a cgit front-end that used cgit.cgi
for the SCRIPT_NAME
or, better yet my-amaaaaazing-custom-url
, they'd have to do:
(defun link-to-my-cgit-endpoint (hostname dirname filename branch commit start end)
(git-link-cgit (hostname dirname filename branch commit start end "my-amaaaaazing-custom-url")))
;; add to alist stuff here
Correct?
although I honestly haven't seen any /cgit.cgi/ paths in the wild yet
Org-Mode used to use it. It is the default script name 🤷. Given that it is the default (though I could be missing something. I have close to nil cgit experience), wouldn't it be best to default base-path
to cgit.cgi
?
I realized a better way of doing this, vs using optional arguments - just modify the dirname variable a bit. Does this work better? It works out of the box for my other cgit-hosted repositories.
It works out of the box for my other cgit-hosted repositories.
How did you install these because the question remains: if the cgit Makefile defaults to cgit.cgi
, why don't you have cgit.cgi
?
Otherwise looks good. Just wondering what the disconnect is between that Makefile and everything else. Are folks just overriding it?
How did you install these...
I should clarify, when I said "my other cgit-hosted repositories," I don't mean to say I hosted or installed them, I just clone/push from/to them. I believe almost everyone installing cgit
override that.
I believe almost everyone installing cgit override that.
Odd. Okay, please just squash into a single commit and I will merge. Thanks!
@sshaw I believe I squashed it correctly! Ready to merge?
🎊
Thanks again!
Savannah uses cgit for (one of) their web interfaces.