From 6fcb349e90d091c6b899cdebea0a26386b1e9148 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 9 Jan 2021 14:31:39 +0100 Subject: [PATCH] Add config variable: forge_repo_data_branch. --- src/config.hpp | 1 + src/git.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/config.hpp b/src/config.hpp index b000d50..4fa44d6 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -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 diff --git a/src/git.cpp b/src/git.cpp index 0c2aace..cd1b980 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -1,5 +1,5 @@ /* This file is part of FediBlock-backend. - * Copyright © 2020 tastytea + * Copyright © 2020, 2021 tastytea * * 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);