qri-io / rfcs

Request For Comments (RFCs) documenting changes to Qri
MIT License
12 stars 6 forks source link

Shorthand to refer to dataset commits #57

Open feep opened 4 years ago

feep commented 4 years ago

Qri commits can be referred to by their IPFS hash.

46 digits of ID is unwieldy, let’s find a shorthand way to refer to dataset commits.

❯ qri log
for linked dataset [chriswhong/nyc_bridge_bike_counts_2019]

1   Commit:  /ipfs/QmSSJycSd6RUUhMHiGTYfDVUZu21v7XB5L2xdatKnoyqBV
    Date:    Wed Feb 26 10:46:17 PST 2020
    Storage: local
    Size:    1.2 MB

    add note in readme about counting error confirmed by DOT
    readme:
        added scriptBytes

2   Commit:  /ipfs/QmU4rNyEk7mrwqBhk3NxJxhLJvrFQbDdDakcUmLPtPYLuv
    Date:    Mon Feb 24 07:40:08 PST 2020
    Storage: remote
    Size:    1.2 MB

    Add metadata

Prior art

git partial hash

Git can refer to a version by a partial hash. As long as the commit starts with the fragment, it is unambiguous, and at least four characters long.

As long as no other object in the database has a hash that starts with 1c00, these commands all refer to the same commit:

$ git show 1c002dd4b536e7479fe34593e72e6c6c1819e53b
$ git show 1c002dd4b536e7479f
$ git show 1c00

Other git commands

git log has a flag --abbrev-commit that abbreviates the hashes in the log to seven characters. Longer if required for uniqueness.

git tagged versions

I don’t think anything like tagged versions is planned. But I’m linking it for completeness.

CLI syntax for referring to commits or ranges of commits

dustmop put together a list of special characters that are available for composing command line options.

feep commented 4 years ago

I am new to IPFS, but it looks like the scope of a CID is global.

If we refer to an abbreviation as unique we need to be clear about the scope in which it is unique.