Visitar URL original
Fix segfault when reading reflog with extra newlines by srajko · Pull Request #2 · nodegit/libgit2 · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Clean up reflog reading error test
  • Loading branch information
srajko committed Oct 19, 2015
commit 05a1fc62818dfa37bcdfda4591364c85b83d185e
2 changes: 1 addition & 1 deletion docs/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ The public error API
bugs, but in the meantime, please code defensively and check for NULL
when calling this function.

- `void geterr_clear(void)`: This function clears the last error. The
- `void giterr_clear(void)`: This function clears the last error. The
library will call this when an error is generated by low level function
and the higher level function handles the error.

Expand Down
8 changes: 6 additions & 2 deletions tests/refs/reflog/reflog.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,16 @@ void test_refs_reflog_reflog__reading_the_reflog_from_a_reference_with_no_log_re
void test_refs_reflog_reflog__reading_a_reflog_with_invalid_format_returns_error(void)
{
git_reflog *reflog;
git_error *error;
const git_error *error;

/* clear the error state so we can capture the error generated by git_reflog_read */
giterr_clear();

cl_git_fail(git_reflog_read(&reflog, g_repo, "refs/heads/extra-newline"));

error = giterr_last();
cl_assert(error);

cl_assert(error != NULL);
cl_assert_equal_s("Unable to parse OID - contains invalid characters", error->message);
}

Expand Down