From e58632d2ec94add20ca26d60f0af17895e0bbe5d Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Sun, 29 Aug 2021 14:23:31 +0300 Subject: [PATCH 01/19] update libgit2 to v1.1.0 --- CMakeLists.txt | 2 +- include/git2cpp/remote.h | 8 ++++---- include/git2cpp/str_array.h | 2 +- libs/libgit2 | 2 +- src/remote.cpp | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f6011e..e9712f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ project (libgit2cpp) -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.5.1) # Build options OPTION(USE_BOOST "Enable use of boost header libraries" OFF) diff --git a/include/git2cpp/remote.h b/include/git2cpp/remote.h index 8630f63..1908623 100644 --- a/include/git2cpp/remote.h +++ b/include/git2cpp/remote.h @@ -4,8 +4,8 @@ struct git_remote; struct git_oid; -struct git_transfer_progress; -struct git_cred; +struct git_indexer_progress; +struct git_credential; namespace git { @@ -18,9 +18,9 @@ namespace git { virtual void update_tips(char const * refname, git_oid const & a, git_oid const & b) {} virtual void sideband_progress(char const * str, int len) {} - virtual void transfer_progress(git_transfer_progress const &) {} + virtual void transfer_progress(git_indexer_progress const &) {} - virtual git_cred* acquire_cred(const char * url, const char * username_from_url, unsigned int allowed_types) = 0; + virtual git_credential* acquire_cred(const char * url, const char * username_from_url, unsigned int allowed_types) = 0; }; void fetch(FetchCallbacks &, char const * reflog_message = nullptr); diff --git a/include/git2cpp/str_array.h b/include/git2cpp/str_array.h index 5345de5..6c02abc 100644 --- a/include/git2cpp/str_array.h +++ b/include/git2cpp/str_array.h @@ -36,7 +36,7 @@ namespace git ~StrArray() { - git_strarray_free(&str_array_); + git_strarray_dispose(&str_array_); } private: diff --git a/libs/libgit2 b/libs/libgit2 index 7ce88e6..7f4fa17 160000 --- a/libs/libgit2 +++ b/libs/libgit2 @@ -1 +1 @@ -Subproject commit 7ce88e66a19e3b48340abcdd86aeaae1882e63cc +Subproject commit 7f4fa178629d559c037a1f72f79f79af9c1ef8ce diff --git a/src/remote.cpp b/src/remote.cpp index b39f9aa..04543b9 100644 --- a/src/remote.cpp +++ b/src/remote.cpp @@ -31,13 +31,13 @@ namespace git callbacks->sideband_progress(str, len); return 0; }; - opts.callbacks.transfer_progress = [] (git_transfer_progress const * stats, void * data) + opts.callbacks.transfer_progress = [] (git_indexer_progress const * stats, void * data) { auto callbacks = static_cast(data); callbacks->transfer_progress(*stats); return 0; }; - opts.callbacks.credentials = [] (git_cred ** out, char const *url, char const * user_from_url, unsigned int allowed_types, void * data) + opts.callbacks.credentials = [] (git_credential ** out, char const *url, char const * user_from_url, unsigned int allowed_types, void * data) { auto callbacks = static_cast(data); auto cred = callbacks->acquire_cred(url, user_from_url, allowed_types); From 8f446b47ace5c076a9f2cb875b5ddac64c1c519b Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Mon, 18 Oct 2021 22:30:06 +0300 Subject: [PATCH 02/19] fix examples/blame.cpp after update of libgit2 --- examples/blame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/blame.cpp b/examples/blame.cpp index 3a639d8..b20ea01 100644 --- a/examples/blame.cpp +++ b/examples/blame.cpp @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) * Get the raw data inside the blob for output. We use the * `commitish:path/to/file.txt` format to find it. */ - std::string spec = git_oid_iszero(&blameopts.newest_commit) + std::string spec = git_oid_is_zero(&blameopts.newest_commit) ? "HEAD" : git::id_to_str(blameopts.newest_commit); spec += ":"; From c6ea3ab97ee1857fb99e07117c451fccec48f7ae Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Mon, 18 Oct 2021 22:34:03 +0300 Subject: [PATCH 03/19] update libgit2 to v1.3.0 --- examples/blame.cpp | 2 +- examples/log.cpp | 2 +- examples/rev-list.cpp | 2 +- examples/rev-parse.cpp | 2 +- libs/libgit2 | 2 +- src/revspec.cpp | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/blame.cpp b/examples/blame.cpp index b20ea01..dc589e3 100644 --- a/examples/blame.cpp +++ b/examples/blame.cpp @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) { auto revspec = repo.revparse(o.commitspec); - if (revspec.flags() & GIT_REVPARSE_SINGLE) + if (revspec.flags() & GIT_REVSPEC_SINGLE) { blameopts.newest_commit = revspec.single()->id(); } diff --git a/examples/log.cpp b/examples/log.cpp index 47a9b29..aa04446 100644 --- a/examples/log.cpp +++ b/examples/log.cpp @@ -118,7 +118,7 @@ void add_revision(struct log_state * s, const char * revstr) git::Revspec::Range const & range = *revs.range(); push_rev(s, range.to, hide); - if ((revs.flags() & GIT_REVPARSE_MERGE_BASE) != 0) + if ((revs.flags() & GIT_REVSPEC_MERGE_BASE) != 0) { git_oid base = s->repo->merge_base(range); push_rev(s, s->repo->commit_lookup(base), hide); diff --git a/examples/rev-list.cpp b/examples/rev-list.cpp index b6e7955..3adc8c5 100644 --- a/examples/rev-list.cpp +++ b/examples/rev-list.cpp @@ -28,7 +28,7 @@ void push_range(Repository const & repo, RevWalker const & walk, const char * ra { auto revspec = repo.revparse(range); - if (revspec.flags() & GIT_REVPARSE_MERGE_BASE) + if (revspec.flags() & GIT_REVSPEC_MERGE_BASE) { /* TODO: support "..." */ throw std::runtime_error("unsupported operation"); diff --git a/examples/rev-parse.cpp b/examples/rev-parse.cpp index 37bf368..9c14b1e 100644 --- a/examples/rev-parse.cpp +++ b/examples/rev-parse.cpp @@ -43,7 +43,7 @@ void parse_revision(parse_state & ps, const char * revstr) auto const & range = *rs.range(); std::cout << id_to_str(range.to.id()) << std::endl; - if ((rs.flags() & GIT_REVPARSE_MERGE_BASE) != 0) + if ((rs.flags() & GIT_REVSPEC_MERGE_BASE) != 0) { git_oid base = ps.repo->merge_base(range); std::cout << id_to_str(base) << std::endl; diff --git a/libs/libgit2 b/libs/libgit2 index 7f4fa17..b7bad55 160000 --- a/libs/libgit2 +++ b/libs/libgit2 @@ -1 +1 @@ -Subproject commit 7f4fa178629d559c037a1f72f79f79af9c1ef8ce +Subproject commit b7bad55e4bb0a285b073ba5e02b01d3f522fc95d diff --git a/src/revspec.cpp b/src/revspec.cpp index 0de9d5a..ba3b9cd 100644 --- a/src/revspec.cpp +++ b/src/revspec.cpp @@ -3,14 +3,14 @@ namespace git { Revspec::Revspec(git_object * single, Repository const & repo) - : flags_(GIT_REVPARSE_SINGLE) + : flags_(GIT_REVSPEC_SINGLE) , revspec_(single, repo) { } Revspec::Revspec(git_revspec const & revspec, Repository const & repo) : flags_(revspec.flags) - , revspec_((revspec.flags & GIT_REVPARSE_SINGLE) + , revspec_((revspec.flags & GIT_REVSPEC_SINGLE) ? Range(revspec.from, repo) : Range(revspec, repo)) { @@ -18,7 +18,7 @@ namespace git Object * Revspec::single() { - if (flags_ & GIT_REVPARSE_SINGLE) + if (flags_ & GIT_REVSPEC_SINGLE) return &revspec_.from; else return nullptr; @@ -26,7 +26,7 @@ namespace git Revspec::Range const * Revspec::range() const { - if (flags_ & GIT_REVPARSE_SINGLE) + if (flags_ & GIT_REVSPEC_SINGLE) return nullptr; else return &revspec_; From 385f56d8abfe4da2dfaa7c82628f689cf286a727 Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Tue, 16 Nov 2021 09:43:39 +0300 Subject: [PATCH 04/19] 'clone' exported from libgit2 examples (#15) --- CMakeLists.txt | 1 + examples/clone.cpp | 130 +++++++++++++++++++++++++++++++++++++++ include/git2cpp/remote.h | 4 ++ include/git2cpp/repo.h | 15 +++++ src/remote.cpp | 10 ++- src/repo.cpp | 23 +++++++ 6 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 examples/clone.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index e9712f4..b7db2c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,7 @@ if(BUILD_LIBGIT2CPP_EXAMPLES) checkout ls-files blame + clone ) foreach (example ${examples}) diff --git a/examples/clone.cpp b/examples/clone.cpp new file mode 100644 index 0000000..ee5d266 --- /dev/null +++ b/examples/clone.cpp @@ -0,0 +1,130 @@ +#include "git2cpp/initializer.h" +#include "git2cpp/remote.h" +#include "git2cpp/repo.h" + +#include + +#include + +/* Define the printf format specifer to use for size_t output */ +#if defined(_MSC_VER) || defined(__MINGW32__) +# define PRIuZ "Iu" +# define PRIxZ "Ix" +# define PRIdZ "Id" +#else +# define PRIuZ "zu" +# define PRIxZ "zx" +# define PRIdZ "zd" +#endif + +namespace +{ + struct progress_data + { + git_indexer_progress fetch_progress; + size_t completed_steps; + size_t total_steps; + const char * path; + + void print() + { + int network_percent = fetch_progress.total_objects > 0 ? (100 * fetch_progress.received_objects) / fetch_progress.total_objects : 0; + int index_percent = fetch_progress.total_objects > 0 ? (100 * fetch_progress.indexed_objects) / fetch_progress.total_objects : 0; + + int checkout_percent = total_steps > 0 + ? (int)((100 * completed_steps) / total_steps) + : 0; + size_t kbytes = fetch_progress.received_bytes / 1024; + + if (fetch_progress.total_objects && + fetch_progress.received_objects == fetch_progress.total_objects) + { + printf("Resolving deltas %u/%u\r", + fetch_progress.indexed_deltas, + fetch_progress.total_deltas); + } + else + { + printf("net %3d%% (%4" PRIuZ " kb, %5u/%5u) / idx %3d%% (%5u/%5u) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ")%s\n", + network_percent, kbytes, + fetch_progress.received_objects, fetch_progress.total_objects, + index_percent, fetch_progress.indexed_objects, fetch_progress.total_objects, + checkout_percent, + completed_steps, total_steps, + path); + } + } + }; + + void checkout_progress(const char * path, size_t cur, size_t tot, void * payload) + { + progress_data * pd = static_cast(payload); + pd->completed_steps = cur; + pd->total_steps = tot; + pd->path = path; + pd->print(); + } + + struct FetchCallbacks final : git::Remote::FetchCallbacks + { + FetchCallbacks(progress_data & pd) + : pd_(pd) + { + } + + void sideband_progress(char const * str, int len) override + { + printf("remote: %.*s", len, str); + fflush(stdout); + } + + void transfer_progress(git_indexer_progress const & progress) override + { + pd_.fetch_progress = progress; + pd_.print(); + } + + git_credential * acquire_cred(const char * url, const char * username_from_url, unsigned allowed_types) override + { + return nullptr; + } + + private: + progress_data & pd_; + }; +} + +int main(int argc, char ** argv) +{ + /* Validate args */ + if (argc != 3) + { + printf("USAGE: %s \n", argv[0]); + return EXIT_FAILURE; + } + + auto_git_initializer; + + progress_data pd = {{0}}; + FetchCallbacks fetch_callbacks(pd); + git_checkout_options checkout_opts = {GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}; + /* Set up options */ + checkout_opts.progress_cb = checkout_progress; + checkout_opts.progress_payload = &pd; + const char * url = argv[1]; + const char * path = argv[2]; + /* Do the clone */ + try + { + git::Repository::clone(url, path, checkout_opts, fetch_callbacks); + } + catch (git::repository_clone_error err) + { + printf("\n"); + if (auto detailed_info = std::get_if(&err.data)) + printf("ERROR %d: %s\n", detailed_info->klass, detailed_info->message); + else + printf("ERROR %d: no detailed info\n", std::get(err.data)); + return EXIT_FAILURE; + } +} diff --git a/include/git2cpp/remote.h b/include/git2cpp/remote.h index 1908623..917e315 100644 --- a/include/git2cpp/remote.h +++ b/include/git2cpp/remote.h @@ -16,6 +16,10 @@ namespace git struct FetchCallbacks { + protected: + ~FetchCallbacks() = default; + + public: virtual void update_tips(char const * refname, git_oid const & a, git_oid const & b) {} virtual void sideband_progress(char const * str, int len) {} virtual void transfer_progress(git_indexer_progress const &) {} diff --git a/include/git2cpp/repo.h b/include/git2cpp/repo.h index b58b114..9b4ab3e 100644 --- a/include/git2cpp/repo.h +++ b/include/git2cpp/repo.h @@ -22,6 +22,7 @@ #include "internal/optional.h" #include +#include #include struct git_blame_options; @@ -33,6 +34,16 @@ namespace git struct missing_head_error {}; + struct repository_clone_error + { + struct detailed_info + { + char const* message; + int klass; + }; + std::variant data; + }; + enum class branch_type { LOCAL, @@ -158,11 +169,15 @@ namespace git Repository(const char * dir, init_tag, git_repository_init_options opts); Repository(std::string const & dir, init_tag); + static Repository clone(const char * url, const char* path, git_checkout_options const &, Remote::FetchCallbacks &); + static internal::optional discover(const char * start_path); private: struct Destroy { void operator() (git_repository *) const; }; std::unique_ptr repo_; + + explicit Repository(git_repository*); }; Object revparse_single(Repository const & repo, const char * spec); diff --git a/src/remote.cpp b/src/remote.cpp index 04543b9..a024701 100644 --- a/src/remote.cpp +++ b/src/remote.cpp @@ -14,8 +14,10 @@ namespace git return git_remote_pushurl(remote_.get()); } - void Remote::fetch(FetchCallbacks & callbacks, char const * reflog_message) + git_fetch_options fetch_options_from_callbacks(Remote::FetchCallbacks & callbacks) { + using FetchCallbacks = Remote::FetchCallbacks; + git_fetch_options opts = GIT_FETCH_OPTIONS_INIT; opts.callbacks.payload = &callbacks; @@ -46,6 +48,12 @@ namespace git *out = cred; return 0; }; + return opts; + } + + void Remote::fetch(FetchCallbacks & callbacks, char const * reflog_message) + { + const auto opts = fetch_options_from_callbacks(callbacks); git_remote_fetch(remote_.get(), nullptr, &opts, reflog_message); } diff --git a/src/repo.cpp b/src/repo.cpp index 514852a..e341a54 100644 --- a/src/repo.cpp +++ b/src/repo.cpp @@ -1,5 +1,7 @@ #include "git2cpp/repo.h" +#include "git2/clone.h" + #include "git2cpp/annotated_commit.h" #include "git2cpp/error.h" #include "git2cpp/internal/optional.h" @@ -22,6 +24,11 @@ namespace git { const Repository::init_tag Repository::init; + Repository::Repository(git_repository * repo) + : repo_(repo) + { + } + Repository::Repository(const char * dir) { git_repository * repo; @@ -55,6 +62,22 @@ namespace git repo_.reset(repo); } + git_fetch_options fetch_options_from_callbacks(Remote::FetchCallbacks &); + + Repository Repository::clone(const char * url, const char* path, git_checkout_options const & checkout_opts, Remote::FetchCallbacks & fetch_callbacks) + { + const git_clone_options clone_opts = { GIT_CLONE_OPTIONS_VERSION, checkout_opts, fetch_options_from_callbacks(fetch_callbacks) }; + git_repository *cloned_repo = nullptr; + if (auto error = git_clone(&cloned_repo, url, path, &clone_opts)) + { + if (auto err = git_error_last()) + throw repository_clone_error{ repository_clone_error::detailed_info{ err->message, err->klass } }; + else + throw repository_clone_error{ error }; + } + return Repository(cloned_repo); + } + bool Repository::is_bare() const { return git_repository_is_bare(repo_.get()) != 0; From 96ee7acc51fbfb2052580100f976e1e01b21cbe8 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 16 Nov 2021 10:14:27 +0300 Subject: [PATCH 05/19] Drop support of VS 2015 It's too old now, there is VS 2022 already. --- appveyor.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4baf481..cf75efc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,18 +6,10 @@ branches: environment: matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - GENERATOR: "Visual Studio 14 2015" - ARCH: 32 - BOOST: 1_63_0 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 GENERATOR: "Visual Studio 15 2017" ARCH: 32 BOOST: 1_65_1 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - GENERATOR: "Visual Studio 14 2015 Win64" - ARCH: 64 - BOOST: 1_63_0 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 GENERATOR: "Visual Studio 15 2017 Win64" ARCH: 64 From e6c2545c8696c274b3d17ec5df9be6349f3adb99 Mon Sep 17 00:00:00 2001 From: GravisZro Date: Sun, 4 Jun 2023 07:29:43 -0400 Subject: [PATCH 06/19] Update code for use with libgit2 version 1.7.0 --- examples/cat-file.cpp | 6 +++--- src/diff.cpp | 2 +- src/id_to_str.cpp | 4 ++-- src/repo.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/cat-file.cpp b/examples/cat-file.cpp index c27b80c..1b28176 100644 --- a/examples/cat-file.cpp +++ b/examples/cat-file.cpp @@ -64,7 +64,7 @@ void show_blob(git::Blob const & blob) void show_tree(git::Tree const & tree) { - char oidstr[GIT_OID_HEXSZ + 1]; + char oidstr[GIT_OID_SHA1_HEXSIZE + 1]; for (size_t i = 0, n = tree.entrycount(); i < n; ++i) { @@ -81,7 +81,7 @@ void show_tree(git::Tree const & tree) void show_commit(git::Commit const & commit) { - char oidstr[GIT_OID_HEXSZ + 1]; + char oidstr[GIT_OID_SHA1_HEXSIZE + 1]; git_oid_tostr(oidstr, sizeof(oidstr), &commit.tree_id()); printf("tree %s\n", oidstr); @@ -127,7 +127,7 @@ int main(int argc, char * argv[]) const char *dir = ".", *rev = nullptr; int i, verbose = 0; Action action = Action::NONE; - char oidstr[GIT_OID_HEXSZ + 1]; + char oidstr[GIT_OID_SHA1_HEXSIZE + 1]; for (i = 1; i < argc; ++i) { diff --git a/src/diff.cpp b/src/diff.cpp index 0ff4464..5c8ab85 100644 --- a/src/diff.cpp +++ b/src/diff.cpp @@ -100,7 +100,7 @@ namespace git Buffer Diff::Stats::to_buf(diff::stats::format::type format, size_t width) const { - git_buf buf = GIT_BUF_INIT_CONST(nullptr, 0); + git_buf buf = GIT_BUF_INIT; if (git_diff_stats_to_buf(&buf, stats_.get(), git_diff_stats_format_t(format.value()), width)) throw error_t("git_diff_stats_to_buf fail"); else diff --git a/src/id_to_str.cpp b/src/id_to_str.cpp index 48c48c9..b58dfb5 100644 --- a/src/id_to_str.cpp +++ b/src/id_to_str.cpp @@ -6,12 +6,12 @@ namespace git { std::string id_to_str(git_oid const & oid) { - return id_to_str(oid, GIT_OID_HEXSZ); + return id_to_str(oid, GIT_OID_SHA1_HEXSIZE); } std::string id_to_str(git_oid const & oid, size_t digits_num) { - char buf[GIT_OID_HEXSZ + 1]; + char buf[GIT_OID_SHA1_HEXSIZE + 1]; git_oid_tostr(buf, sizeof(buf), &oid); return std::string(buf, buf + digits_num); } diff --git a/src/repo.cpp b/src/repo.cpp index e341a54..bb59846 100644 --- a/src/repo.cpp +++ b/src/repo.cpp @@ -594,7 +594,7 @@ namespace git internal::optional Repository::discover(const char * start_path) { - git_buf buf = GIT_BUF_INIT_CONST(nullptr, 0); + git_buf buf = GIT_BUF_INIT; if (git_repository_discover(&buf, start_path, 0, nullptr)) return internal::none; return std::string(buf.ptr, buf.size); From eb35b274636b05f7756a973b8c74e5ec65b4d69d Mon Sep 17 00:00:00 2001 From: ballessay Date: Sun, 11 Jun 2023 01:59:35 +0200 Subject: [PATCH 07/19] Fix cmake warning Fixes the following warning: cmake_minimum_required() should be called prior to this top-level project() --- CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7db2c4..19dfadf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ -project (libgit2cpp) cmake_minimum_required(VERSION 3.5.1) +project (libgit2cpp) + # Build options OPTION(USE_BOOST "Enable use of boost header libraries" OFF) @@ -77,14 +78,14 @@ if(BUILD_LIBGIT2CPP_EXAMPLES) blame clone ) - + foreach (example ${examples}) add_executable("${example}-cpp" examples/${example}.cpp) target_link_libraries("${example}-cpp" git2cpp) endforeach(example) - + add_executable(commit-graph-generator examples/commit-graph-generator.cpp) target_link_libraries(commit-graph-generator git2cpp) - + file(COPY test.sh DESTINATION . FILE_PERMISSIONS ${EXE_PERM}) endif() From 664016c0b407322ad370563977e6ca7fce4861e5 Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Sun, 11 Jun 2023 11:28:53 +0200 Subject: [PATCH 08/19] + missing #include --- include/git2cpp/index.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/git2cpp/index.h b/include/git2cpp/index.h index 28e0bc5..2d899ad 100644 --- a/include/git2cpp/index.h +++ b/include/git2cpp/index.h @@ -4,6 +4,7 @@ #include #include +#include struct git_index; struct git_repository; From 9868e379e805a937197ea9c0bbb5da8918edc413 Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Sun, 11 Jun 2023 11:29:56 +0200 Subject: [PATCH 09/19] update version of bundled libgit2 after e6c2545c --- CMakeLists.txt | 5 +++-- libs/libgit2 | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7db2c4..901fd2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,10 +46,11 @@ if (BUNDLE_LIBGIT2) target_include_directories(git2cpp PUBLIC libs/libgit2/include ) + target_link_libraries(git2cpp libgit2package) +else() + target_link_libraries(git2cpp LibGit2::LibGit2) endif() -target_link_libraries(git2cpp git2) - set_target_properties(git2cpp PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED YES diff --git a/libs/libgit2 b/libs/libgit2 index b7bad55..e632535 160000 --- a/libs/libgit2 +++ b/libs/libgit2 @@ -1 +1 @@ -Subproject commit b7bad55e4bb0a285b073ba5e02b01d3f522fc95d +Subproject commit e6325351ceee58cf56f58bdce61b38907805544f From c785afef63f99917167df87b3b63bd76686a93a0 Mon Sep 17 00:00:00 2001 From: "SM9()" Date: Mon, 9 Oct 2023 10:30:01 +0100 Subject: [PATCH 10/19] Update CMakeLists.txt to find and link against libgit2 using PkgConfig. Signed-off-by: Michael Bolden Jnr / SM9(); --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73bee65..0019aa0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,9 @@ if (BUNDLE_LIBGIT2) ) target_link_libraries(git2cpp libgit2package) else() - target_link_libraries(git2cpp LibGit2::LibGit2) + find_package(PkgConfig REQUIRED) + pkg_search_module(LibGit2 REQUIRED libgit2) + target_link_libraries(git2cpp ${LibGit2_LIBRARIES}) endif() set_target_properties(git2cpp PROPERTIES From 71fe3641ab06652a9f499375a2392dc6db8e140a Mon Sep 17 00:00:00 2001 From: "SM9()" Date: Mon, 9 Oct 2023 10:39:47 +0100 Subject: [PATCH 11/19] Add CMake installation rules Signed-off-by: Michael Bolden Jnr / SM9(); --- CMakeLists.txt | 2 ++ cmake/InstallConfig.cmake | 1 + cmake/InstallRules.cmake | 60 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 cmake/InstallConfig.cmake create mode 100644 cmake/InstallRules.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 73bee65..21d5e59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,3 +90,5 @@ if(BUILD_LIBGIT2CPP_EXAMPLES) file(COPY test.sh DESTINATION . FILE_PERMISSIONS ${EXE_PERM}) endif() + +include(cmake/InstallRules.cmake) diff --git a/cmake/InstallConfig.cmake b/cmake/InstallConfig.cmake new file mode 100644 index 0000000..d9ce767 --- /dev/null +++ b/cmake/InstallConfig.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/git2cppTargets.cmake") diff --git a/cmake/InstallRules.cmake b/cmake/InstallRules.cmake new file mode 100644 index 0000000..7f126fb --- /dev/null +++ b/cmake/InstallRules.cmake @@ -0,0 +1,60 @@ +set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "") + +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) + +set(package git2cpp) + +install( + DIRECTORY include/ + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + COMPONENT git2cpp_Development +) + +install( + TARGETS git2cpp + EXPORT git2cppTargets + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" +) + +if (NOT DEFINED VERSION) + set(VERSION "1.0.0") +endif() + +write_basic_package_version_file( + "${package}ConfigVersion.cmake" + VERSION ${VERSION} + COMPATIBILITY SameMajorVersion + ARCH_INDEPENDENT +) + +set( + git2cpp_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}" + CACHE PATH "CMake package config location relative to the install prefix" +) + +mark_as_advanced(git2cpp_INSTALL_CMAKEDIR) + +install( + FILES cmake/InstallConfig.cmake + DESTINATION "${git2cpp_INSTALL_CMAKEDIR}" + RENAME "${package}Config.cmake" + COMPONENT git2cpp_Development +) + +install( + FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake" + DESTINATION "${git2cpp_INSTALL_CMAKEDIR}" + COMPONENT git2cpp_Development +) + +install( + EXPORT git2cppTargets + NAMESPACE git2cpp:: + DESTINATION "${git2cpp_INSTALL_CMAKEDIR}" + COMPONENT git2cpp_Development +) + +if(PROJECT_IS_TOP_LEVEL) + include(CPack) +endif() From 8b127ba316c8037b0f9bf0482866ab3d16b612b8 Mon Sep 17 00:00:00 2001 From: "SM9()" Date: Mon, 9 Oct 2023 10:44:50 +0100 Subject: [PATCH 12/19] Add cmake build directories and .idea to .gitignore Signed-off-by: Michael Bolden Jnr / SM9(); --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index a027f93..4ff7967 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ *.swo build *.user +cmake-build-debug/ +cmake-build-release/ +.idea/ From be07c1ab151fcf193515eca6942b0cd818a15968 Mon Sep 17 00:00:00 2001 From: "SM9()" Date: Mon, 9 Oct 2023 11:59:43 +0100 Subject: [PATCH 13/19] Add Version.cmake to extract project version from Git Signed-off-by: Michael Bolden Jnr / SM9(); --- CMakeLists.txt | 6 +++++- cmake/Version.cmake | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 cmake/Version.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 73bee65..f3379a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.5.1) +include(cmake/Version.cmake) + project (libgit2cpp) # Build options @@ -49,7 +51,9 @@ if (BUNDLE_LIBGIT2) ) target_link_libraries(git2cpp libgit2package) else() - target_link_libraries(git2cpp LibGit2::LibGit2) + find_package(PkgConfig REQUIRED) + pkg_search_module(LibGit2 REQUIRED libgit2) + target_link_libraries(git2cpp ${LibGit2_LIBRARIES}) endif() set_target_properties(git2cpp PROPERTIES diff --git a/cmake/Version.cmake b/cmake/Version.cmake new file mode 100644 index 0000000..d61a5e5 --- /dev/null +++ b/cmake/Version.cmake @@ -0,0 +1,33 @@ +set(VERSION "0.0.0" CACHE STRING "libgit2cpp Version") +set(COMMIT_HASH "") +set(COMMIT_COUNT 0) + +find_package(Git) + +if (Git_FOUND AND VERSION STREQUAL "0.0.0") + message(STATUS "No version defined, fetching one from git") + + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE COMMIT_COUNT + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + + set(VERSION "r${COMMIT_COUNT}.${COMMIT_HASH}") +endif () + +message(STATUS "Version: ${VERSION}") +string(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+(\\.[0-9])?)(.*)" "\\1" VERSION_FOR_CMAKE "${VERSION}") +message(STATUS "Version for CMake: ${VERSION_FOR_CMAKE}") + +#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/include/version.h) From a5a411ad8b5d385c557ff74fe54cd07801296845 Mon Sep 17 00:00:00 2001 From: "SM9()" Date: Mon, 9 Oct 2023 12:28:55 +0100 Subject: [PATCH 14/19] Reformat CMakeLists.txt to follow consistent indentation style Signed-off-by: Michael Bolden Jnr / SM9(); --- CMakeLists.txt | 128 ++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1c2382..4575e98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,97 +2,97 @@ cmake_minimum_required(VERSION 3.5.1) include(cmake/Version.cmake) -project (libgit2cpp) +project(libgit2cpp) # Build options OPTION(USE_BOOST "Enable use of boost header libraries" OFF) -IF(USE_BOOST) - add_definitions(-DUSE_BOOST=1) - find_package(Boost REQUIRED) - include_directories(${BOOST_INCLUDEDIR}) -ENDIF() +IF (USE_BOOST) + add_definitions(-DUSE_BOOST=1) + find_package(Boost REQUIRED) + include_directories(${BOOST_INCLUDEDIR}) +ENDIF () if (MSVC) - OPTION(BUNDLE_LIBGIT2 "use bundled libgit2" ON) -else() - OPTION(BUNDLE_LIBGIT2 "use bundled libgit2" OFF) -endif() + OPTION(BUNDLE_LIBGIT2 "use bundled libgit2" ON) +else () + OPTION(BUNDLE_LIBGIT2 "use bundled libgit2" OFF) +endif () if (BUNDLE_LIBGIT2) - add_subdirectory(libs/libgit2) -endif() + add_subdirectory(libs/libgit2) +endif () file(GLOB_RECURSE lib_sources - src/*.cpp - include/git2cpp/*.h + src/*.cpp + include/git2cpp/*.h ) if (MSVC AND ($MSVC_VERSION VERSION_GREATER 1900)) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") -endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") +endif () add_library(git2cpp STATIC ${lib_sources}) target_include_directories(git2cpp - PRIVATE - src - PUBLIC - $ + PRIVATE + src + PUBLIC + $ ) if (USE_BOOST) - target_include_directories(git2cpp PUBLIC ${Boost_INCLUDE_DIRS}) -endif() + target_include_directories(git2cpp PUBLIC ${Boost_INCLUDE_DIRS}) +endif () if (BUNDLE_LIBGIT2) - target_include_directories(git2cpp - PUBLIC libs/libgit2/include - ) - target_link_libraries(git2cpp libgit2package) -else() - find_package(PkgConfig REQUIRED) - pkg_search_module(LibGit2 REQUIRED libgit2) - target_link_libraries(git2cpp ${LibGit2_LIBRARIES}) -endif() + target_include_directories(git2cpp + PUBLIC libs/libgit2/include + ) + target_link_libraries(git2cpp libgit2package) +else () + find_package(PkgConfig REQUIRED) + pkg_search_module(LibGit2 REQUIRED libgit2) + target_link_libraries(git2cpp ${LibGit2_LIBRARIES}) +endif () set_target_properties(git2cpp PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED YES - INTERFACE_COMPILE_FEATURES cxx_std_17 + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED YES + INTERFACE_COMPILE_FEATURES cxx_std_17 ) option(BUILD_LIBGIT2CPP_EXAMPLES ON) -if(BUILD_LIBGIT2CPP_EXAMPLES) - set(examples - add - branch - cat-file - diff - log - rev-list - showindex - status - init - rev-parse - general - remote - checkout - ls-files - blame - clone - ) - - foreach (example ${examples}) - add_executable("${example}-cpp" examples/${example}.cpp) - target_link_libraries("${example}-cpp" git2cpp) - endforeach(example) - - add_executable(commit-graph-generator examples/commit-graph-generator.cpp) - target_link_libraries(commit-graph-generator git2cpp) - - file(COPY test.sh DESTINATION . FILE_PERMISSIONS ${EXE_PERM}) -endif() +if (BUILD_LIBGIT2CPP_EXAMPLES) + set(examples + add + branch + cat-file + diff + log + rev-list + showindex + status + init + rev-parse + general + remote + checkout + ls-files + blame + clone + ) + + foreach (example ${examples}) + add_executable("${example}-cpp" examples/${example}.cpp) + target_link_libraries("${example}-cpp" git2cpp) + endforeach (example) + + add_executable(commit-graph-generator examples/commit-graph-generator.cpp) + target_link_libraries(commit-graph-generator git2cpp) + + file(COPY test.sh DESTINATION . FILE_PERMISSIONS ${EXE_PERM}) +endif () include(cmake/InstallRules.cmake) From aa0910922a761b0e69a21f63c1a9b5a9f65742d5 Mon Sep 17 00:00:00 2001 From: "SM9()" Date: Mon, 9 Oct 2023 23:39:07 +0100 Subject: [PATCH 15/19] Refactor CMakeLists.txt and related files for better readability and maintainability. Signed-off-by: Michael Bolden Jnr / SM9(); --- CMakeLists.txt | 97 +++++++++++++--------------------------- cmake/InstallRules.cmake | 10 ++--- examples/CMakeLists.txt | 4 ++ 3 files changed, 39 insertions(+), 72 deletions(-) create mode 100644 examples/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 4575e98..0bf7e0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,98 +1,63 @@ cmake_minimum_required(VERSION 3.5.1) -include(cmake/Version.cmake) +project(libgit2cpp LANGUAGES C CXX) +set(package git2cpp) -project(libgit2cpp) +option(USE_BOOST "Enable use of Boost header libraries" OFF) +option(BUNDLE_LIBGIT2 "Use bundled libgit2" ${MSVC}) +option(BUILD_LIBGIT2CPP_EXAMPLES "Build libgit2cpp examples" ON) -# Build options -OPTION(USE_BOOST "Enable use of boost header libraries" OFF) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +include(Version) -IF (USE_BOOST) - add_definitions(-DUSE_BOOST=1) +if (USE_BOOST) find_package(Boost REQUIRED) + add_definitions(-DUSE_BOOST=1) include_directories(${BOOST_INCLUDEDIR}) -ENDIF () - -if (MSVC) - OPTION(BUNDLE_LIBGIT2 "use bundled libgit2" ON) -else () - OPTION(BUNDLE_LIBGIT2 "use bundled libgit2" OFF) endif () if (BUNDLE_LIBGIT2) add_subdirectory(libs/libgit2) endif () -file(GLOB_RECURSE lib_sources +file(GLOB_RECURSE LIBGIT2CPP_SOURCES src/*.cpp include/git2cpp/*.h ) +add_library(${package} STATIC ${LIBGIT2CPP_SOURCES}) + +set_target_properties(${package} PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON + INTERFACE_COMPILE_FEATURES cxx_std_17 +) + if (MSVC AND ($MSVC_VERSION VERSION_GREATER 1900)) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17") endif () -add_library(git2cpp STATIC ${lib_sources}) - -target_include_directories(git2cpp - PRIVATE - src - PUBLIC - $ +target_include_directories(${package} + PRIVATE src + PUBLIC $ ) if (USE_BOOST) - target_include_directories(git2cpp PUBLIC ${Boost_INCLUDE_DIRS}) + target_include_directories(${package} PUBLIC ${Boost_INCLUDE_DIRS}) +endif () + +if (BUILD_LIBGIT2CPP_EXAMPLES) + add_subdirectory(examples) + file(COPY test.sh DESTINATION . FILE_PERMISSIONS ${EXE_PERM}) endif () if (BUNDLE_LIBGIT2) - target_include_directories(git2cpp - PUBLIC libs/libgit2/include - ) - target_link_libraries(git2cpp libgit2package) + target_include_directories(${package} PUBLIC libs/libgit2/include) + target_link_libraries(${package} libgit2package) else () find_package(PkgConfig REQUIRED) pkg_search_module(LibGit2 REQUIRED libgit2) - target_link_libraries(git2cpp ${LibGit2_LIBRARIES}) -endif () - -set_target_properties(git2cpp PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED YES - INTERFACE_COMPILE_FEATURES cxx_std_17 -) - -option(BUILD_LIBGIT2CPP_EXAMPLES ON) - -if (BUILD_LIBGIT2CPP_EXAMPLES) - set(examples - add - branch - cat-file - diff - log - rev-list - showindex - status - init - rev-parse - general - remote - checkout - ls-files - blame - clone - ) - - foreach (example ${examples}) - add_executable("${example}-cpp" examples/${example}.cpp) - target_link_libraries("${example}-cpp" git2cpp) - endforeach (example) - - add_executable(commit-graph-generator examples/commit-graph-generator.cpp) - target_link_libraries(commit-graph-generator git2cpp) - - file(COPY test.sh DESTINATION . FILE_PERMISSIONS ${EXE_PERM}) + target_link_libraries(${package} ${LibGit2_LIBRARIES}) endif () -include(cmake/InstallRules.cmake) +include(InstallRules) diff --git a/cmake/InstallRules.cmake b/cmake/InstallRules.cmake index 7f126fb..bf387bd 100644 --- a/cmake/InstallRules.cmake +++ b/cmake/InstallRules.cmake @@ -3,8 +3,6 @@ set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "") include(CMakePackageConfigHelpers) include(GNUInstallDirs) -set(package git2cpp) - install( DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" @@ -12,14 +10,14 @@ install( ) install( - TARGETS git2cpp + TARGETS ${package} EXPORT git2cppTargets INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) if (NOT DEFINED VERSION) set(VERSION "1.0.0") -endif() +endif () write_basic_package_version_file( "${package}ConfigVersion.cmake" @@ -55,6 +53,6 @@ install( COMPONENT git2cpp_Development ) -if(PROJECT_IS_TOP_LEVEL) +if (PROJECT_IS_TOP_LEVEL) include(CPack) -endif() +endif () diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..a6d5cba --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,4 @@ +get_filename_component(CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} DIRECTORY) +file(GLOB_RECURSE SOURCES ${CURRENT_DIR}/*.cpp) +file(GLOB_RECURSE HEADERS ${CURRENT_DIR}/*.h) +add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}) From 0242c3921326d3e18f71c7ef888a4779a6e539df Mon Sep 17 00:00:00 2001 From: StillGreen-san <40620628+StillGreen-san@users.noreply.github.com> Date: Tue, 9 Apr 2024 20:19:36 +0200 Subject: [PATCH 16/19] generalize gitignore for default clion cmake build folders --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4ff7967..ee42b85 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,5 @@ *.swo build *.user -cmake-build-debug/ -cmake-build-release/ +cmake-build*/ .idea/ From 38d57a330e8125acdd99ec31e4867e1832fd963d Mon Sep 17 00:00:00 2001 From: StillGreen-san <40620628+StillGreen-san@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:38:04 +0200 Subject: [PATCH 17/19] restore example targets and test script functionality --- examples/CMakeLists.txt | 10 ++++++---- test.sh | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index a6d5cba..d840b21 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,6 @@ -get_filename_component(CURRENT_DIR ${CMAKE_CURRENT_LIST_FILE} DIRECTORY) -file(GLOB_RECURSE SOURCES ${CURRENT_DIR}/*.cpp) -file(GLOB_RECURSE HEADERS ${CURRENT_DIR}/*.h) -add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}) +file(GLOB_RECURSE LIBGIT2CPP_EXAMPLE_SOURCES *.cpp) +foreach(EXAMPLE_SOURCE ${LIBGIT2CPP_EXAMPLE_SOURCES}) + get_filename_component(EXAMPLE_NAME ${EXAMPLE_SOURCE} NAME_WE) + add_executable(${EXAMPLE_NAME}-cpp ${EXAMPLE_SOURCE}) + target_link_libraries(${EXAMPLE_NAME}-cpp ${package}) +endforeach() diff --git a/test.sh b/test.sh index 3f1f276..a32334a 100755 --- a/test.sh +++ b/test.sh @@ -23,7 +23,7 @@ function test() { local test_name="$1" echo -e "**** test $test_name *********************************\n\n" - local bin="$CWD/$test_name" + local bin="$CWD/examples/$test_name" shift @@ -41,7 +41,7 @@ pushd $REPO test branch-cpp test diff-cpp -test commit-graph-generator . "$CWD/commit-graph.dot" +test commit-graph-generator-cpp . "$CWD/commit-graph.dot" test log-cpp test rev-list-cpp --topo-order HEAD test rev-parse-cpp HEAD From fd126c7e75d7027c5c3118e8b68676b68e17654f Mon Sep 17 00:00:00 2001 From: StillGreen-san <40620628+StillGreen-san@users.noreply.github.com> Date: Wed, 10 Apr 2024 12:52:10 +0200 Subject: [PATCH 18/19] use IMPORTED_TARGET for pkg_search_module & bump min cmake version --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bf7e0f..fa4ba6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.1) +cmake_minimum_required(VERSION 3.6) project(libgit2cpp LANGUAGES C CXX) set(package git2cpp) @@ -56,8 +56,8 @@ if (BUNDLE_LIBGIT2) target_link_libraries(${package} libgit2package) else () find_package(PkgConfig REQUIRED) - pkg_search_module(LibGit2 REQUIRED libgit2) - target_link_libraries(${package} ${LibGit2_LIBRARIES}) + pkg_search_module(LibGit2 REQUIRED IMPORTED_TARGET libgit2) + target_link_libraries(${package} PkgConfig::LibGit2) endif () include(InstallRules) From e9651575e388d7e5832ff64955b2f3304bac33db Mon Sep 17 00:00:00 2001 From: Andrey Davydov Date: Sun, 9 Jun 2024 16:26:35 +0200 Subject: [PATCH 19/19] + missing #include --- examples/add.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/add.cpp b/examples/add.cpp index c24721e..d616a5b 100644 --- a/examples/add.cpp +++ b/examples/add.cpp @@ -6,6 +6,8 @@ #include "git2cpp/initializer.h" #include "git2cpp/repo.h" +#include + enum print_options { SKIP = 1,