Fix update_cached_repo(), set HEAD to origin/main.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
tastytea 2020-10-15 05:52:51 +02:00
parent 9707694be6
commit 43a29bfdba
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 3 additions and 1 deletions

View File

@ -250,11 +250,13 @@ void update_cached_repo(const uint8_t timeout)
fetch_opts.callbacks.credentials = cred_acquire;
check(git_remote_fetch(remote, nullptr, &fetch_opts, nullptr));
// FIXME: HEAD is detached.
git_checkout_options checkout_opts;
check(git_checkout_options_init(&checkout_opts,
GIT_CHECKOUT_OPTIONS_VERSION));
checkout_opts.checkout_strategy = GIT_CHECKOUT_FORCE;
check(git_repository_set_head(_repo, "refs/heads/main"));
check(git_repository_set_head(_repo, "refs/remotes/origin/main"));
check(git_checkout_head(_repo, &checkout_opts));
git_remote_free(remote);