diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-12-14 16:56:38 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-12-14 17:04:02 +0100 |
commit | 4aa23369660726479f2c3e4cbee2cd51497ad00b (patch) | |
tree | caa55d5238634a990f29f39b4da446fb67aca40c | |
parent | 020aab9308fe30a9e7c9930514e4a5203981427e (diff) | |
download | libgit2-4aa23369660726479f2c3e4cbee2cd51497ad00b.tar.gz |
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.
-rw-r--r-- | tests/network/fetchlocal.c | 12 |
1 files changed, 12 insertions, 0 deletions
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)); |