Projects like GNU and the Linux kernel don't use Gitlab or Github, they use cgit. For example, here's the 114th line of main.c
for GNU make:
https://git.savannah.gnu.org/cgit/make.git/tree/src/main.c#n114
and here's the 1340th line of printk.c
for the Linux kernel:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/printk/printk.c#n1340
The trouble is these URLs have no commit ID, so they are really a link to whatever is the current commit, not a permalink to a specific commit. So the line number could end up pointing to a completely different part of code or break completely if the file is renamed or removed. Better links would look like this instead:
Here's an example of a link to a file that doesn't exist in the current tree:
so I'm pretty sure these count as permalinks.
If I were using Gitlab or Github, just pressing the y
key would give me a permalink. With cgit
, I need to do this:
Note the line number (write it down or copy it somewhere).
https://git.savannah.gnu.org/cgit/make.git/tree/src/main.c#n114
Click "log".
Find the most recent commit and click the commit message.
[SV 46013] Allow recursive variable overrides from Makefiles
Click the link in the "tree" field that points to the actual file (the second link).
Look up the line number that I wrote down and navigate to that line.
Copy the URL.
Back in June 2016, someone posted about this on the cgit
mailing list:
I've been using some services that are backed by cgit and in accessing them I'm finding it awkward to get permalinks to lines of code.
[ . . . ]
While the default link available is convenient for immediate discussions, I usually prefer to have a permalink for email and issue tracker usage.
[ . . . ]
This seems a bit unnecessary. I'm wondering if there is a way for cgit to easily get from the first page that I opened from codesearch.openstack.org, to the permalink of the same file and line number at the point in time in the repository that I arrived at in a single step? Is there a key like github's 'press "y"', or an extra link that can be activated, or is this an enhancement?
--- Darragh Bailey, "Accessing permalinks", Wed Jun 15 15:32:20 CEST 2016
https://lists.zx2c4.com/pipermail/cgit/2016-June/003095.html
but it doesn't look like anything has come of it.
So here are the questions:
Are these links true permalinks?
Is there a more efficient way of getting permalinks from git repositories on
cgit
?