-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remember all previously verified configurations #300
Comments
Echoing what @sds informed me about when I ran into the same issue:
So something like OVERCOMMIT_DISABLE=1 git pull origin master |
@trotzig @sds Thanks to both for that. It's certainly more convenient than the workaround I ended up using:
I still think this is undesirable and shouldn't be necessary but if the fix is difficult to implement, I find the workaround acceptable. |
You raise a good point, @deivid-rodriguez. It would be nice if Overcommit remembered all previously-signed configurations. |
@sds also even if it hasn't remembered previous states, it probably shouldn't end up leaving the branch in a detached state with no obvious way to recover or continue the rebase after signing. |
Is this still alive? Ran into this today after making changes to |
would really like this to land. Assume you folks would accept a pull request? Any pointers for where to start with the signatures? |
Would love a PR addressing this, @benbernard! You'll need to modify the This may involve creating a different storage format for the configuration value so that a quick lookup can be performed (emphasis on quick—the list of signatures will potentially grow quite large with time, so this needs to be something supporting a constant-time lookup). Hope that helps! |
@sds are you suggesting better than O(fileSize) like you want to do a search on disk? That seems like overkill. If we are going to read the whole file into memory to load it into a hash (like with a protobuf or a json file) it seems like that will get an O(fileSize) step, and so an addition single O(fileSize) search for an exact match in the set of strings won't actually take a long time. Seems like signatures will grow at a rate O(number of .overcommit or custom .githooks) changes, that doesn't seem prohibitively large. Something simple like a SHA/signature per line seems like it would be reasonable? I'm just trying to answer some questions on approach before I dive in :) Thanks for the assist! |
I could also keep the most recent signature on "top" of the file and probably keep O() costs the same if the signature exists and is the most recent signature (the happy case) and only incur O(fileSize) search when there is no immediate match |
Another option would be to limit the # of signatures that we store, like cap it at like 1,000, that would prevent it from growing too large |
Hey @benbernard, agree it's probably not crucial to address this, but I've seen some pretty weird use cases from users of this tool so I tend to not rule these possibilities out. In this case, I like the idea of capping the number of signatures and storing the most-recently-created signature at the beginning of the file. Note that storing at the beginning of the file will require we store this outside of the |
yeah 100%, don't store in |
Storing in |
Any progress on this? |
I'd love to have this as well! If nobody is currently working on it, I might open a PR to address it. What I'd propose is:
Thoughts? |
Sounds like a plan to me, the code also needs some tests, as I didn't have
time to write any when I originally developed this
…On Fri, May 27, 2022, 9:47 AM Tony Novak ***@***.***> wrote:
I'd love to have this as well! If nobody is currently working on it, I
might open a PR to address it.
What I'd propose is:
- Add a new git config variable,
overcommit.configuration.signaturehistory, which determines how many
historical signatures we keep. Maybe default it to 5 or so.
- When a new signature is generated:
- Let VAR be the name of the config variable it's stored in (e.g.
overcommit.configuration.signature or
overcommit.HookType.HookName.signature)
- If a signature already exists, and it's different from the new
one:
- For any signature variables with the same name but a numeric
suffix (VAR.1, VAR.2, etc), increment the key, dropping the last
one if it exceeds overcommit.configuration.signaturehistory
- Store the current signature in VAR.1
- Store the new signature in VAR
Thoughts?
—
Reply to this email directly, view it on GitHub
<#300 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADFKE3BFT7T5YYG664DSC3VMD4CDANCNFSM4BVITAAA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I can't rebase to past revisions with different overcommit configurations. I end up in a detached state. I tried disabling signature verification but it will only work for commits after disabling the check.
This behavior is weird since I've already acknowledged all past revisions of overcommit's config, so I shouldn't need to verify them again. The only solution I've found it to completely uninstall overcommit hooks just for the rebase.
Let me know if you need more information.
Thanks!
The text was updated successfully, but these errors were encountered: