Subject: [urn] Help me git an understanding

From: Sean Leonard <[email-masked]>
Date: Fri, 12 Sep 2014 12:12:58 -0700

Sometimes I feel like I want a URL (or URI)...sometimes I feel like I 
want a URN. What distinguishes the two?

Let's take an example that (I think) makes a lot of sense.

Suppose I want to get something with git.

Git defines a URI scheme 
<https://www.kernel.org/pub/software/scm/git/docs/git-push.html#URLS>:

git://host.xz[:port]/path/to/repo.git/

Ok, that's great. We all understand the syntax. And, we understand that 
'git:' signals the git (provisional) URI scheme, which is related to a 
network protocol for git.

But instead of getting a repository, I want to identify (and get) a git 
commit.

git commits are identified by SHA-1 hash. It's just the way git works. 
They talked about SHA-256, but rejected it. There are good reasons.

It would seem to me that this makes a lot of sense:

urn:git:3eb2a50d8de50c805a5a76f2193fefb8899b9bdb

or, if we subdivide the hypothetical git namespace into commits and 
"other things", we could say:

urn:git:commit:3eb2a50d8de50c805a5a76f2193fefb8899b9bdb

An application wants to use this syntax because it wants to perform an 
operation on the commit (for example, do a diff, branch it off, print 
out the changes, whatever), and it doesn't want or need to specify the 
repo location on the Internet.

But what makes urn:git: better than the git: URI scheme for this 
purpose? Or, can we use git: for both network resources (git://host...) 
and location-independent, persistent things (git:commit:....)?

And in the case of the latter, what exactly is the point of URN syntax, 
anyway? Why don't we just say isbn:0-345-80348-5 and drop the urn: part?

Sean

PS The same could be said of Subversion repositories ("repos"). Every 
Subversion repo has a UUID. Since it's a UUID, it's persistent and 
location-independent. So what's the difference between, say:

urn:svn:repo:642247e6-a953-0410-9eba-834bae0c6d03

and some additional syntax to the existing svn URI, namely:
svn:repo:642247e6-a953-0410-9eba-834bae0c6d03

?

PPS People might say something like, "well, why don't you just use 
urn:uuid?" For example:
urn:uuid:642247e6-a953-0410-9eba-834bae0c6d03

That's an excellent question. And the answer is that it's not the right 
namespace. It's true that Subversion repositories use UUIDs as 
identifiers. But merely saying "it's a UUID" is not sufficient; saying 
"this is a Subversion repository 642247e6-a953-0410-9eba-834bae0c6d03" 
is the semantic intent that you want to convey. In fact, it's exactly 
like saying http://example.com vs. ftp://example.com vs. 
dns://example.com. All three convey the DNS identifier "example.com". 
When dereferenced, the first two may get something like the same 
"resource". The third means something else entirely. All three have very 
different semantics.