mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-03 14:12:22 +00:00
Fix 2 bugs in online::push tests.
- Fix stack corruption introduced in 9bccf33c due to passing pointer to local variable _cred_acquire_called. - Fix strcmp in do_verify_push_status when expected or actual push_status is NULL
This commit is contained in:
parent
e1859ea184
commit
96447d24f3
@ -14,6 +14,7 @@ static char *_remote_user;
|
||||
static char *_remote_pass;
|
||||
|
||||
static git_remote *_remote;
|
||||
static bool _cred_acquire_called;
|
||||
static record_callbacks_data _record_cbs_data = {{ 0 }};
|
||||
static git_remote_callbacks _record_cbs = RECORD_CALLBACKS_INIT(&_record_cbs_data);
|
||||
|
||||
@ -79,7 +80,9 @@ static void do_verify_push_status(git_push *push, const push_status expected[],
|
||||
else
|
||||
git_vector_foreach(&actual, i, iter)
|
||||
if (strcmp(expected[i].ref, iter->ref) ||
|
||||
(expected[i].msg && strcmp(expected[i].msg, iter->msg))) {
|
||||
(expected[i].msg && !iter->msg) ||
|
||||
(!expected[i].msg && iter->msg) ||
|
||||
(expected[i].msg && iter->msg && strcmp(expected[i].msg, iter->msg))) {
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
@ -231,7 +234,7 @@ void test_online_push__initialize(void)
|
||||
git_vector delete_specs = GIT_VECTOR_INIT;
|
||||
size_t i;
|
||||
char *curr_del_spec;
|
||||
bool cred_acquire_called = false;
|
||||
_cred_acquire_called = false;
|
||||
|
||||
_repo = cl_git_sandbox_init("push_src");
|
||||
|
||||
@ -272,7 +275,7 @@ void test_online_push__initialize(void)
|
||||
if (_remote_url) {
|
||||
cl_git_pass(git_remote_create(&_remote, _repo, "test", _remote_url));
|
||||
|
||||
git_remote_set_cred_acquire_cb(_remote, cred_acquire_cb, &cred_acquire_called);
|
||||
git_remote_set_cred_acquire_cb(_remote, cred_acquire_cb, &_cred_acquire_called);
|
||||
record_callbacks_data_clear(&_record_cbs_data);
|
||||
git_remote_set_callbacks(_remote, &_record_cbs);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user