Add config variable: forge_repo_data_branch.

This commit is contained in:
tastytea 2021-01-09 14:31:39 +01:00
parent a104beff6f
commit 6fcb349e90
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 6 additions and 2 deletions

View File

@ -12,6 +12,7 @@ inline constexpr string_view forge_domain{"schlomp.space"};
inline constexpr string_view forge_org{"FediBlock"};
inline constexpr string_view forge_repo_backend{"backend"};
inline constexpr string_view forge_repo_data{"data"};
inline constexpr string_view forge_repo_data_branch{"main"};
} // namespace FediBlock::config

View File

@ -1,5 +1,5 @@
/* This file is part of FediBlock-backend.
* Copyright © 2020 tastytea <tastytea@tastytea.de>
* Copyright © 2020, 2021 tastytea <tastytea@tastytea.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@ -59,6 +59,7 @@ using std::uint8_t;
using std::this_thread::sleep_for;
using namespace std::chrono_literals;
using namespace FediBlock::config;
git_repository *_repo{nullptr};
const string _clone_url{format("git@{:s}:{:s}/{:s}.git", config::forge_domain,
@ -269,7 +270,9 @@ void update_cached_repo(const uint8_t timeout)
GIT_CHECKOUT_OPTIONS_VERSION));
checkout_opts.checkout_strategy = GIT_CHECKOUT_FORCE;
check(git_repository_set_head(_repo, "refs/remotes/origin/main"));
check(git_repository_set_head(_repo, format("refs/remotes/origin/{:s}",
forge_repo_data_branch)
.c_str()));
check(git_checkout_head(_repo, &checkout_opts));
git_remote_free(remote);