Skip to content

Fix Blame::blame_buffer() with an empty buffer #1289

Merged
weihanglo merged 2 commits into
rust-lang:mainfrom
DanielEScherzer:blame-empty-buffer
Jul 8, 2026
Merged

Fix Blame::blame_buffer() with an empty buffer #1289
weihanglo merged 2 commits into
rust-lang:mainfrom
DanielEScherzer:blame-empty-buffer

Conversation

@DanielEScherzer

Copy link
Copy Markdown
Contributor

Fixes #1288

Note that if libgit2 is compiled with debug assertions then rather than
returning an error it will simply fail the assertion and abort.
If the buffer is empty, return an error without calling the libgit2 method.
When libgit2 is compiled in debug mode (or with assertions) this replaces a
failing assertion; when libgit2 is compiled without debug assertions this
results in an improved error message.

Fixes rust-lang#1288
@rustbot rustbot added the S-waiting-on-review Status: Waiting on review label Jul 8, 2026

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Thanks for it!

View changes since this review

@weihanglo weihanglo added this pull request to the merge queue Jul 8, 2026
Merged via the queue into rust-lang:main with commit 1af7203 Jul 8, 2026
8 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Waiting on review label Jul 8, 2026
@DanielEScherzer DanielEScherzer deleted the blame-empty-buffer branch July 8, 2026 23:04
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.

Blame::blame_buffer() with an empty buffer triggers assertion failures

3 participants