FND / tiddlywebplugins.gitstore

Git-based text store for TiddlyWeb
1 stars 1 forks source link

use abbreviated commit hash for revision IDs #6

Closed FND closed 11 years ago

FND commented 11 years ago

40 characters seems long and cumbersome. Git and GitHub often shorten these hashes to 7-10 characters in the UI - perhaps we should do the same, hoping that 10 characters are plenty to avoid collisions?

Thoughts, @cdent?

cdent commented 11 years ago

There is, presumably, somewhere a faq or similar on "why it is okay to refer to a commit by prefix of length X" which, when found, will then allow you to reassure yourself that you are getting the uniqueness you need.

However, given that in the tiddlyweb context you never refer a revision id without a tiddler id, your opportunities for collision have dramatically collapsed, so I suspect there's no real issue.

FND commented 11 years ago

There is, presumably, somewhere a faq or similar on "why it is okay to refer to a commit by prefix of length X"

Well, it's quite simple: When referencing a commit, you can use any abbreviation of the full hash ID - Git will expand that if it's unique. However, an abbreviation that was unique at one time is not necessarily unique in the future.

given that in the tiddlyweb context you never refer a revision id without a tiddler id, your opportunities for collision have dramatically collapsed

That's what I figured as well - so I'll go ahead and use 10-char IDs.

pmario commented 11 years ago

Github uses 7chars atm. I think at the very beginning it were less. So with 10 we are probably on the save side. :)

FND commented 11 years ago

done in f986fa28b645d8b01b4acc315a8c73d1235cff0e