drewdeponte / git-ps-rs

Official git-ps Rust implementation - the future of git-ps
https://git-ps.sh
MIT License
78 stars 8 forks source link

Use git-notes to store the git-ps-id meta-data. #269

Closed jameswalmsley closed 10 months ago

jameswalmsley commented 10 months ago

I think it might be possible to use git-notes to store the git-ps-id, and keep it in the "official" git metadata store instead of directly on the commit message.

I was wondering your thoughts on this?

jameswalmsley commented 10 months ago

e.g. Attach a note (under git-ps) ref for the HEAD commit).

git notes --ref=git-ps add -m "ps-id: 888ce562-1a4d-4724-8039-3073dbe79a35"
git notes --ref=git-ps show HEAD

outputs:

ps-id: 888ce562-1a4d-4724-8039-3073dbe79a35
git log --show-notes=git-ps

outputs:

commit a6c51daf63a6b42de5291a8a14eea4a588b214db (HEAD -> master)
Author: James Walmsley <james.walmsley@chargepoint.com>
Date:   Sat Nov 4 02:56:30 2023 +0000

    feat(zephyr): some useful commit

Notes (git-ps):
    ps-id: 888ce562-1a4d-4724-8039-3073dbe79a35

But a standard git log would not show this. The notes themselves don't have to be pushed to the remote, but can remain local if desired.

jameswalmsley commented 10 months ago

To ensure that rewrites (rebase & amend) preserve the notes:

git config notes.rewriteRef refs/notes/git-ps
drewdeponte commented 10 months ago

I thought about this at one point.

But there are couple problems with this.

  1. I believe I heard that git notes are being deprecated and will eventually be removed
  2. There are scenarios where the users of gps needs to select one of two ps ids. For example, if you have two patches and you decide to squash them together. You have to pick one of the ps-ids to keep and the other to get rid of. So it needs to be something that the users are aware of and can modify.

Also, I think especially with a user base of primarily developers it is generally a better approach to educate than try and hide things from them.

Beyond that, historically it has proven to facilitate the natural spread of Git Patch Stack due to people asking about it in PRs. Which I think is a good thing. Even to the point that I have contemplated actually making it come with a tag line and URL or something.

jameswalmsley commented 10 months ago

Ok that makes sense. I was just playing around with it, and there's a few potential complications anyway. Yes agree the ps-id in the message gets people curious.

I was thinking about scenarios where some developers might be asked not to leave ps-id information in their commit messages. E.g. for devs who work at corporations that might have overly strict / unreasonable rules.

I might be over-thinking a scenario that doesn't really exist..

Feel free to close this issue :)

drewdeponte commented 10 months ago

Yeah, I know we added the HTML comment around it because people worked on teams where people were complaining about it. So the HTML comment hides it in GitHub PRs.

To be honest though. I am more of the mindset of having a tag line to spread the word with a URL to the site now days. It isn't that big of a deal to have a small tagline at the end of the commit, especially if it is a functional tag line.

Alizter commented 10 months ago

Since we don't need the ps-id anymore, we should definitely make this a configurable option. I have worked on projects where a clean commit history is necessary, which can make the automatic incusion of psids annoying.

drewdeponte commented 10 months ago

We STILL NEED ps-id. It is how we track a patch when they have different commit shas.

jameswalmsley commented 10 months ago

I'm going to close this now, as its obvious notes is really a viable solution to storing the ps-id.