{{ message }}
Repository navigation
Conversation
Check errors while adding or updating files and writing the index so that lg2 add reports failure instead of silently returning success. Reuse check_lg2 to print the libgit2 error and exit with a nonzero status; the commit example already checks the index write this way.
demrom
marked this pull request as ready for review
October 14, 2026 17:45
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

lg2 addreturns success when adding files to the index or writing it fails.Check
git_index_add_all,git_index_update_allandgit_index_writewith the existingcheck_lg2helper. The commit example already checks the write.This prints 0 before the change and 1 afterward, with "Could not write index" and the lock error. An unreadable file also changes from exit 0 to 1 with "Could not add files to index".
--dry-runstill reaches the write, so a held lock now makes it fail too.examples/has no test suite, so no automated test is added.