From 43a29bfdbacf564a96e4daee67671b4f1d50d2ad Mon Sep 17 00:00:00 2001 From: tastytea Date: Thu, 15 Oct 2020 05:52:51 +0200 Subject: [PATCH] Fix update_cached_repo(), set HEAD to origin/main. --- src/git.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/git.cpp b/src/git.cpp index 936ae49..e61e712 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -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);