Skip to content
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

Let backend return possibly adjusted commit on write #1604

Merged
merged 2 commits into from
May 12, 2023

Conversation

martinvonz
Copy link
Owner

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (src/config-schema.json)
  • I have added tests to cover my changes

lib/src/git_backend.rs Outdated Show resolved Hide resolved
lib/src/git_backend.rs Outdated Show resolved Hide resolved
@martinvonz martinvonz force-pushed the push-xvtpuzkpkszx branch 2 times, most recently from 24eebc3 to 4d3191e Compare May 12, 2023 12:42
The internal backend at Google doesn't let you write any value you
want for in the committer field. The `Store` type still caches the
value it attempted to write, which gets a little weird when the
written value is not what we tried to write. We should use the value
the backend actually wrote. However, we don't know if the backend
changed anything without reading the value back, which is often
wasteful. This commit changes the API to return the written value.

I only changed the signature of `write_commit()` for now. Maybe we
should make a similar change to `write_tree()`.
@martinvonz martinvonz force-pushed the push-xvtpuzkpkszx branch 2 times, most recently from 8dadae1 to 4688a46 Compare May 12, 2023 21:45
@martinvonz martinvonz enabled auto-merge (rebase) May 12, 2023 21:47
Now that we return the written commit from `write_commit()`, let's
make the timestamps match what was actually written, accounting for
the whole-second precision and the adjustment we do to avoid
collisions.
@martinvonz martinvonz merged commit 87a925d into main May 12, 2023
@martinvonz martinvonz deleted the push-xvtpuzkpkszx branch May 12, 2023 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants