Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

errors: refactoring - never returnNULL ingit_error_last()#6625

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethomson merged 8 commits intomainfromethomson/error_updates
Sep 5, 2023

Conversation

ethomson
Copy link
Member

As a consumer, you often just want to printgit_error_last()->message on an error. This would be irresponsible sincegit_error_last() can returnNULL. Instead, always returnno error when there's no error.Fixes#6618

@ethomsonethomsonforce-pushed theethomson/error_updates branch 6 times, most recently fromd33c958 to4361960CompareAugust 20, 2023 13:57
@ethomsonethomsonforce-pushed theethomson/error_updates branch 3 times, most recently from84c5af5 to268f9d7CompareSeptember 2, 2023 19:26
The error handling in the ssh certificate callback is straightforward.There's no error messages from an external library that need to besaved, we populate the error message ourselves. Since there's nothingcustom here, it does not need to use the error saving mechanism.
Callers want to be able to simply call `git_error_last()->message`,not have to worry about whether `git_error_last()` returns NULL or not.
Most callers only need to _get_ error messages. Only callers implementedmore complicated functions (like a custom ODB for example) need to setthem.(Callback users should likely ferry their own error information in theircallback payload.)
Instead of having a separate type for saving state, we can re-use the`git_error` structure. In practice, saving the error code along with the`git_error` information has not proven necessary or useful, so it can beremoved to simplify down to re-using a single structure.
Now that thread-local error data is handled in error, move the threadlocal data out of the `threadstate` object, since it has now becomeuseless indirection.
We now have no "big single object" that contains thread state.
@ethomsonethomson merged commit4939fa7 intomainSep 5, 2023
@ethomsonethomson deleted the ethomson/error_updates branchOctober 9, 2023 19:56
@ethomsonethomson added the bug labelDec 14, 2023
klayoutmatthias pushed a commit to KLayout/klayout that referenced this pull requestMar 23, 2024
`git_error_set_str` was moved into the `sys` subdirectory in libgit21.8.0. See [this pullrequest](libgit2/libgit2#6625) for details and[this issue](libgit2/libgit2#6776) for morecontext.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

git_error_last() should never return NULL
1 participant
@ethomson

[8]ページ先頭

©2009-2025 Movatter.jp