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 70650857edfdc7ca0e5a658944ec51dddddc65af
parent 8472c38a70c97d06af90072a53cd9826238afbd5
author Dimitrije Dobrota < mail@dimitrijedobrota.com >
date Thu, 22 May 2025 10:32:07 +0200

Use new version of git2wrap

Diffstat:
M CMakeLists.txt | +++++++ --
M source/branch.cpp | ++++++++ -------
M source/diff.cpp | ++++ ------
M source/repository.cpp | ++ --
M source/startgit-index.cpp | ++ -
M source/startgit.cpp | + -

6 files changed, 24 insertions(+), 19 deletions(-)


diff --git a/ CMakeLists.txt b/ CMakeLists.txt

@@ -15,7 +15,8 @@ include(cmake/variables.cmake)


# ---- Declare dependencies ----

find_package(git2wrap CONFIG REQUIRED)
find_package(based 0.2.0 CONFIG REQUIRED)
find_package(git2wrap 0.3.0 CONFIG REQUIRED)
find_package(hemplate 0.4 CONFIG REQUIRED)
find_package(md4c CONFIG REQUIRED)
find_package(poafloc 1.2 CONFIG REQUIRED)

@@ -36,7 +37,11 @@ add_library(

source/utils.cpp
)

target_link_libraries(startgit_lib PUBLIC git2wrap::git2wrap hemplate::hemplate poafloc::poafloc md4c::md4c-html)
target_link_libraries(startgit_lib PUBLIC based::based)
target_link_libraries(startgit_lib PUBLIC git2wrap::git2wrap)
target_link_libraries(startgit_lib PUBLIC hemplate::hemplate)
target_link_libraries(startgit_lib PUBLIC poafloc::poafloc)
target_link_libraries(startgit_lib PUBLIC md4c::md4c-html)

target_include_directories(
startgit_lib ${warning_guard}

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

@@ -36,16 +36,17 @@ branch::branch(git2wrap::branch brnch, repository& repo)

const auto full_path =
(!path.empty() ? path + "/" : "") + entry.get_name();

switch (entry.get_type()) {
case GIT_OBJ_BLOB:
using object_type = git2wrap::object::object_type;
switch (entry.get_type()()) {
case object_type::blob():
break;
case GIT_OBJ_TREE:
case object_type::tree():
traverse(entry.to_tree(), full_path);
continue;
case GIT_OBJECT_ANY:
case GIT_OBJECT_INVALID:
case GIT_OBJECT_COMMIT:
case GIT_OBJECT_TAG:
case object_type::any():
case object_type::invalid():
case object_type::commit():
case object_type::tag():
continue;
}

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

@@ -12,14 +12,12 @@ diff::diff(const git2wrap::commit& cmmt)

: git2wrap::tree(nullptr, nullptr);

git2wrap::diff_options opts;
git_diff_init_options(&opts, GIT_DIFF_OPTIONS_VERSION);

// NOLINTBEGIN(*hicpp-signed-bitwise*)
opts.flags = GIT_DIFF_DISABLE_PATHSPEC_MATCH | GIT_DIFF_IGNORE_SUBMODULES
| GIT_DIFF_INCLUDE_TYPECHANGE;
// NOLINTEND(*hicpp-signed-bitwise*)
using flag = git2wrap::diff_options::flag;
opts.flags() = flag::disable_pathspec_match | flag::ignore_submodules
| flag::include_typechange;

m_diff = git2wrap::diff::tree_to_tree(ptree, cmmt.get_tree(), &opts);
m_diff = git2wrap::diff::tree_to_tree(ptree, cmmt.get_tree(), opts);
m_stats = m_diff.get_stats();
}

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

@@ -8,7 +8,7 @@ namespace startgit

repository::repository(const std::filesystem::path& path)
: m_path(path)
, m_repo(git2wrap::repository::open(
path.c_str(), GIT_REPOSITORY_OPEN_NO_SEARCH, nullptr
path.c_str(), git2wrap::repository::flags_open::no_search, nullptr
))
, m_name(path.stem().string())
, m_url(read_file(path, "url"))

@@ -16,7 +16,7 @@ repository::repository(const std::filesystem::path& path)

, m_description(read_file(path, "description"))
{
// Get branches
for (auto it = m_repo.branch_begin(GIT_BRANCH_LOCAL);
for (auto it = m_repo.branch_begin(git2wrap::branch::flags_list::local);
it != m_repo.branch_end();
++it)
{

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

@@ -10,6 +10,7 @@

#include "arguments.hpp"
#include "document.hpp"
#include "repository.hpp"

namespace startgit
{

@@ -37,7 +38,7 @@ hemplate::element write_table_row(const std::filesystem::path& repo_path)

std::cerr << std::format(
"Warning: {} doesn't have master branch\n", repo.get_path().string()
);
} catch (const git2wrap::error<git2wrap::error_code_t::ENOTFOUND>& err) {
} catch (const git2wrap::error<git2wrap::error_code_t::enotfound>& err) {
std::cerr << std::format(
"Warning: {} is not a repository\n", repo_path.string()
);

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

@@ -829,7 +829,7 @@ int main(int argc, char* argv[])

std::ofstream rss(base_branch / "rss.xml");
write_rss(rss, branch, absolute);
}
} catch (const git2wrap::error<git2wrap::error_code_t::ENOTFOUND>& err) {
} catch (const git2wrap::error<git2wrap::error_code_t::enotfound>& err) {
std::cerr << std::format(
"Warning: {} is not a repository\n", args.repos[0].string()
);