Skip to content

Commit 641dcb7

Browse files
committed
Migrate from GUL14 to GUL17
This PR replaces GUL14 as a base library by GUL17. Most of the modifications are done automatically. Signed-off-by: Lars Froehlich <lars.froehlich@desy.de>
1 parent 0394e57 commit 641dcb7

File tree

11 files changed

+88
-86
lines changed

11 files changed

+88
-86
lines changed

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Section: devel
33
Priority: optional
44
Maintainer: Jannik Woehnert <jannik.woehnert@desy.de>
55
Standards-Version: 4.6.0
6-
Build-Depends: dev-doocs-libgul14 | libgul14-dev, meson (>=0.50.0), pkg-config, debhelper-compat (=12), catch2 (>=3.4.0) | libcatch2, libgit2-dev
6+
Build-Depends: gul17-dev | libgul14-dev, meson (>=0.50.0), pkg-config, debhelper-compat (=12), catch2 (>=3.4.0) | libcatch2, libgit2-dev
77

88
Package: libgit4cpp-0-5-1
99
Section: libs

include/libgit4cpp/Remote.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* \date Created on January 15, 2024
55
* \brief Declaration of the Remote class.
66
*
7-
* \copyright Copyright 2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg
7+
* \copyright Copyright 2024-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
88
*
99
* This program is free software: you can redistribute it and/or modify
1010
* it under the terms of the GNU Lesser General Public License as published
@@ -25,11 +25,11 @@
2525
#ifndef LIBGIT4CPP_REMOTE_H_
2626
#define LIBGIT4CPP_REMOTE_H_
2727

28+
#include <optional>
2829
#include <string>
2930

3031
#include <git2.h>
31-
#include <gul14/optional.h>
32-
#include <gul14/SmallVector.h>
32+
#include <gul17/SmallVector.h>
3333

3434
#include "libgit4cpp/types.h"
3535

include/libgit4cpp/Repository.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* \date Created on March 20, 2023
55
* \brief Wrapper for C-Package libgit2
66
*
7-
* \copyright Copyright 2023-2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg
7+
* \copyright Copyright 2023-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
88
*
99
* This program is free software: you can redistribute it and/or modify
1010
* it under the terms of the GNU Lesser General Public License as published
@@ -30,7 +30,7 @@
3030
#include <vector>
3131

3232
#include <git2.h>
33-
#include <gul14/escape.h>
33+
#include <gul17/escape.h>
3434

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

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

