psyinfra / onyo

text-based inventory system on top of git
ISC License
3 stars 5 forks source link

Feature Request: expose git metadata as pseudo-keys #662

Open aqw opened 1 month ago

aqw commented 1 month ago

We have long discussed making various bits of git metadata queryable, most especially the creation date and last modification date.

Git already has all this information, and would support use-cases such as #428 .

The two "must haves" are creation date and last modification date. However, there is additional metadata we could expose such as committer and author (though I have no real use-cases for it).

All keys will live under the onyo.git namespace (see #688).

Proposed names: 1) - created

aqw commented 1 month ago

Ideas are most welcome. :-)

aqw commented 1 month ago

After some though, I prefer option 1. It's the only known use-case.

I dislike adding _date as the type, aa the returned data will actually be date-time.

If we do eventually end up adding the other fields, I propose the following:

created
created_author
created_committer
modified
modified_author
modified_committer
bpoldrack commented 2 weeks ago

I would suggest to go full namespace and not use underscores:

onyo.git.created.time  # datetime
onyo.git.created.committer  # these could be broken up into name and email
onyo.git.created.author
onyo.git.created.commit  # commit-SHA

Especially, if we break up committer and author even further (which we kinda should, I suppose), we may also want to come up with shorter default aliases. That's where the underscores may come in handy.

onyo.created_author -> onyo.git.created.author.name?

WDYT?

TobiasKadelka commented 2 weeks ago

While onyo.created_author -> onyo.git.created.author.name and others seem a bit lenghty, I think Bens idea is easier and more intuitive for the user.

aqw commented 2 weeks ago

I would suggest to go full namespace and not use underscores:

+1 I like this.

onyo.git.created.time                # datetime
onyo.git.created.author.name
onyo.git.created.author.email
onyo.git.created.committer.name
onyo.git.created.committer.email
onyo.git.created.commit              # commit-SHA

And the same stack for onyo.git.modified. it would be metadata about the most recent modification. No need for the full history. That's what git's commands (or onyo history) are for.

onyo.created_author -> onyo.git.created.author.name

I think it's OK, but not great.

My ideas are: onyo.creator and onyo.modifier as aliases. But I'm not in love with those either.

However, we don't have alias support yet, so there's no need to decide now. And aliases will not have any guarantee of stability. Only the full name,

bpoldrack commented 1 week ago

Implementing this in conjunction with #688, b/c it's fundamental to allow lazy loading for onyo.git. keys in particular.