[yast-devel] URL Links to Other Code at GitHub
Hi all, During the review meeting we found an interesting problem with referencing the code located in another GitHub repositories. I wanted to link the list of remote URL schemes defined in libzypp therefore I added this link to the code: https://github.com/openSUSE/libzypp/blob/master/zypp/Url.cc#L464 However, the disadvantage is that after adding or removing some code the line number won't match any more. Another approach is to link to a specific commit: https://github.com/openSUSE/libzypp/blob/6b22871a0aab134538edcb6e3d032133081... The advantage is that the line won't move as we point to a fixed point in the history. Obviously the disadvantage is that if libzypp adds a new schema you will not see it there. So both approaches have advantages and disadvantages. Unfortunately neither of them handles code changes well. The question is which way we should prefer? Point to a moving "master" or pin to a specific commit which might get obsolete? Your opinions? -- Ladislav Slezák YaST Developer SUSE LINUX, s.r.o. Corso IIa Křižíkova 148/34 18600 Praha 8 -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
On Tue, Oct 18, 2016 at 11:59:12AM +0200, Ladislav Slezak wrote:
During the review meeting we found an interesting problem with referencing the code located in another GitHub repositories.
I wanted to link the list of remote URL schemes defined in libzypp therefore I added this link to the code:
https://github.com/openSUSE/libzypp/blob/master/zypp/Url.cc#L464
Once the code changes, this points to a random place. Useless.
However, the disadvantage is that after adding or removing some code the line number won't match any more.
Another approach is to link to a specific commit:
https://github.com/openSUSE/libzypp/blob/6b22871a0aab134538edcb6e3d032133081...
This one is better, because you will see the exact code being referred to, and you can always switch to `master` and locate the current version of the code. GitHub tip: pressing 'y' will convert the former URL to the latter. -- Martin Vidner, YaST Team http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
Dne 18.10.2016 v 16:23 Martin Vidner napsal(a):
Another approach is to link to a specific commit:
https://github.com/openSUSE/libzypp/blob/6b22871a0aab134538edcb6e3d032133081...
This one is better, because you will see the exact code being referred to, and you can always switch to `master` and locate the current version of the code.
Yes, this is easier than doing it the other way round. But there can be a better solution: use a link to the Rubydoc.info documentation if the package is available there. E.g. http://www.rubydoc.info/github/yast/yast-yast2/Packages/Repository#local%3F-... will always point to the Repository#local method regardless its location in the file. And there are [View source] and [View on GitHub] links if you need to see the source code. (Unfortunately this does not work for libzypp, but we can use it at least for the YaST links.)
GitHub tip: pressing 'y' will convert the former URL to the latter.
Um, where/how exactly should that work? It seems it does not work for me... -- Ladislav Slezák YaST Developer SUSE LINUX, s.r.o. Corso IIa Křižíkova 148/34 18600 Praha 8 -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (2)
-
Ladislav Slezak
-
Martin Vidner