git2wrapC++20 wrapper for libgit2 |
git clone git://git.dimitrijedobrota.com/git2wrap.git |
Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING |
commit | 4be48e2371d482745760af7e3ff3a55e35beb0f1 |
parent | 5426c1d26386c66ad73be96c6153bb179e361571 |
author | Dimitrije Dobrota < mail@dimitrijedobrota.com > |
date | Fri, 9 May 2025 18:51:28 +0200 |
Update format and readability
M | .clang-format | | | +++++++++ --- |
M | .clang-tidy | | | +++++++++++++++++++++++++++ ------------ |
M | CMakeLists.txt | | | ++ - |
M | include/git2wrap/blob.hpp | | | +++++++ ------- |
M | include/git2wrap/branch.hpp | | | +++++++++++++ ---------- |
M | include/git2wrap/buf.hpp | | | + - |
M | include/git2wrap/commit.hpp | | | +++++++++++++++++++ ------------------- |
M | include/git2wrap/diff.hpp | | | +++++++++++++++++++++++++++++++ ------------ |
M | include/git2wrap/error.hpp | | | +++++++++++++++++++++++++++++++++++++++++ ----------------------------------------- |
M | include/git2wrap/object.hpp | | | +++++ ----- |
M | include/git2wrap/oid.hpp | | | + - |
M | include/git2wrap/reference.hpp | | | ++ -- |
M | include/git2wrap/repository.hpp | | | ++++++++++++ ------------ |
M | include/git2wrap/signature.hpp | | | ++++ ---- |
M | include/git2wrap/tag.hpp | | | +++++++++ --------- |
M | include/git2wrap/tree.hpp | | | ++++++++++++++++++ ------------------ |
M | include/git2wrap/types.hpp | | | ++++ ------ |
M | source/branch.cpp | | | ++++++++++++++ ---------------- |
M | source/commit.cpp | | | ++++++++++++ ---------- |
M | source/diff.cpp | | | ++++++++++++++++ ------------ |
M | source/libgit2.cpp | | | + - |
M | source/object.cpp | | | + - |
M | source/reference.cpp | | | -- |
M | source/repository.cpp | | | +++++++++++++++++++++++++++++++++++++++++ ----------------------------------- |
M | source/revwalk.cpp | | | ++++++++++++++ ----------- |
M | source/tree.cpp | | | ++++++++++++++ ------------ |
M | test/CMakeLists.txt | | | ++ -- |
M | vcpkg-configuration.json | | | + - |
M | vcpkg.json | | | ++++ |
29 files changed, 397 insertions(+), 338 deletions(-)
diff --git a/ .clang-format b/ .clang-format
@@ -2,12 +2,12 @@
Language: Cpp
# BasedOnStyle: Chromium
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignAfterOpenBracket: BlockIndent
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: DontAlign
AlignEscapedNewlines: Right
AlignOperands: DontAlign
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
@@ -17,9 +17,10 @@
AllowShortEnumsOnASingleLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: All
AllowShortLambdasOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AllowShortCompoundRequirementOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
@@ -50,6 +51,7 @@
BreakBeforeBraces: Custom
# BreakBeforeInheritanceComma: true
BreakInheritanceList: BeforeComma
BreakBeforeTernaryOperators: true
BreakBeforeConceptDeclarations: Always
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: true
@@ -70,6 +72,7 @@
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
- BASED_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
# Standard library headers come before anything else
@@ -90,6 +93,8 @@
IndentPPDirectives: AfterHash
IndentExternBlock: NoIndent
IndentWidth: 2
IndentWrappedFunctionNames: false
IndentRequiresClause: true
RequiresClausePosition: OwnLine
InsertTrailingCommas: Wrapped
JavaScriptQuotes: Double
JavaScriptWrapImports: true
@@ -98,6 +103,7 @@
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
RequiresExpressionIndentation: OuterScope
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
diff --git a/ .clang-tidy b/ .clang-tidy
@@ -3,23 +3,24 @@
# misc-non-private-member-variables-in-classes: the options don't do anything
# modernize-use-nodiscard: too aggressive, attribute is situationally useful
Checks: "*,\
-google-readability-todo,\
-altera-*,\
-boost*,\
-cppcoreguidelines-avoid-do-while,\
-cppcoreguidelines-pro-bounds-constant-array-index,\
-fuchsia-*,\
fuchsia-multiple-inheritance,\
-google-readability-todo,\
-llvm-header-guard,\
-llvm-include-order,\
-llvmlibc-*,\
-modernize-use-nodiscard,\
-modernize-use-trailing-return-type,\
-cppcoreguidelines-pro-type-vararg,\
-hicpp-vararg,\
-misc-include-cleaner,\
-misc-non-private-member-variables-in-classes"
-misc-non-private-member-variables-in-classes,\
-misc-no-recursion,\
-modernize-use-trailing-return-type,\
-readability-suspicious-call-argument,\
-*-ranges,\
"
WarningsAsErrors: ''
CheckOptions:
- key: 'misc-include-cleaner.IgnoreHeaders'
value: "git2.h"
- key: 'bugprone-argument-comment.StrictMode'
value: 'true'
# Prefer using enum classes with 2 values for parameters instead of bools
@@ -79,7 +80,7 @@
CheckOptions:
- key: 'readability-identifier-naming.EnumCase'
value: 'lower_case'
- key: 'readability-identifier-naming.EnumConstantCase'
value: 'UPPER_CASE'
value: 'lower_case'
- key: 'readability-identifier-naming.FunctionCase'
value: 'lower_case'
- key: 'readability-identifier-naming.GlobalConstantCase'
@@ -133,7 +134,7 @@
CheckOptions:
- key: 'readability-identifier-naming.PublicMethodCase'
value: 'lower_case'
- key: 'readability-identifier-naming.ScopedEnumConstantCase'
value: 'UPPER_CASE'
value: 'lower_case'
- key: 'readability-identifier-naming.StaticConstantCase'
value: 'lower_case'
- key: 'readability-identifier-naming.StaticVariableCase'
@@ -146,6 +147,8 @@
CheckOptions:
value: 'CamelCase'
- key: 'readability-identifier-naming.TypeAliasCase'
value: 'lower_case'
- key: 'readability-identifier-naming.TypeAliasIgnoredRegexp'
value: 'N'
- key: 'readability-identifier-naming.TypedefCase'
value: 'lower_case'
- key: 'readability-identifier-naming.TypeTemplateParameterCase'
@@ -153,9 +156,21 @@
CheckOptions:
- key: 'readability-identifier-naming.UnionCase'
value: 'lower_case'
- key: 'readability-identifier-naming.ValueTemplateParameterCase'
value: 'CamelCase'
value: 'lower_case'
- key: 'readability-identifier-naming.VariableCase'
value: 'lower_case'
- key: 'readability-identifier-naming.VirtualMethodCase'
value: 'lower_case'
- key: 'readability-identifier-length.IgnoredVariableNames'
value: "^[abcdxyznm]$"
- key: 'readability-identifier-length.IgnoredParameterNames'
value: "^[abcdxyznm]$"
- key: 'google-runtime-int.UnsignedTypePrefix'
value: "u"
- key: 'google-runtime-int.SignedTypePrefix'
value: "i"
- key: 'cppcoreguidelines-missing-std-forward.ForwardFunction'
value: "::based::forward"
- key: 'cppcoreguidelines-rvalue-reference-param-not-moved.MoveFunction'
value: "::based::move"
...
diff --git a/ CMakeLists.txt b/ CMakeLists.txt
@@ -16,6 +16,7 @@
include(cmake/variables.cmake)
# ---- Declare dependencies ----
find_package(libgit2 1.9 CONFIG REQUIRED)
find_package(based 0.1.2 CONFIG REQUIRED)
# ---- Declare library ----
@@ -38,7 +39,7 @@
add_library(
)
add_library(git2wrap::git2wrap ALIAS git2wrap_git2wrap)
target_link_libraries(git2wrap_git2wrap PUBLIC git2)
target_link_libraries(git2wrap_git2wrap PUBLIC git2 based::based)
include(GenerateExportHeader)
generate_export_header(
diff --git a/ include/git2wrap/blob.hpp b/ include/git2wrap/blob.hpp
@@ -3,8 +3,8 @@
#include <git2.h>
#include "git2wrap/git2wrap_export.hpp"
#include "git2wrap/types.hpp"
#include "git2wrap/oid.hpp"
#include "git2wrap/types.hpp"
namespace git2wrap
{
@@ -15,13 +15,13 @@
public:
blob(git_blob* blb, repositoryPtr repo);
operator bool() const { return m_blob != nullptr; } // NOLINT
blob dup() const;
[[nodiscard]] blob dup() const;
oid get_id() const;
repositoryPtr get_owner() const;
const void* get_rawcontent() const;
object_size_t get_rawsize() const;
bool is_binary() const;
[[nodiscard]] oid get_id() const;
[[nodiscard]] repositoryPtr get_owner() const;
[[nodiscard]] const void* get_rawcontent() const;
[[nodiscard]] object_size_t get_rawsize() const;
[[nodiscard]] bool is_binary() const;
private:
blobUPtr m_blob;
diff --git a/ include/git2wrap/branch.hpp b/ include/git2wrap/branch.hpp
@@ -12,14 +12,15 @@
namespace git2wrap
class GIT2WRAP_EXPORT branch
{
public:
explicit branch(git_reference* ref = nullptr,
git_branch_t type = git_branch_t(0));
explicit branch(
git_reference* ref = nullptr, git_branch_t type = git_branch_t(0)
);
branch(reference ref, git_branch_t type);
operator bool() const { return m_ref; } // NOLINT
branch dup() const;
[[nodiscard]] branch dup() const;
git_branch_t get_type() const { return m_type; }
[[nodiscard]] git_branch_t get_type() const { return m_type; }
const std::string& get_name();
@@ -35,18 +36,20 @@
class branch_iterator
public:
explicit branch_iterator(git_branch_iterator* iter = nullptr);
git_branch_iterator* get() { return m_iter.get(); }
const git_branch_iterator* get() const { return m_iter.get(); }
[[nodiscard]] git_branch_iterator* get() { return m_iter.get(); }
[[nodiscard]] const git_branch_iterator* get() const { return m_iter.get(); }
branch& operator*() { return m_branch; }
branch* operator->() { return &m_branch; }
branch_iterator& operator++();
friend bool operator==(const branch_iterator& lhs,
const branch_iterator& rhs);
friend bool operator==(
const branch_iterator& lhs, const branch_iterator& rhs
);
friend bool operator!=(const branch_iterator& lhs,
const branch_iterator& rhs);
friend bool operator!=(
const branch_iterator& lhs, const branch_iterator& rhs
);
private:
branch_iteratorUPtr m_iter;
diff --git a/ include/git2wrap/buf.hpp b/ include/git2wrap/buf.hpp
@@ -18,7 +18,7 @@
public:
~buf();
git_buf* get() { return &m_buf; }
const git_buf* get() const { return &m_buf; }
[[nodiscard]] const git_buf* get() const { return &m_buf; }
private:
git_buf m_buf = {nullptr, 0, 0};
diff --git a/ include/git2wrap/commit.hpp b/ include/git2wrap/commit.hpp
@@ -3,9 +3,9 @@
#include <git2.h>
#include "git2wrap/git2wrap_export.hpp"
#include "git2wrap/oid.hpp"
#include "git2wrap/tree.hpp"
#include "git2wrap/types.hpp"
#include "git2wrap/oid.hpp"
namespace git2wrap
{
@@ -17,24 +17,24 @@
public:
commit() = default;
operator bool() const { return m_commit != nullptr; } // NOLINT
commit dup() const;
oid get_id() const;
const char* get_summary() const;
const char* get_message_encoding() const;
const char* get_message() const;
const char* get_message_raw() const;
const char* get_body() const;
time_t get_time() const;
int get_time_offset() const;
signature get_signature() const;
signature get_author() const;
const char* get_raw_header() const;
unsigned get_parentcount() const;
commit get_parent(unsigned n = 0) const;
buf get_header_field(const char* field) const;
tree get_tree() const;
[[nodiscard]] commit dup() const;
[[nodiscard]] oid get_id() const;
[[nodiscard]] const char* get_summary() const;
[[nodiscard]] const char* get_message_encoding() const;
[[nodiscard]] const char* get_message() const;
[[nodiscard]] const char* get_message_raw() const;
[[nodiscard]] const char* get_body() const;
[[nodiscard]] time_t get_time() const;
[[nodiscard]] int get_time_offset() const;
[[nodiscard]] signature get_signature() const;
[[nodiscard]] signature get_author() const;
[[nodiscard]] const char* get_raw_header() const;
[[nodiscard]] unsigned get_parentcount() const;
[[nodiscard]] commit get_parent(unsigned n = 0) const;
[[nodiscard]] buf get_header_field(const char* field) const;
[[nodiscard]] tree get_tree() const;
private:
commitUPtr m_commit;
diff --git a/ include/git2wrap/diff.hpp b/ include/git2wrap/diff.hpp
@@ -1,5 +1,7 @@
#pragma once
#include <based/enum/enum_flag.hpp>
#include <based/types/types.hpp>
#include <git2.h>
#include "git2wrap/git2wrap_export.hpp"
@@ -16,31 +18,48 @@
public:
operator bool() const { return m_diff != nullptr; } // NOLINT
diff_stats get_stats() const;
[[nodiscard]] diff_stats get_stats() const;
int foreach(diff_file_cb file_cb,
diff_binary_cb binary_cb,
diff_hunk_cb hunk_cb,
diff_line_cb line_cb,
void* payload) const;
int foreach(
diff_file_cb file_cb,
diff_binary_cb binary_cb,
diff_hunk_cb hunk_cb,
diff_line_cb line_cb,
void* payload
) const;
static diff tree_to_tree(const tree& old,
const tree& crnt,
const git_diff_options* opts);
static diff tree_to_tree(
const tree& old, const tree& crnt, const git_diff_options* opts
);
private:
diffUPtr m_diff;
repositoryPtr m_repo;
};
class GIT2WRAP_EXPORT diff_options
{
public:
explicit diff_options(unsigned int version)
{
git_diff_options_init(&m_options, version);
}
operator auto() { return &m_options; } // NOLINT(*explicit*)
operator auto() const { return &m_options; } // NOLINT(*explicit*)
private:
git_diff_options m_options = {};
};
class GIT2WRAP_EXPORT diff_stats
{
public:
explicit diff_stats(git_diff_stats* stats);
size_t get_files_changed() const;
size_t get_insertions() const;
size_t get_deletions() const;
[[nodiscard]] size_t get_files_changed() const;
[[nodiscard]] size_t get_insertions() const;
[[nodiscard]] size_t get_deletions() const;
private:
diff_statsUPtr m_stats;
diff --git a/ include/git2wrap/error.hpp b/ include/git2wrap/error.hpp
@@ -10,158 +10,158 @@
namespace git2wrap
{
enum error_code_t // NOLINT
enum class error_code_t // NOLINT
{
OK = GIT_OK,
ERROR = GIT_ERROR,
ENOTFOUND = GIT_ENOTFOUND,
EEXISTS = GIT_EEXISTS,
EAMBIGUOUS = GIT_EAMBIGUOUS,
EBUFS = GIT_EBUFS,
EUSER = GIT_EUSER,
EBAREREPO = GIT_EBAREREPO,
EUNBORNBRANCH = GIT_EUNBORNBRANCH,
EUNMERGED = GIT_EUNMERGED,
ENONFASTFORWARD = GIT_ENONFASTFORWARD,
EINVALIDSPEC = GIT_EINVALIDSPEC,
ECONFLICT = GIT_ECONFLICT,
ELOCKED = GIT_ELOCKED,
EMODIFIED = GIT_EMODIFIED,
EAUTH = GIT_EAUTH,
ECERTIFICATE = GIT_ECERTIFICATE,
EAPPLIED = GIT_EAPPLIED,
EPEEL = GIT_EPEEL,
EEOF = GIT_EEOF,
EINVALID = GIT_EINVALID,
EUNCOMMITTED = GIT_EUNCOMMITTED,
EDIRECTORY = GIT_EDIRECTORY,
EMERGECONFLICT = GIT_EMERGECONFLICT,
PASSTHROUGH = GIT_PASSTHROUGH,
ITEROVER = GIT_ITEROVER,
RETRY = GIT_RETRY,
EMISMATCH = GIT_EMISMATCH,
EINDEXDIRTY = GIT_EINDEXDIRTY,
EAPPLYFAIL = GIT_EAPPLYFAIL,
EOWNER = GIT_EOWNER,
TIMEOUT = GIT_TIMEOUT,
EUNCHANGED = GIT_EUNCHANGED,
ENOTSUPPORTED = GIT_ENOTSUPPORTED,
EREADONLY = GIT_EREADONLY,
ok = GIT_OK,
error = GIT_ERROR,
enotfound = GIT_ENOTFOUND,
eexists = GIT_EEXISTS,
eambiguous = GIT_EAMBIGUOUS,
ebufs = GIT_EBUFS,
euser = GIT_EUSER,
ebarerepo = GIT_EBAREREPO,
eunbornbranch = GIT_EUNBORNBRANCH,
eunmerged = GIT_EUNMERGED,
enonfastforward = GIT_ENONFASTFORWARD,
einvalidspec = GIT_EINVALIDSPEC,
econflict = GIT_ECONFLICT,
elocked = GIT_ELOCKED,
emodified = GIT_EMODIFIED,
eauth = GIT_EAUTH,
ecertificate = GIT_ECERTIFICATE,
eapplied = GIT_EAPPLIED,
epeel = GIT_EPEEL,
eeof = GIT_EEOF,
einvalid = GIT_EINVALID,
euncommitted = GIT_EUNCOMMITTED,
edirectory = GIT_EDIRECTORY,
emergeconflict = GIT_EMERGECONFLICT,
passthrough = GIT_PASSTHROUGH,
iterover = GIT_ITEROVER,
retry = GIT_RETRY,
emismatch = GIT_EMISMATCH,
eindexdirty = GIT_EINDEXDIRTY,
eapplyfail = GIT_EAPPLYFAIL,
eowner = GIT_EOWNER,
timeout = GIT_TIMEOUT,
eunchanged = GIT_EUNCHANGED,
enotsupported = GIT_ENOTSUPPORTED,
ereadonly = GIT_EREADONLY,
};
enum error_t // NOLINT
enum class error_t // NOLINT
{
NONE = GIT_ERROR_NONE,
NOMEMORY = GIT_ERROR_NOMEMORY,
OS = GIT_ERROR_OS,
INVALID = GIT_ERROR_INVALID,
REFERENCE = GIT_ERROR_REFERENCE,
ZLIB = GIT_ERROR_ZLIB,
REPOSITORY = GIT_ERROR_REPOSITORY,
CONFIG = GIT_ERROR_CONFIG,
REGEX = GIT_ERROR_REGEX,
ODB = GIT_ERROR_ODB,
INDEX = GIT_ERROR_INDEX,
OBJECT = GIT_ERROR_OBJECT,
NET = GIT_ERROR_NET,
TAG = GIT_ERROR_TAG,
TREE = GIT_ERROR_TREE,
INDEXER = GIT_ERROR_INDEXER,
SSL = GIT_ERROR_SSL,
SUBMODULE = GIT_ERROR_SUBMODULE,
THREAD = GIT_ERROR_THREAD,
STASH = GIT_ERROR_STASH,
CHECKOUT = GIT_ERROR_CHECKOUT,
FETCHHEAD = GIT_ERROR_FETCHHEAD,
MERGE = GIT_ERROR_MERGE,
SSH = GIT_ERROR_SSH,
FILTER = GIT_ERROR_FILTER,
REVERT = GIT_ERROR_REVERT,
CALLBACK = GIT_ERROR_CALLBACK,
CHERRYPICK = GIT_ERROR_CHERRYPICK,
DESCRIBE = GIT_ERROR_DESCRIBE,
REBASE = GIT_ERROR_REBASE,
FILESYSTEM = GIT_ERROR_FILESYSTEM,
PATCH = GIT_ERROR_PATCH,
WORKTREE = GIT_ERROR_WORKTREE,
SHA = GIT_ERROR_SHA,
HTTP = GIT_ERROR_HTTP,
INTERNAL = GIT_ERROR_INTERNAL,
GRAFTS = GIT_ERROR_GRAFTS,
none = GIT_ERROR_NONE,
nomemory = GIT_ERROR_NOMEMORY,
os = GIT_ERROR_OS,
invalid = GIT_ERROR_INVALID,
reference = GIT_ERROR_REFERENCE,
zlib = GIT_ERROR_ZLIB,
repository = GIT_ERROR_REPOSITORY,
config = GIT_ERROR_CONFIG,
regex = GIT_ERROR_REGEX,
odb = GIT_ERROR_ODB,
index = GIT_ERROR_INDEX,
object = GIT_ERROR_OBJECT,
net = GIT_ERROR_NET,
tag = GIT_ERROR_TAG,
tree = GIT_ERROR_TREE,
indexer = GIT_ERROR_INDEXER,
ssl = GIT_ERROR_SSL,
submodule = GIT_ERROR_SUBMODULE,
thread = GIT_ERROR_THREAD,
stash = GIT_ERROR_STASH,
checkout = GIT_ERROR_CHECKOUT,
fetchhead = GIT_ERROR_FETCHHEAD,
merge = GIT_ERROR_MERGE,
ssh = GIT_ERROR_SSH,
filter = GIT_ERROR_FILTER,
revert = GIT_ERROR_REVERT,
callback = GIT_ERROR_CALLBACK,
cherrypick = GIT_ERROR_CHERRYPICK,
describe = GIT_ERROR_DESCRIBE,
rebase = GIT_ERROR_REBASE,
filesystem = GIT_ERROR_FILESYSTEM,
patch = GIT_ERROR_PATCH,
worktree = GIT_ERROR_WORKTREE,
sha = GIT_ERROR_SHA,
http = GIT_ERROR_HTTP,
internal = GIT_ERROR_INTERNAL,
grafts = GIT_ERROR_GRAFTS,
};
static inline std::string error_get_message(error_code_t error)
{
switch (error) {
case error_code_t::OK:
case error_code_t::ok:
return "No error occurred; the call was successful.";
case error_code_t::ERROR:
case error_code_t::error:
return "An error occurred; call git_error_last for more information.";
case error_code_t::ENOTFOUND:
case error_code_t::enotfound:
return "Requested object could not be found.";
case error_code_t::EEXISTS:
case error_code_t::eexists:
return "Object exists preventing operation.";
case error_code_t::EAMBIGUOUS:
case error_code_t::eambiguous:
return "More than one object matches.";
case error_code_t::EBUFS:
case error_code_t::ebufs:
return "Output buffer too short to hold data.";
case error_code_t::EUSER:
case error_code_t::euser:
return "callback generated";
case error_code_t::EBAREREPO:
case error_code_t::ebarerepo:
return "Operation not allowed on bare repository.";
case error_code_t::EUNBORNBRANCH:
case error_code_t::eunbornbranch:
return "HEAD refers to branch with no commits.";
case error_code_t::EUNMERGED:
case error_code_t::eunmerged:
return "Merge in progress prevented operation";
case error_code_t::ENONFASTFORWARD:
case error_code_t::enonfastforward:
return "Reference was not fast-forwardable";
case error_code_t::EINVALIDSPEC:
case error_code_t::einvalidspec:
return "Name/ref spec was not in a valid format";
case error_code_t::ECONFLICT:
case error_code_t::econflict:
return "Checkout conflicts prevented operation";
case error_code_t::ELOCKED:
case error_code_t::elocked:
return "Lock file prevented operation";
case error_code_t::EMODIFIED:
case error_code_t::emodified:
return "Reference value does not match expected";
case error_code_t::EAUTH:
case error_code_t::eauth:
return "Authentication error";
case error_code_t::ECERTIFICATE:
case error_code_t::ecertificate:
return "Server certificate is invalid";
case error_code_t::EAPPLIED:
case error_code_t::eapplied:
return "Patch/merge has already been applied";
case error_code_t::EPEEL:
case error_code_t::epeel:
return "The requested peel operation is not possible";
case error_code_t::EEOF:
case error_code_t::eeof:
return "Unexpected EOF";
case error_code_t::EINVALID:
case error_code_t::einvalid:
return "Invalid operation or input";
case error_code_t::EUNCOMMITTED:
case error_code_t::euncommitted:
return "Uncommitted changes in index prevented operation";
case error_code_t::EDIRECTORY:
case error_code_t::edirectory:
return "The operation is not valid for a directory";
case error_code_t::EMERGECONFLICT:
case error_code_t::emergeconflict:
return "A merge conflict exists and cannot continue";
case error_code_t::PASSTHROUGH:
case error_code_t::passthrough:
return "A user-configured callback refused to act";
case error_code_t::ITEROVER:
case error_code_t::iterover:
return "Signals end of iteration with iterator";
case error_code_t::RETRY:
case error_code_t::retry:
return "Internal only";
case error_code_t::EMISMATCH:
case error_code_t::emismatch:
return "Hashsum mismatch in object";
case error_code_t::EINDEXDIRTY:
case error_code_t::eindexdirty:
return "Unsaved changes in the index would be overwritten";
case error_code_t::EAPPLYFAIL:
case error_code_t::eapplyfail:
return "Patch application failed";
case error_code_t::EOWNER:
case error_code_t::eowner:
return "The object is not owned by the current user";
case error_code_t::TIMEOUT:
case error_code_t::timeout:
return "The operation timed out";
case error_code_t::EUNCHANGED:
case error_code_t::eunchanged:
return "There were no changes";
case error_code_t::ENOTSUPPORTED:
case error_code_t::enotsupported:
return "An option is not supported";
case error_code_t::EREADONLY:
case error_code_t::ereadonly:
return "The subject is read-only";
}
@@ -177,12 +177,12 @@
public:
}
};
template<error_code_t E>
template<error_code_t e>
class GIT2WRAP_EXPORT error : public runtime_error
{
public:
explicit error()
: runtime_error(error_get_message(E))
: runtime_error(error_get_message(e))
{
}
@@ -190,7 +190,7 @@
private:
};
template<>
class GIT2WRAP_EXPORT error<error_code_t::ERROR> : public runtime_error
class GIT2WRAP_EXPORT error<error_code_t::error> : public runtime_error
{
public:
explicit error()
@@ -199,7 +199,7 @@
public:
{
}
error_t get_error() const { return m_err; }
[[nodiscard]] error_t get_error() const { return m_err; }
private:
error_t m_err;
diff --git a/ include/git2wrap/object.hpp b/ include/git2wrap/object.hpp
@@ -19,12 +19,12 @@
public:
object() = default;
operator bool() const { return m_obj != nullptr; } // NOLINT
object dup() const;
[[nodiscard]] object dup() const;
oid get_id() const;
buf get_id_short() const;
object_t get_type() const;
repositoryPtr get_owner() const;
[[nodiscard]] oid get_id() const;
[[nodiscard]] buf get_id_short() const;
[[nodiscard]] object_t get_type() const;
[[nodiscard]] repositoryPtr get_owner() const;
static const char* type2string(object_t type);
static git_object_t string2type(const char* str);
diff --git a/ include/git2wrap/oid.hpp b/ include/git2wrap/oid.hpp
@@ -14,7 +14,7 @@
public:
explicit oid(const git_oid* objid);
operator bool() const { return m_oid != nullptr; } // NOLINT
git_oid* ptr() const { return m_oid.get(); }
[[nodiscard]] git_oid* ptr() const { return m_oid.get(); }
std::string get_hex_string(size_t n);
diff --git a/ include/git2wrap/reference.hpp b/ include/git2wrap/reference.hpp
@@ -14,9 +14,9 @@
public:
explicit reference(git_reference* ref = nullptr);
operator bool() const { return m_ref != nullptr; } // NOLINT
reference dup() const;
[[nodiscard]] reference dup() const;
git_reference* get() const { return m_ref.get(); }
[[nodiscard]] git_reference* get() const { return m_ref.get(); }
friend bool operator==(const reference& lhs, const reference& rhs);
friend bool operator!=(const reference& lhs, const reference& rhs);
diff --git a/ include/git2wrap/repository.hpp b/ include/git2wrap/repository.hpp
@@ -27,24 +27,24 @@
public:
operator repositoryPtr() const { return m_repo; } // NOLINT
operator bool() const { return m_repo != nullptr; } // NOLINT
repositoryPtr get() const { return m_repo; }
[[nodiscard]] repositoryPtr get() const { return m_repo; }
static repository clone(const char* url,
const char* local_path,
const clone_options* options);
static repository clone(
const char* url, const char* local_path, const clone_options* options
);
static repository open(const char* path);
static repository open(const char* path,
unsigned flags,
const char* ceiling_dirs);
static repository open(
const char* path, unsigned flags, const char* ceiling_dirs
);
object revparse(const char* spec) const;
commit commit_lookup(const oid& objid) const;
blob blob_lookup(const oid& objid) const;
tag tag_lookup(const oid& objid) const;
[[nodiscard]] commit commit_lookup(const oid& objid) const;
[[nodiscard]] blob blob_lookup(const oid& objid) const;
[[nodiscard]] tag tag_lookup(const oid& objid) const;
branch_iterator branch_begin(git_branch_t list_flags) const;
branch_iterator branch_end() const;
[[nodiscard]] branch_iterator branch_begin(git_branch_t list_flags) const;
[[nodiscard]] branch_iterator branch_end() const;
void tag_foreach(tag_foreach_cb callback, void* payload) const;
diff --git a/ include/git2wrap/signature.hpp b/ include/git2wrap/signature.hpp
@@ -15,11 +15,11 @@
public:
explicit signature(git_signature* sig);
operator bool() const { return m_sig != nullptr; } // NOLINT
signature dup() const;
[[nodiscard]] signature dup() const;
const char* get_email() const { return m_sig->email; }
const char* get_name() const { return m_sig->name; }
time get_time() const { return m_sig->when; }
[[nodiscard]] const char* get_email() const { return m_sig->email; }
[[nodiscard]] const char* get_name() const { return m_sig->name; }
[[nodiscard]] time get_time() const { return m_sig->when; }
private:
signatureUPtr m_sig;
diff --git a/ include/git2wrap/tag.hpp b/ include/git2wrap/tag.hpp
@@ -16,15 +16,15 @@
public:
tag(git_tag* tagg, repositoryPtr repo);
operator bool() const { return m_tag != nullptr; } // NOLINT
tag dup() const;
oid get_id() const;
repositoryPtr get_owner() const;
oid get_target_id() const;
object_t get_target_type() const;
const char* get_name() const;
signature get_tagger() const;
const char* get_message() const;
[[nodiscard]] tag dup() const;
[[nodiscard]] oid get_id() const;
[[nodiscard]] repositoryPtr get_owner() const;
[[nodiscard]] oid get_target_id() const;
[[nodiscard]] object_t get_target_type() const;
[[nodiscard]] const char* get_name() const;
[[nodiscard]] signature get_tagger() const;
[[nodiscard]] const char* get_message() const;
private:
tagUPtr m_tag;
diff --git a/ include/git2wrap/tree.hpp b/ include/git2wrap/tree.hpp
@@ -15,17 +15,17 @@
public:
tree(git_tree* tre, repositoryPtr repo);
operator bool() const { return m_tree != nullptr; } // NOLINT
git_tree* ptr() const { return m_tree.get(); }
tree dup() const;
[[nodiscard]] git_tree* ptr() const { return m_tree.get(); }
[[nodiscard]] tree dup() const;
oid get_id() const;
repositoryPtr get_owner() const;
size_t get_entrycount() const;
[[nodiscard]] oid get_id() const;
[[nodiscard]] repositoryPtr get_owner() const;
[[nodiscard]] size_t get_entrycount() const;
tree_entry get_entry(const char* name) const;
tree_entry get_entry(size_t idx) const;
tree_entry get_entry(const oid& objid) const;
tree_entry get_entry_path(const char* path) const;
[[nodiscard]] tree_entry get_entry(const char* name) const;
[[nodiscard]] tree_entry get_entry(size_t idx) const;
[[nodiscard]] tree_entry get_entry(const oid& objid) const;
[[nodiscard]] tree_entry get_entry_path(const char* path) const;
private:
treeUPtr m_tree;
@@ -39,17 +39,17 @@
public:
tree_entry(git_tree_entry* entry, repositoryPtr repo);
operator bool() const { return m_entry != nullptr; } // NOLINT
tree_entry dup() const;
[[nodiscard]] tree_entry dup() const;
object to_object() const;
tree to_tree() const;
[[nodiscard]] object to_object() const;
[[nodiscard]] tree to_tree() const;
const char* get_name() const;
repositoryPtr get_owner() const;
oid get_id() const;
object_t get_type() const;
filemode_t get_filemode() const;
filemode_t get_filemode_raw() const;
[[nodiscard]] const char* get_name() const;
[[nodiscard]] repositoryPtr get_owner() const;
[[nodiscard]] oid get_id() const;
[[nodiscard]] object_t get_type() const;
[[nodiscard]] filemode_t get_filemode() const;
[[nodiscard]] filemode_t get_filemode_raw() const;
auto operator<=>(const tree_entry& rhs);
diff --git a/ include/git2wrap/types.hpp b/ include/git2wrap/types.hpp
@@ -6,10 +6,10 @@
#include <git2.h>
// NOLINTBEGIN
#define CLASS(T) \
class T; \
using T##Del = std::function<void(git_##T*)>; \
using T##Ptr = std::shared_ptr<git_##T>; \
#define CLASS(T) \
class T; \
using T##Del = std::function<void(git_##T*)>; \
using T##Ptr = std::shared_ptr<git_##T>; \
using T##UPtr = std::unique_ptr<git_##T, T##Del>;
// NOLINTEND
@@ -42,8 +42,6 @@
using filemode_t = git_filemode_t;
using off_t = git_off_t;
using object_size_t = git_object_size_t;
using diff_options = git_diff_options;
using diff_binary_cb = git_diff_binary_cb;
using diff_file_cb = git_diff_file_cb;
using diff_hunk_cb = git_diff_hunk_cb;
diff --git a/ source/branch.cpp b/ source/branch.cpp
@@ -29,16 +29,17 @@
const std::string& branch::get_name()
}
const char* name = nullptr;
switch (git_branch_name(&name, m_ref.get())) {
case error_code_t::OK:
break;
case error_code_t::EINVALID:
throw error<error_code_t::EINVALID>();
default:
throw error<error_code_t::ERROR>();
const auto err = error_code_t(git_branch_name(&name, m_ref.get()));
if (err == error_code_t::ok) {
return m_name = name;
}
if (err == error_code_t::einvalid) {
throw error<error_code_t::einvalid>();
}
return m_name = name;
throw error<error_code_t::error>();
}
branch_iterator::branch_iterator(git_branch_iterator* iter)
@@ -54,16 +55,13 @@
branch_iterator& branch_iterator::operator++()
git_reference* ref = nullptr;
git_branch_t type = {};
switch (git_branch_next(&ref, &type, get())) {
case error_code_t::OK:
case error_code_t::ITEROVER:
break;
default:
throw error<error_code_t::ERROR>();
const auto err = error_code_t(git_branch_next(&ref, &type, get()));
if (err == error_code_t::ok || err == error_code_t::iterover) {
m_branch = branch(ref, type);
return *this;
}
m_branch = branch(ref, type);
return *this;
throw error<error_code_t::error>();
}
bool operator==(const branch_iterator& lhs, const branch_iterator& rhs)
diff --git a/ source/commit.cpp b/ source/commit.cpp
@@ -85,7 +85,7 @@
commit commit::get_parent(unsigned n) const
git_commit* cmt = nullptr;
if (git_commit_parent(&cmt, m_commit.get(), n) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return {cmt, m_repo};
@@ -95,16 +95,18 @@
buf commit::get_header_field(const char* field) const
{
buf bufr;
switch (git_commit_header_field(bufr.get(), m_commit.get(), field)) {
case error_code_t::OK:
break;
case error_code_t::ENOTFOUND:
throw error<error_code_t::ENOTFOUND>();
default:
throw error<error_code_t::ERROR>();
const auto err =
error_code_t(git_commit_header_field(bufr.get(), m_commit.get(), field));
if (err == error_code_t::ok) {
return bufr;
}
if (err == error_code_t::enotfound) {
throw error<error_code_t::enotfound>();
}
return bufr;
throw error<error_code_t::error>();
}
tree commit::get_tree() const
@@ -112,7 +114,7 @@
tree commit::get_tree() const
git_tree* tre = nullptr;
if (git_commit_tree(&tre, m_commit.get()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return {tre, m_repo};
diff --git a/ source/diff.cpp b/ source/diff.cpp
@@ -11,27 +11,31 @@
diff::diff(git_diff* dif, repositoryPtr repo)
{
}
int diff::foreach(diff_file_cb file_cb,
diff_binary_cb binary_cb,
diff_hunk_cb hunk_cb,
diff_line_cb line_cb,
void* payload) const
int diff::foreach(
diff_file_cb file_cb,
diff_binary_cb binary_cb,
diff_hunk_cb hunk_cb,
diff_line_cb line_cb,
void* payload
) const
{
return git_diff_foreach(
m_diff.get(), file_cb, binary_cb, hunk_cb, line_cb, payload);
m_diff.get(), file_cb, binary_cb, hunk_cb, line_cb, payload
);
}
diff diff::tree_to_tree(const tree& old,
const tree& crnt,
const git_diff_options* opts)
diff diff::tree_to_tree(
const tree& old, const tree& crnt, const git_diff_options* opts
)
{
git_diff* dif = nullptr;
if (git_diff_tree_to_tree(
&dif, crnt.get_owner().get(), old.ptr(), crnt.ptr(), opts)
&dif, crnt.get_owner().get(), old.ptr(), crnt.ptr(), opts
)
!= 0)
{
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return {dif, old.get_owner()};
@@ -47,7 +51,7 @@
diff_stats diff::get_stats() const
git_diff_stats* stats = nullptr;
if (git_diff_get_stats(&stats, m_diff.get()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return diff_stats(stats);
diff --git a/ source/libgit2.cpp b/ source/libgit2.cpp
@@ -8,7 +8,7 @@
namespace git2wrap
libgit2::libgit2()
{
if (m_cinit = git_libgit2_init(); m_cinit < 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
}
diff --git a/ source/object.cpp b/ source/object.cpp
@@ -28,7 +28,7 @@
buf object::get_id_short() const
buf bufr;
if (git_object_short_id(bufr.get(), m_obj.get()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return bufr;
diff --git a/ source/reference.cpp b/ source/reference.cpp
@@ -1,7 +1,5 @@
#include "git2wrap/reference.hpp"
#include "git2wrap/error.hpp"
namespace git2wrap
{
diff --git a/ source/repository.cpp b/ source/repository.cpp
@@ -22,7 +22,7 @@
repository::repository(const char* path, unsigned is_bare)
git_repository* repo = nullptr;
if (git_repository_init(&repo, path, is_bare) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
m_repo = {repo, git_repository_free};
@@ -33,20 +33,20 @@
repository::repository(const char* path, init_options* opts)
git_repository* repo = nullptr;
if (git_repository_init_ext(&repo, path, opts) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
m_repo = {repo, git_repository_free};
}
repository repository::clone(const char* url,
const char* local_path,
const clone_options* options)
repository repository::clone(
const char* url, const char* local_path, const clone_options* options
)
{
git_repository* repo = nullptr;
if (git_clone(&repo, url, local_path, options) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return repository(repo);
@@ -57,48 +57,54 @@
repository repository::open(const char* path)
git_repository* repo = nullptr;
if (git_repository_open(&repo, path) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return repository(repo);
}
repository repository::open(const char* path,
unsigned flags,
const char* ceiling_dirs)
repository repository::open(
const char* path, unsigned flags, const char* ceiling_dirs
)
{
git_repository* repo = nullptr;
switch (git_repository_open_ext(&repo, path, flags, ceiling_dirs)) {
case error_code_t::OK:
break;
case error_code_t::ENOTFOUND:
throw error<error_code_t::ENOTFOUND>();
default:
throw error<error_code_t::ERROR>();
const auto err =
error_code_t(git_repository_open_ext(&repo, path, flags, ceiling_dirs));
if (err == error_code_t::ok) {
return repository(repo);
}
return repository(repo);
if (err == error_code_t::enotfound) {
throw error<error_code_t::enotfound>();
}
throw error<error_code_t::error>();
}
object repository::revparse(const char* spec) const
{
git_object* obj = nullptr;
switch (git_revparse_single(&obj, m_repo.get(), spec)) {
case error_code_t::OK:
break;
case error_code_t::ENOTFOUND:
throw error<error_code_t::ENOTFOUND>();
case error_code_t::EAMBIGUOUS:
throw error<error_code_t::EAMBIGUOUS>();
case error_code_t::EINVALIDSPEC:
throw error<error_code_t::EINVALIDSPEC>();
default:
throw error<error_code_t::ERROR>();
const auto err = error_code_t(git_revparse_single(&obj, m_repo.get(), spec));
if (err == error_code_t::ok) {
return {obj, m_repo};
}
if (err == error_code_t::enotfound) {
throw error<error_code_t::enotfound>();
}
if (err == error_code_t::eambiguous) {
throw error<error_code_t::eambiguous>();
}
if (err == error_code_t::einvalidspec) {
throw error<error_code_t::einvalidspec>();
}
return {obj, m_repo};
throw error<error_code_t::error>();
}
commit repository::commit_lookup(const oid& objid) const
@@ -106,7 +112,7 @@
commit repository::commit_lookup(const oid& objid) const
git_commit* commit = nullptr;
if (git_commit_lookup(&commit, m_repo.get(), objid.ptr()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return {commit, m_repo};
@@ -117,7 +123,7 @@
blob repository::blob_lookup(const oid& objid) const
git_blob* blob = nullptr;
if (git_blob_lookup(&blob, m_repo.get(), objid.ptr()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return {blob, m_repo};
@@ -128,7 +134,7 @@
tag repository::tag_lookup(const oid& objid) const
git_tag* tagg = nullptr;
if (git_tag_lookup(&tagg, m_repo.get(), objid.ptr()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return {tagg, m_repo};
@@ -144,7 +150,7 @@
branch_iterator repository::branch_begin(git_branch_t list_flags) const
git_branch_iterator* iter = nullptr;
if (git_branch_iterator_new(&iter, m_repo.get(), list_flags) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return branch_iterator(iter);
@@ -153,7 +159,7 @@
branch_iterator repository::branch_begin(git_branch_t list_flags) const
void repository::tag_foreach(git_tag_foreach_cb callback, void* payload) const
{
if (git_tag_foreach(m_repo.get(), callback, payload) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
}
diff --git a/ source/revwalk.cpp b/ source/revwalk.cpp
@@ -12,7 +12,7 @@
revwalk::revwalk(repositoryPtr repo)
git_revwalk* rwalk = nullptr;
if (git_revwalk_new(&rwalk, m_repo.get()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
m_revwalk = {rwalk, git_revwalk_free};
@@ -21,21 +21,21 @@
revwalk::revwalk(repositoryPtr repo)
void revwalk::push(const oid& objid)
{
if (git_revwalk_push(m_revwalk.get(), objid.ptr()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
}
void revwalk::push_glob(const char* glob)
{
if (git_revwalk_push_glob(m_revwalk.get(), glob) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
}
void revwalk::push_head()
{
if (git_revwalk_push_head(m_revwalk.get()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
}
@@ -43,20 +43,23 @@
commit revwalk::next()
{
static git_oid objid;
switch (git_revwalk_next(&objid, m_revwalk.get())) {
case error_code_t::OK:
return repository(m_repo).commit_lookup(oid(&objid));
case error_code_t::ITEROVER:
break;
const auto err = error_code_t(git_revwalk_next(&objid, m_revwalk.get()));
if (err == error_code_t::ok) {
return repository(m_repo).commit_lookup(oid(&objid));
}
return {};
if (err == error_code_t::iterover) {
return {};
}
// should not happen
throw error<error_code_t::error>();
}
void revwalk::reset()
{
if (git_revwalk_reset(m_revwalk.get()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
}
diff --git a/ source/tree.cpp b/ source/tree.cpp
@@ -54,17 +54,19 @@
tree_entry tree::get_entry_path(const char* path) const
{
git_tree_entry* entry = nullptr;
switch (git_tree_entry_bypath(&entry, m_tree.get(), path)) {
case error_code_t::OK:
break;
case error_code_t::ENOTFOUND:
throw error<error_code_t::ENOTFOUND>();
default:
// should not happen
throw error<error_code_t::ERROR>();
const auto err =
error_code_t(git_tree_entry_bypath(&entry, m_tree.get(), path));
if (err == error_code_t::ok) {
return {entry, m_repo};
}
return {entry, m_repo};
if (err == error_code_t::enotfound) {
throw error<error_code_t::enotfound>();
}
// should not happen
throw error<error_code_t::error>();
}
tree_entry::tree_entry(const git_tree_entry* entry, repositoryPtr repo)
@@ -84,7 +86,7 @@
tree_entry tree_entry::dup() const
git_tree_entry* entry = nullptr;
if (git_tree_entry_dup(&entry, m_entry.get()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return {entry, m_repo};
@@ -95,7 +97,7 @@
object tree_entry::to_object() const
git_object* obj = nullptr;
if (git_tree_entry_to_object(&obj, m_repo.get(), m_entry.get()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return {obj, m_repo};
@@ -106,7 +108,7 @@
tree tree_entry::to_tree() const
git_object* obj = nullptr;
if (git_tree_entry_to_object(&obj, m_repo.get(), m_entry.get()) != 0) {
throw error<error_code_t::ERROR>();
throw error<error_code_t::error>();
}
return {reinterpret_cast<git_tree*>(obj), m_repo}; // NOLINT
diff --git a/ test/CMakeLists.txt b/ test/CMakeLists.txt
@@ -14,13 +14,13 @@
include(Catch)
function(add_test NAME)
add_executable("${NAME}" "source/${NAME}.cpp")
target_link_libraries("${NAME}" PRIVATE based::based)
target_link_libraries("${NAME}" PRIVATE git2wrap::git2wrap)
target_link_libraries("${NAME}" PRIVATE Catch2::Catch2WithMain)
target_compile_features("${NAME}" PRIVATE cxx_std_20)
catch_discover_tests("${NAME}")
endfunction()
add_test(git2wrap_test)
# add_test(git2wrap_test)
# ---- End-of-file commands ----
diff --git a/ vcpkg-configuration.json b/ vcpkg-configuration.json
@@ -9,7 +9,7 @@
"kind": "git",
"repository": "git://git.dimitrijedobrota.com/vcpkg-registry.git",
"baseline": "cc7113e63d7bb988a70e6b6dd91c5cd1af04bdfb",
"packages": []
"packages": [ "libgit2", "based"]
}
]
}
diff --git a/ vcpkg.json b/ vcpkg.json
@@ -5,6 +5,10 @@
{
"name": "libgit2",
"version>=": "1.9.0"
},
{
"name": "based",
"version>=": "0.1.2"
}
],
"default-features": [],