From 4aa23369660726479f2c3e4cbee2cd51497ad00b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sun, 14 Dec 2014 16:56:38 +0100 Subject: [PATCH] fetch: assert we don't call update tips when there are no upates This is hiding a bug in the prune code, whereby we prune references we shouldn't but don't notice it in the code afterwards because update_tips() recreates them. This means that we do perform changes to the references (and get rid of the reflogs) when we shouldn't. --- tests/network/fetchlocal.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/network/fetchlocal.c b/tests/network/fetchlocal.c index 9bfa48844..a278da3fb 100644 --- a/tests/network/fetchlocal.c +++ b/tests/network/fetchlocal.c @@ -115,6 +115,17 @@ void test_network_fetchlocal__prune(void) git_repository_free(repo); } +int update_tips_fail_on_call(const char *ref, const git_oid *old, const git_oid *new, void *data) +{ + GIT_UNUSED(ref); + GIT_UNUSED(old); + GIT_UNUSED(new); + GIT_UNUSED(data); + + cl_fail("update tips called"); + return 0; +} + void test_network_fetchlocal__prune_overlapping(void) { git_repository *repo; @@ -160,6 +171,7 @@ void test_network_fetchlocal__prune_overlapping(void) cl_git_pass(git_remote_lookup(&origin, repo, GIT_REMOTE_ORIGIN)); git_remote_set_prune_refs(origin, true); + callbacks.update_tips = update_tips_fail_on_call; git_remote_set_callbacks(origin, &callbacks); cl_git_pass(git_remote_fetch(origin, NULL, NULL, NULL));