startgit

Static page generator for git repositories
git clone git://git.dimitrijedobrota.com/startgit.git
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING

commit 8182915848277d6272bfd1e0e8fdbe7abe3544bc
parent dff5c0019408add622a268879a7e9f3801175b53
author Dimitrije Dobrota <mail@dimitrijedobrota.com>
date Mon, 14 Apr 2025 16:00:29 +0200

Remove branch dropdown * Before a re-render of every page was needed on new branch add * Always update refs for new branch and tag

Diffstat:
M source/startgit.cpp | +++ ----------------------

1 files changed, 3 insertions(+), 22 deletions(-)


diff --git a/ source/startgit.cpp b/ source/startgit.cpp

@@ -27,26 +27,6 @@ void write_title(std::ostream& ost, { using namespace hemplate; // NOLINT
const auto dropdown = [&]()
{
auto span = html::span();
span.add(html::label("Branch: ").set("for", "branch"));
span.add(html::select(
{{"id", "branch"}, {"onChange", "switchPage(this.value)"}}));
for (const auto& c_branch : repo.get_branches()) {
auto option = html::option(c_branch.get_name());
option.set("value", c_branch.get_name());
if (c_branch.get_name() == branch.get_name()) {
option.set("selected", "true");
}
span.add(option);
}
span.add(html::select());
return span;
}();
ost << html::table(); ost << html::tr().add(html::td() .add(html::h1(repo.get_name()))

@@ -69,7 +49,6 @@ void write_title(std::ostream& ost, ost << html::text(" | ") << html::a(name).set("href", relpath + filename); }
ost << html::text(" | ") << dropdown;
ost << html::td() << html::tr(); ost << html::table();

@@ -683,6 +662,9 @@ int main(int argc, char* argv[]) const std::filesystem::path commit = base_branch / "commit"; std::filesystem::create_directory(commit);
// always update refs in case of a new branch or tag
write_refs(base_branch, repo, branch);
const bool changed = write_commits(commit, repo, branch); if (!args.force && !changed) { continue;

@@ -690,7 +672,6 @@ int main(int argc, char* argv[]) write_log(base_branch, repo, branch); write_file(base_branch, repo, branch);
write_refs(base_branch, repo, branch);
write_readme_licence(base_branch, repo, branch); const std::filesystem::path file = base_branch / "file";