4 ms·
> These URLs always refer to the latest definition and won’t break if the file is edited, unlike links to a specific line number. You can always get the URL on
by michaelmior 10y ago
> These URLs always refer to the latest definition and won’t break if the file is edited, unlike links to a specific line number.
You can always get the URL on GitHub for a particular line number at a particular revision which won't break when the file changes. A persistent link to a function can break in a different way in that maybe the function, while named the same, changes behaviour in a way that it no longer does exactly what it originally did. It's not obvious to me which of these breakages is more relevant.
When you talk about "hackable" URLs it would be great to be able to get a URL for a named function at a particular revision. This solves both problems. I have an immutable reference to a particular piece of code, but then by hacking the URL I should be able to still see the most recent version.
- beliu 10y agoExactly! You mean like this? https://sourcegraph.com/github.com/gorilla/mux@9fa818a44c2bf1396a17f9d5a3c0f6dd39d2ff8e/-/def/GoPackage/github.com/gorilla/mux/-/CurrentRoute https://sourcegraph.com/github.com/gorilla/mux@9fa818a44c2bf...
- michaelmior 10y agoExactly :) Cool! Although it seems weird to me to have the revision in the middle of the URL.
- the_common_man 10y agoThis also works for tags and branches (or any 'ref' for that matter instead of the sha1)
- sqs 10y agoWhere would you want the revision? At the very end? Right now, it's associated with the repo, which makes sense and is easier on our URL routing. But I'm curious to hear what you'd prefer.
- michaelmior 10y agoActually on further thought maybe this does make more sense. I don't really have a strong preference either way anyway.
- OJFord 10y agoI think I agree with parent - if the premise is that the units we're dealing with are the functions, then I want to usually access `/function`, and `/function/revision` is being more specific. I get what you're saying, but it seems like the URL mixes where you're coming from with where you want to take us.
- JoshTriplett 10y agoI think it actually makes sense there, as a logical hierarchy: you want a given repository, at a given revision (e.g. a commit hash), and a given file within that revision.