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

git_backend: minor code cleanup + error handling #2472

Merged
merged 7 commits into from
Oct 30, 2023

Conversation

yuja
Copy link
Contributor

@yuja yuja commented Oct 30, 2023

Checklist

If applicable:

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

lib/src/git_backend.rs Outdated Show resolved Hide resolved
yuja added 7 commits October 31, 2023 06:37
The only error that could be returned by libgit2 is invalid hash length, and
we check that explicitly. If we switch the backends to gitoxide, there will be
panicking constructor.

https://docs.rs/git2/latest/git2/struct.Oid.html#method.from_bytes
Just for consistency with the other changes. str::Utf8Error is 2 words long,
so I removed the boxing.
If message() returned None, it doesn't mean the commit message is empty. I
originally mapped it to an error, but that made import of linux repo fail.

https://docs.rs/git2/latest/git2/struct.Commit.html#method.message
Both filemode() and kind() are calculated from the same underlying data,
and kind() is libgit2-specific API.
Only the committer timestamp can be updated inside a loop.
@yuja yuja force-pushed the push-kzqzlqwnxrlw branch from c15ccad to 5c11dd0 Compare October 30, 2023 21:38
@yuja yuja enabled auto-merge (rebase) October 30, 2023 21:39
@yuja yuja merged commit 1788b50 into jj-vcs:main Oct 30, 2023
14 checks passed
@yuja yuja deleted the push-kzqzlqwnxrlw branch October 30, 2023 21:51
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