194194
/**
195195
* Return a list of all configured remote repositories.

meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ inc = [ ]
5555
subdir('include')
5656
subdir('src')
5757

58-
gul_dep = dependency('libgul14', version : '> 2.6', fallback : [ 'libgul14', 'libgul_dep' ])
58+
gul_dep = dependency('gul17', fallback : [ 'gul17', 'libgul_dep' ])
5959
libgit2_dep = dependency('libgit2')
6060

6161
deps = [
@@ -93,7 +93,7 @@ pkg.generate(lib,
9393
version : libno,
9494
filebase : pkg_config_name,
9595
libraries : [ '-Wl,-rpath,${libdir}' ],
96-
requires : [ 'libgul14', 'libgit2' ],
96+
requires : [ 'gul17', 'libgit2' ],
9797
)
9898

9999

src/Remote.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* \date Created on January 15, 2024
55
* \brief Implementation of the Remote class.
66
*
7-
* \copyright Copyright 2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg
7+
* \copyright Copyright 2024-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
88
*
99
* This program is free software: you can redistribute it and/or modify
1010
* it under the terms of the GNU Lesser General Public License as published
@@ -23,14 +23,14 @@
2323
// SPDX-License-Identifier: LGPL-2.1-or-later
2424

2525
#include <git2.h>
26-
#include <gul14/cat.h>
26+
#include <gul17/cat.h>
2727

28+
#include "credentials_callback.h"
2829
#include "libgit4cpp/Error.h"
2930
#include "libgit4cpp/Remote.h"
3031
#include "libgit4cpp/wrapper_functions.h"
31-
#include "credentials_callback.h"
3232

33-
using gul14::cat;
33+
using gul17::cat;
3434

3535
namespace git {
3636

src/Repository.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* \date Created on March 20, 2023
55
* \brief Implementation of the Repository class.
66
*
7-
* \copyright Copyright 2023-2024 Deutsches Elektronen-Synchrotron (DESY), Hamburg
7+
* \copyright Copyright 2023-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
88
*
99
* This program is free software: you can redistribute it and/or modify
1010
* it under the terms of the GNU Lesser General Public License as published
@@ -22,19 +22,20 @@
2222

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

25+
#include <cstring>
2526
#include <iostream>
2627
#include <vector>
2728

2829
#include <git2.h>
29-
#include <gul14/cat.h>
30-
#include <gul14/finalizer.h>
30+
#include <gul17/cat.h>
31+
#include <gul17/finalizer.h>
3132

3233
#include "libgit4cpp/Error.h"
3334
#include "libgit4cpp/Repository.h"
3435
#include "libgit4cpp/wrapper_functions.h"
3536
#include "credentials_callback.h"
3637

37-
using gul14::cat;
38+
using gul17::cat;
3839

3940
namespace git {
4041

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

444-
gul14::optional<Remote> Repository::get_remote(const std::string& remote_name) const
445+
std::optional<Remote> Repository::get_remote(const std::string& remote_name) const
445446
{
446447
auto remote = remote_lookup(repo_.get(), remote_name);
447448
if (!remote)
@@ -477,7 +478,7 @@ std::vector<std::string> Repository::list_remote_names() const
477478
int err = git_remote_list(&remotes, repo_.get());
478479
if (err)
479480
throw Error{ cat("Cannot list remotes: ", git_error_last()->message) };
480-
auto cleanup = gul14::finally([&remotes]() { git_strarray_free(&remotes); });
481+
auto cleanup = gul17::finally([&remotes]() { git_strarray_free(&remotes); });
481482

482483
std::vector<std::string> list;
483484
list.reserve(remotes.count);

src/wrapper_functions.cc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* \date Created on March 20, 2023
55
* \brief Implementation of wrappers for libgit2 functions.
66
*
7-
* \copyright Copyright 2023 Deutsches Elektronen-Synchrotron (DESY), Hamburg
7+
* \copyright Copyright 2023-2025 Deutsches Elektronen-Synchrotron (DESY), Hamburg
88
*
99
* This program is free software: you can redistribute it and/or modify
1010
* it under the terms of the GNU Lesser General Public License as published
@@ -23,8 +23,8 @@
2323
// SPDX-License-Identifier: LGPL-2.1-or-later
2424

2525
#include <git2.h>
26-
#include <gul14/cat.h>
27-
#include <gul14/finalizer.h>
26+
#include <gul17/cat.h>
27+
#include <gul17/finalizer.h>
2828

2929
#include "libgit4cpp/wrapper_functions.h"
3030
#include "libgit4cpp/Error.h"
@@ -36,7 +36,7 @@ LibGitRepository repository_open(const std::string& repo_path)
3636
git_repository* repo;
3737
if (git_repository_open(&repo, repo_path.c_str()))
3838
{
39-
// gul14::cat("repository_open: ", git_error_last()->message);
39+
// gul17::cat("repository_open: ", git_error_last()->message);
4040
repo = nullptr;
4141
}
4242

@@ -55,7 +55,7 @@ LibGitRepository repository_init(const std::string& repo_path, bool is_bare)
5555
int error = git_repository_init_ext(&repo, repo_path.c_str(), &opts);
5656
if (error)
5757
{
58-
// gul14::cat("repository_init: ", git_error_last()->message);
58+
// gul17::cat("repository_init: ", git_error_last()->message);
5959
repo = nullptr;
6060
}
6161
return { repo, git_repository_free };
@@ -66,7 +66,7 @@ LibGitIndex repository_index(git_repository* repo)
6666
git_index* index;
6767
if (git_repository_index(&index, repo))
6868
{
69-
// gul14::cat("repository_index: ", git_error_last()->message);
69+
// gul17::cat("repository_index: ", git_error_last()->message);
7070
index = nullptr;
7171
}
7272
return { index, git_index_free };
@@ -77,7 +77,7 @@ LibGitSignature signature_default(git_repository* repo)
7777
git_signature* signature;
7878
if (git_signature_default(&signature, repo))
7979
{
80-
// gul14::cat("signature_default: ", git_error_last()->message);
80+
// gul17::cat("signature_default: ", git_error_last()->message);
8181
signature = nullptr;
8282
}
8383
return { signature, git_signature_free };
@@ -88,7 +88,7 @@ LibGitSignature signature_new(const std::string& name, const std::string& email,
8888
git_signature* signature;
8989
if (git_signature_new(&signature, name.c_str(), email.c_str(), time, offset))
9090
{
91-
// gul14::cat("signature_new: ", git_error_last()->message);
91+
// gul17::cat("signature_new: ", git_error_last()->message);
9292
signature = nullptr;
9393
}
9494
return { signature, git_signature_free };
@@ -99,7 +99,7 @@ LibGitTree tree_lookup(git_repository* repo, git_oid tree_id)
9999
git_tree* tree;
100100
if (git_tree_lookup(&tree, repo, &tree_id))
101101
{
102-
// gul14::cat("tree_lookup: ", git_error_last()->message);
102+
// gul17::cat("tree_lookup: ", git_error_last()->message);
103103
tree = nullptr;
104104
}
105105
return { tree, git_tree_free };
@@ -111,7 +111,7 @@ LibGitRemote remote_create(git_repository* repo, const std::string& remote_name,
111111
git_remote* remote;
112112
if (git_remote_create(&remote, repo, remote_name.c_str(), url.c_str()))
113113
{
114-
// gul14::cat("remote_create: ", git_error_last()->message);
114+
// gul17::cat("remote_create: ", git_error_last()->message);
115115
remote = nullptr;
116116
}
117117
return { remote, git_remote_free };
@@ -130,7 +130,7 @@ LibGitStatusList status_list_new(git_repository* repo, const git_status_options&
130130
git_status_list* status;
131131
if (git_status_list_new(&status, repo, &status_opt))
132132
{
133-
// gul14::cat("status_list_new: ", git_error_last()->message);
133+
// gul17::cat("status_list_new: ", git_error_last()->message);
134134
status = nullptr;
135135
}
136136
return { status, git_status_list_free };
@@ -141,7 +141,7 @@ LibGitReference repository_head(git_repository* repo)
141141
git_reference* reference;
142142
if (git_repository_head(&reference, repo))
143143
{
144-
// gul14::cat("reposiotry_head: ", git_error_last()->message);
144+
// gul17::cat("reposiotry_head: ", git_error_last()->message);
145145
reference = nullptr;
146146
}
147147
return { reference, git_reference_free };
@@ -152,7 +152,7 @@ LibGitRepository clone(const std::string& url, const std::string& repo_path)
152152
git_repository* repo;
153153
if (git_clone(&repo, url.c_str(), repo_path.c_str(), nullptr))
154154
{
155-
// gul14::cat("branch_remote_name: ", git_error_last()->message);
155+
// gul17::cat("branch_remote_name: ", git_error_last()->message);
156156
repo = nullptr;
157157
}
158158
return { repo, git_repository_free };
@@ -164,7 +164,7 @@ LibGitReference branch_lookup(git_repository* repo, const std::string& branch_na
164164
git_reference* ref;
165165
if (git_branch_lookup(&ref, repo, branch_name.c_str(), branch_type))
166166
{
167-
// gul14::cat("branch_lookup: ", git_error_last()->message);
167+
// gul17::cat("branch_lookup: ", git_error_last()->message);
168168
ref = nullptr;
169169
}
170170
return { ref, git_reference_free };
@@ -191,10 +191,10 @@ LibGitReference branch_create(git_repository* repo, const std::string& new_branc
191191
std::string branch_remote_name(git_repository* repo, const std::string& branch_name)
192192
{
193193
git_buf buf{ };
194-
auto _ = gul14::finally([buf_addr = &buf]() { git_buf_dispose(buf_addr); });
194+
auto _ = gul17::finally([buf_addr = &buf]() { git_buf_dispose(buf_addr); });
195195
auto error = git_branch_remote_name(&buf, repo, branch_name.c_str());
196196
if (error) {
197-
throw Error{ error, gul14::cat("branch_remote_name: ", git_error_last()->message) };
197+
throw Error{ error, gul17::cat("branch_remote_name: ", git_error_last()->message) };
198198
}
199199
auto ret = std::string{ buf.ptr };
200200
return ret;
@@ -204,15 +204,15 @@ std::string reference_shorthand(const git_reference* ref)
204204
{
205205
const char* name_cstr = git_reference_shorthand(ref);
206206
if (name_cstr == nullptr)
207-
throw Error{gul14::cat("reference_shorthand: ", git_error_last()->message) };
207+
throw Error{gul17::cat("reference_shorthand: ", git_error_last()->message) };
208208
return std::string(name_cstr);
209209
}
210210

211211
std::string reference_name(git_reference* ref)
212212
{
213213
const char* name_cstr = git_reference_name(ref);
214214
if (name_cstr == nullptr)
215-
throw Error{gul14::cat("reference_name: ", git_error_last()->message) };
215+
throw Error{gul17::cat("reference_name: ", git_error_last()->message) };
216216
return std::string(name_cstr);
217217
}
218218

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

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

subprojects/gul17.wrap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[wrap-git]
2+
directory = gul17
3+
url = https://github.com/gul-cpp/gul17.git
4+
revision = main
5+
6+
[provide]
7+
dependency_names = gul17
8+
gul17 = libgul_dep

subprojects/libgul14.wrap

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/test_Remote.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
#include <catch2/catch_test_macros.hpp>
2929
#include <git2.h>
30-
#include <gul14/gul.h>
3130

3231
#include "libgit4cpp/Error.h"
3332
#include "libgit4cpp/Repository.h"
@@ -37,7 +36,6 @@
3736

3837
using namespace git;
3938
using namespace std::literals;
40-
using gul14::cat;
4139

4240
static const auto working_dir = unit_test_folder() / "Remote_list_references";
4341
static const auto remote_repo = unit_test_folder() / "Remote_list_references.remote";

0 commit comments

Comments
 (0)