Commit eb6bc45f by Ben Straub

Avoid uninitialized variable error.

parent 1d94a7d0
...@@ -506,8 +506,8 @@ static int handle_linear_syntax(git_object **out, git_object *obj, const char *m ...@@ -506,8 +506,8 @@ static int handle_linear_syntax(git_object **out, git_object *obj, const char *m
/* "~" is the same as "~1" */ /* "~" is the same as "~1" */
if (*movement == '\0') { if (*movement == '\0') {
n = 1; n = 1;
} else { } else if (git__strtol32(&n, movement, NULL, 0) < 0) {
git__strtol32(&n, movement, NULL, 0); return GIT_ERROR;
} }
commit1 = (git_commit*)obj; commit1 = (git_commit*)obj;
......
...@@ -104,6 +104,9 @@ void test_refs_revparse__to_type(void) ...@@ -104,6 +104,9 @@ void test_refs_revparse__to_type(void)
void test_refs_revparse__linear_history(void) void test_refs_revparse__linear_history(void)
{ {
cl_git_fail(git_revparse_single(&g_obj, g_repo, "foo~bar"));
cl_git_fail(git_revparse_single(&g_obj, g_repo, "master~bar"));
test_object("master~0", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750"); test_object("master~0", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
test_object("master~1", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"); test_object("master~1", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
test_object("master~2", "9fd738e8f7967c078dceed8190330fc8648ee56a"); test_object("master~2", "9fd738e8f7967c078dceed8190330fc8648ee56a");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment