Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_and_run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: Build and Tests
strategy:
matrix:
os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04 ]
os: [ ubuntu-22.04, ubuntu-24.04 ]
runs-on: ${{ matrix.os }}
steps:
- run: |
Expand Down
2 changes: 1 addition & 1 deletion LIBNO
Original file line number Diff line number Diff line change
@@ -1 +1 @@
LIBNO = 0.5.1
LIBNO = 0.5.2
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Section: devel
Priority: optional
Maintainer: Jannik Woehnert <jannik.woehnert@desy.de>
Standards-Version: 4.6.0
Build-Depends: dev-doocs-libgul14 | libgul14-dev, meson (>=0.50.0), pkg-config, debhelper-compat (=12), catch2 (>=3.4.0) | libcatch2, libgit2-dev
Build-Depends: gul17-dev, meson (>=0.50.0), pkg-config, debhelper-compat (=12), catch2 (>=3.4.0) | libcatch2, libgit2-dev

Package: libgit4cpp-0-5-1
Section: libs
Expand Down
5 changes: 2 additions & 3 deletions include/libgit4cpp/Remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* \date Created on January 15, 2024
* \brief Declaration of the Remote class.
*
* \copyright Copyright 2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg
* \copyright Copyright 2024-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
Expand All @@ -26,10 +26,9 @@
#define LIBGIT4CPP_REMOTE_H_

#include <string>
#include <vector>

#include <git2.h>
#include <gul14/optional.h>
#include <gul14/SmallVector.h>

#include "libgit4cpp/types.h"

Expand Down
9 changes: 5 additions & 4 deletions include/libgit4cpp/Repository.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* \date Created on March 20, 2023
* \brief Wrapper for C-Package libgit2
*
* \copyright Copyright 2023-2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg
* \copyright Copyright 2023-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
Expand All @@ -26,11 +26,12 @@
#define LIBGIT4CPP_REPOSITORY_H_

#include <filesystem>
#include <optional>
#include <string>
#include <vector>

#include <git2.h>
#include <gul14/escape.h>
#include <gul17/escape.h>

#include "libgit4cpp/Remote.h"
#include "libgit4cpp/types.h"
Expand All @@ -47,7 +48,7 @@ struct FileStatus
std::string changes; /// Change status of file [new file, deleted, renamed, typechanged, modified, unchanged, ignored, untracked]

friend std::ostream& operator<<(std::ostream& stream, FileStatus const& state) {
stream << "FileStatus{ \"" << gul14::escape(state.path_name) << "\": " << state.handling << "; " << state.changes << " }";
stream << "FileStatus{ \"" << gul17::escape(state.path_name) << "\": " << state.handling << "; " << state.changes << " }";
return stream;
}
};
Expand Down Expand Up @@ -189,7 +190,7 @@ class Repository
* Look up a git remote by name in the repository.
* \returns a Remote object if the remote exists, or an empty optional otherwise.
*/
gul14::optional<Remote> get_remote(const std::string& remote_name) const;
std::optional<Remote> get_remote(const std::string& remote_name) const;

/**
* Return a list of all configured remote repositories.
Expand Down
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ inc = [ ]
subdir('include')
subdir('src')

gul_dep = dependency('libgul14', version : '> 2.6', fallback : [ 'libgul14', 'libgul_dep' ])
gul_dep = dependency('gul17', fallback : [ 'gul17', 'libgul_dep' ])
libgit2_dep = dependency('libgit2')

deps = [
Expand Down Expand Up @@ -93,7 +93,7 @@ pkg.generate(lib,
version : libno,
filebase : pkg_config_name,
libraries : [ '-Wl,-rpath,${libdir}' ],
requires : [ 'libgul14', 'libgit2' ],
requires : [ 'gul17', 'libgit2' ],
)


Expand Down
8 changes: 4 additions & 4 deletions src/Remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* \date Created on January 15, 2024
* \brief Implementation of the Remote class.
*
* \copyright Copyright 2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg
* \copyright Copyright 2024-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
Expand All @@ -23,14 +23,14 @@
// SPDX-License-Identifier: LGPL-2.1-or-later

#include <git2.h>
#include <gul14/cat.h>
#include <gul17/cat.h>

#include "credentials_callback.h"
#include "libgit4cpp/Error.h"
#include "libgit4cpp/Remote.h"
#include "libgit4cpp/wrapper_functions.h"
#include "credentials_callback.h"

using gul14::cat;
using gul17::cat;

namespace git {

Expand Down
13 changes: 7 additions & 6 deletions src/Repository.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* \date Created on March 20, 2023
* \brief Implementation of the Repository class.
*
* \copyright Copyright 2023-2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg
* \copyright Copyright 2023-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
Expand All @@ -22,19 +22,20 @@

// SPDX-License-Identifier: LGPL-2.1-or-later

#include <cstring>
#include <iostream>
#include <vector>

#include <git2.h>
#include <gul14/cat.h>
#include <gul14/finalizer.h>
#include <gul17/cat.h>
#include <gul17/finalizer.h>

#include "libgit4cpp/Error.h"
#include "libgit4cpp/Repository.h"
#include "libgit4cpp/wrapper_functions.h"
#include "credentials_callback.h"

using gul14::cat;
using gul17::cat;

namespace git {

Expand Down Expand Up @@ -441,7 +442,7 @@ Remote Repository::add_remote(const std::string& remote_name, const std::string&
return Remote{ std::move(remote) };
}

gul14::optional<Remote> Repository::get_remote(const std::string& remote_name) const
std::optional<Remote> Repository::get_remote(const std::string& remote_name) const
{
auto remote = remote_lookup(repo_.get(), remote_name);
if (!remote)
Expand Down Expand Up @@ -477,7 +478,7 @@ std::vector<std::string> Repository::list_remote_names() const
int err = git_remote_list(&remotes, repo_.get());
if (err)
throw Error{ cat("Cannot list remotes: ", git_error_last()->message) };
auto cleanup = gul14::finally([&remotes]() { git_strarray_free(&remotes); });
auto cleanup = gul17::finally([&remotes]() { git_strarray_free(&remotes); });

std::vector<std::string> list;
list.reserve(remotes.count);
Expand Down
40 changes: 20 additions & 20 deletions src/wrapper_functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* \date Created on March 20, 2023
* \brief Implementation of wrappers for libgit2 functions.
*
* \copyright Copyright 2023 Deutsches Elektronen-Synchrotron (DESY), Hamburg
* \copyright Copyright 2023-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
Expand All @@ -23,8 +23,8 @@
// SPDX-License-Identifier: LGPL-2.1-or-later

#include <git2.h>
#include <gul14/cat.h>
#include <gul14/finalizer.h>
#include <gul17/cat.h>
#include <gul17/finalizer.h>

#include "libgit4cpp/wrapper_functions.h"
#include "libgit4cpp/Error.h"
Expand All @@ -36,7 +36,7 @@ LibGitRepository repository_open(const std::string& repo_path)
git_repository* repo;
if (git_repository_open(&repo, repo_path.c_str()))
{
// gul14::cat("repository_open: ", git_error_last()->message);
// gul17::cat("repository_open: ", git_error_last()->message);
repo = nullptr;
}

Expand All @@ -55,7 +55,7 @@ LibGitRepository repository_init(const std::string& repo_path, bool is_bare)
int error = git_repository_init_ext(&repo, repo_path.c_str(), &opts);
if (error)
{
// gul14::cat("repository_init: ", git_error_last()->message);
// gul17::cat("repository_init: ", git_error_last()->message);
repo = nullptr;
}
return { repo, git_repository_free };
Expand All @@ -66,7 +66,7 @@ LibGitIndex repository_index(git_repository* repo)
git_index* index;
if (git_repository_index(&index, repo))
{
// gul14::cat("repository_index: ", git_error_last()->message);
// gul17::cat("repository_index: ", git_error_last()->message);
index = nullptr;
}
return { index, git_index_free };
Expand All @@ -77,7 +77,7 @@ LibGitSignature signature_default(git_repository* repo)
git_signature* signature;
if (git_signature_default(&signature, repo))
{
// gul14::cat("signature_default: ", git_error_last()->message);
// gul17::cat("signature_default: ", git_error_last()->message);
signature = nullptr;
}
return { signature, git_signature_free };
Expand All @@ -88,7 +88,7 @@ LibGitSignature signature_new(const std::string& name, const std::string& email,
git_signature* signature;
if (git_signature_new(&signature, name.c_str(), email.c_str(), time, offset))
{
// gul14::cat("signature_new: ", git_error_last()->message);
// gul17::cat("signature_new: ", git_error_last()->message);
signature = nullptr;
}
return { signature, git_signature_free };
Expand All @@ -99,7 +99,7 @@ LibGitTree tree_lookup(git_repository* repo, git_oid tree_id)
git_tree* tree;
if (git_tree_lookup(&tree, repo, &tree_id))
{
// gul14::cat("tree_lookup: ", git_error_last()->message);
// gul17::cat("tree_lookup: ", git_error_last()->message);
tree = nullptr;
}
return { tree, git_tree_free };
Expand All @@ -111,7 +111,7 @@ LibGitRemote remote_create(git_repository* repo, const std::string& remote_name,
git_remote* remote;
if (git_remote_create(&remote, repo, remote_name.c_str(), url.c_str()))
{
// gul14::cat("remote_create: ", git_error_last()->message);
// gul17::cat("remote_create: ", git_error_last()->message);
remote = nullptr;
}
return { remote, git_remote_free };
Expand All @@ -130,7 +130,7 @@ LibGitStatusList status_list_new(git_repository* repo, const git_status_options&
git_status_list* status;
if (git_status_list_new(&status, repo, &status_opt))
{
// gul14::cat("status_list_new: ", git_error_last()->message);
// gul17::cat("status_list_new: ", git_error_last()->message);
status = nullptr;
}
return { status, git_status_list_free };
Expand All @@ -141,7 +141,7 @@ LibGitReference repository_head(git_repository* repo)
git_reference* reference;
if (git_repository_head(&reference, repo))
{
// gul14::cat("reposiotry_head: ", git_error_last()->message);
// gul17::cat("reposiotry_head: ", git_error_last()->message);
reference = nullptr;
}
return { reference, git_reference_free };
Expand All @@ -152,7 +152,7 @@ LibGitRepository clone(const std::string& url, const std::string& repo_path)
git_repository* repo;
if (git_clone(&repo, url.c_str(), repo_path.c_str(), nullptr))
{
// gul14::cat("branch_remote_name: ", git_error_last()->message);
// gul17::cat("branch_remote_name: ", git_error_last()->message);
repo = nullptr;
}
return { repo, git_repository_free };
Expand All @@ -164,7 +164,7 @@ LibGitReference branch_lookup(git_repository* repo, const std::string& branch_na
git_reference* ref;
if (git_branch_lookup(&ref, repo, branch_name.c_str(), branch_type))
{
// gul14::cat("branch_lookup: ", git_error_last()->message);
// gul17::cat("branch_lookup: ", git_error_last()->message);
ref = nullptr;
}
return { ref, git_reference_free };
Expand All @@ -191,10 +191,10 @@ LibGitReference branch_create(git_repository* repo, const std::string& new_branc
std::string branch_remote_name(git_repository* repo, const std::string& branch_name)
{
git_buf buf{ };
auto _ = gul14::finally([buf_addr = &buf]() { git_buf_dispose(buf_addr); });
auto _ = gul17::finally([buf_addr = &buf]() { git_buf_dispose(buf_addr); });
auto error = git_branch_remote_name(&buf, repo, branch_name.c_str());
if (error) {
throw Error{ error, gul14::cat("branch_remote_name: ", git_error_last()->message) };
throw Error{ error, gul17::cat("branch_remote_name: ", git_error_last()->message) };
}
auto ret = std::string{ buf.ptr };
return ret;
Expand All @@ -204,15 +204,15 @@ std::string reference_shorthand(const git_reference* ref)
{
const char* name_cstr = git_reference_shorthand(ref);
if (name_cstr == nullptr)
throw Error{gul14::cat("reference_shorthand: ", git_error_last()->message) };
throw Error{gul17::cat("reference_shorthand: ", git_error_last()->message) };
return std::string(name_cstr);
}

std::string reference_name(git_reference* ref)
{
const char* name_cstr = git_reference_name(ref);
if (name_cstr == nullptr)
throw Error{gul14::cat("reference_name: ", git_error_last()->message) };
throw Error{gul17::cat("reference_name: ", git_error_last()->message) };
return std::string(name_cstr);
}

Expand All @@ -221,7 +221,7 @@ LibGitReference parse_reference_from_name(git_repository* repo, const std::strin
git_reference* ref;
auto error = git_reference_dwim(&ref, repo, name.c_str());
if (error)
throw Error{gul14::cat("parse_reference_from_name: ", git_error_last()->message) };
throw Error{gul17::cat("parse_reference_from_name: ", git_error_last()->message) };
return {ref, git_reference_free};
}

Expand All @@ -230,7 +230,7 @@ LibGitBranchIterator branch_iterator(git_repository* repo, git_branch_t flag)
git_branch_iterator* iter;
auto error = git_branch_iterator_new(&iter, repo, flag);
if (error)
throw Error{gul14::cat("get_branch_iterator: ", git_error_last()->message) };
throw Error{gul17::cat("get_branch_iterator: ", git_error_last()->message) };
return {iter, git_branch_iterator_free};
}

Expand Down
8 changes: 8 additions & 0 deletions subprojects/gul17.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[wrap-git]
directory = gul17
url = https://github.com/gul-cpp/gul17.git
revision = main

[provide]
dependency_names = gul17
gul17 = libgul_dep
7 changes: 0 additions & 7 deletions subprojects/libgul14.wrap

This file was deleted.

3 changes: 1 addition & 2 deletions tests/test_Remote.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

// SPDX-License-Identifier: LGPL-2.1-or-later

#include <algorithm>
#include <filesystem>
#include <fstream>

#include <catch2/catch_test_macros.hpp>
#include <git2.h>
#include <gul14/gul.h>

#include "libgit4cpp/Error.h"
#include "libgit4cpp/Repository.h"
Expand All @@ -37,7 +37,6 @@

using namespace git;
using namespace std::literals;
using gul14::cat;

static const auto working_dir = unit_test_folder() / "Remote_list_references";
static const auto remote_repo = unit_test_folder() / "Remote_list_references.remote";
Expand Down
Loading
Loading