Skip to content

Commit 05a1fc6

Browse files
committed
Clean up reflog reading error test
1 parent 0469c8e commit 05a1fc6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

docs/error-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ The public error API
128128
bugs, but in the meantime, please code defensively and check for NULL
129129
when calling this function.
130130
131-
- `void geterr_clear(void)`: This function clears the last error. The
131+
- `void giterr_clear(void)`: This function clears the last error. The
132132
library will call this when an error is generated by low level function
133133
and the higher level function handles the error.
134134

tests/refs/reflog/reflog.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,16 @@ void test_refs_reflog_reflog__reading_the_reflog_from_a_reference_with_no_log_re
157157
void test_refs_reflog_reflog__reading_a_reflog_with_invalid_format_returns_error(void)
158158
{
159159
git_reflog *reflog;
160-
git_error *error;
160+
const git_error *error;
161+
162+
/* clear the error state so we can capture the error generated by git_reflog_read */
163+
giterr_clear();
161164

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

164167
error = giterr_last();
165-
cl_assert(error);
168+
169+
cl_assert(error != NULL);
166170
cl_assert_equal_s("Unable to parse OID - contains invalid characters", error->message);
167171
}
168172

0 commit comments

Comments
 (0)