Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Commit 1cd8d6f

Browse files
committed
Minor updates
1 parent 9ba8246 commit 1cd8d6f

14 files changed

+35
-29
lines changed

include/cppgit2/diff.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
#include <cppgit2/ownership.hpp>
88
#include <cppgit2/signature.hpp>
99
#include <cppgit2/strarray.hpp>
10+
#include <functional>
1011
#include <git2.h>
1112
#include <string>
1213
#include <utility>
1314
#include <vector>
14-
#include <functional>
1515

1616
namespace cppgit2 {
1717

include/cppgit2/indexer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <cppgit2/odb.hpp>
44
#include <cppgit2/oid.hpp>
55
#include <cppgit2/ownership.hpp>
6-
#include <git2.h>
76
#include <functional>
7+
#include <git2.h>
88

99
namespace cppgit2 {
1010

include/cppgit2/libgit2_api.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class libgit2_api {
1717
int major, minor, revision;
1818
if (git_libgit2_version(&major, &minor, &revision))
1919
throw git_exception();
20-
return {major, minor, revision};
20+
return std::tuple<int, int, int>{major, minor, revision};
2121
}
2222
};
2323

include/cppgit2/odb.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#include <cppgit2/object.hpp>
66
#include <cppgit2/oid.hpp>
77
#include <cppgit2/ownership.hpp>
8+
#include <functional>
89
#include <git2.h>
910
#include <tuple>
1011
#include <utility>
1112
#include <vector>
12-
#include <functional>
1313

1414
namespace cppgit2 {
1515

include/cppgit2/patch.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
#include <cppgit2/diff.hpp>
44
#include <cppgit2/libgit2_api.hpp>
55
#include <cppgit2/ownership.hpp>
6+
#include <functional>
67
#include <git2.h>
78
#include <string>
89
#include <tuple>
9-
#include <functional>
1010

1111
namespace cppgit2 {
1212

include/cppgit2/remote.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ class remote : public libgit2_api {
149149
const fetch::options &options = fetch::options());
150150

151151
// Download new data and update tips
152-
void fetch_data(const strarray &refspecs, const std::string &reflog_message,
153-
const cppgit2::fetch::options &options = cppgit2::fetch::options());
152+
void fetch_data(
153+
const strarray &refspecs, const std::string &reflog_message,
154+
const cppgit2::fetch::options &options = cppgit2::fetch::options());
154155

155156
// Get the remote's list of fetch refspecs
156157
// The memory is owned by the user and should be freed

include/cppgit2/repository.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
#include <cppgit2/tag.hpp>
3838
#include <cppgit2/tree_builder.hpp>
3939
#include <cppgit2/worktree.hpp>
40+
#include <functional>
4041
#include <git2.h>
4142
#include <string>
4243
#include <utility>
43-
#include <functional>
4444

4545
namespace cppgit2 {
4646

include/cppgit2/revwalk.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include <cppgit2/libgit2_api.hpp>
44
#include <cppgit2/oid.hpp>
55
#include <cppgit2/ownership.hpp>
6-
#include <git2.h>
76
#include <functional>
7+
#include <git2.h>
88

99
namespace cppgit2 {
1010

include/cppgit2/tree_builder.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include <functional>
99
#include <git2.h>
1010
#include <string>
11-
#include <functional>
1211

1312
namespace cppgit2 {
1413

src/odb.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ odb::read_header(const oid &id) const {
132132
git_object_t object_type_out;
133133
if (git_odb_read_header(&length_out, &object_type_out, c_ptr_, id.c_ptr()))
134134
throw git_exception();
135-
return {length_out,
136-
static_cast<cppgit2::object::object_type>(object_type_out)};
135+
return std::pair<size_t, cppgit2::object::object_type>{
136+
length_out, static_cast<cppgit2::object::object_type>(object_type_out)};
137137
}
138138

139139
odb::object odb::read_prefix(const oid &id, size_t length) const {
@@ -164,7 +164,8 @@ odb::open_rstream(const oid &id) {
164164
git_object_t type;
165165
if (git_odb_open_rstream(&result.c_ptr_, &length, &type, c_ptr_, id.c_ptr()))
166166
throw git_exception();
167-
return {result, length, static_cast<cppgit2::object::object_type>(type)};
167+
return std::tuple<odb::stream, size_t, cppgit2::object::object_type>{
168+
result, length, static_cast<cppgit2::object::object_type>(type)};
168169
}
169170

170171
odb::stream odb::open_wstream(cppgit2::object::object_size size,

src/patch.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ std::pair<diff::hunk, size_t> patch::hunk(size_t hunk_index) const {
5959
size_t lines_in_hunk;
6060
if (git_patch_get_hunk(&hunk_result_ptr, &lines_in_hunk, c_ptr_, hunk_index))
6161
throw git_exception();
62-
return {hunk_result, lines_in_hunk};
62+
return std::pair<diff::hunk, size_t>{hunk_result, lines_in_hunk};
6363
}
6464

6565
diff::line patch::line_in_hunk(size_t hunk_index, size_t line_of_hunk) const {
@@ -75,7 +75,8 @@ std::tuple<size_t, size_t, size_t> patch::line_stats() const {
7575
if (git_patch_line_stats(&context_lines, &addition_lines, &deletion_lines,
7676
c_ptr_))
7777
throw git_exception();
78-
return {context_lines, addition_lines, deletion_lines};
78+
return std::tuple<size_t, size_t, size_t>{context_lines, addition_lines,
79+
deletion_lines};
7980
}
8081

8182
size_t patch::num_hunks() const { return git_patch_num_hunks(c_ptr_); }

src/remote.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ void remote::download(const strarray &refspecs, const fetch::options &options) {
7474
throw git_exception();
7575
}
7676

77-
void remote::fetch_data(const strarray &refspecs, const std::string &reflog_message,
78-
const fetch::options &options) {
77+
void remote::fetch_data(const strarray &refspecs,
78+
const std::string &reflog_message,
79+
const fetch::options &options) {
7980
if (git_remote_fetch(c_ptr_, refspecs.c_ptr(), options.c_ptr(),
8081
reflog_message.c_str()))
8182
throw git_exception();

src/repository.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ std::pair<std::string, std::string> repository::identity() const {
245245
const char *name_c, *email_c;
246246
if (git_repository_ident(&name_c, &email_c, c_ptr_))
247247
throw git_exception();
248-
return {name_c ? name_c : "", email_c ? email_c : ""};
248+
return std::pair<std::string, std::string>{name_c ? name_c : "",
249+
email_c ? email_c : ""};
249250
}
250251

251252
cppgit2::index repository::index() const {
@@ -820,7 +821,7 @@ repository::extract_signature_from_commit(oid id,
820821
if (git_commit_extract_signature(sig.c_ptr(), signed_data.c_ptr(), c_ptr_,
821822
id.c_ptr(), signature_field.c_str()))
822823
throw git_exception();
823-
return {sig, signed_data};
824+
return std::pair<data_buffer, data_buffer>{sig, signed_data};
824825
}
825826

826827
commit repository::lookup_commit(const oid &id) {
@@ -963,7 +964,7 @@ repository::unique_commits_ahead_behind(const oid &local,
963964
if (git_graph_ahead_behind(&ahead, &behind, c_ptr_, local.c_ptr(),
964965
upstream.c_ptr()))
965966
throw git_exception();
966-
return {ahead, behind};
967+
return std::pair<size_t, size_t>{ahead, behind};
967968
}
968969

969970
bool repository::is_descendant_of(const oid &commit,
@@ -1004,8 +1005,9 @@ repository::analyze_merge(const std::vector<annotated_commit> &their_heads) {
10041005
num_commits))
10051006
throw git_exception();
10061007

1007-
return {static_cast<merge::analysis_result>(analysis_result),
1008-
static_cast<merge::preference>(preference)};
1008+
return std::pair<merge::analysis_result, merge::preference>{
1009+
static_cast<merge::analysis_result>(analysis_result),
1010+
static_cast<merge::preference>(preference)};
10091011
}
10101012

10111013
std::pair<merge::analysis_result, merge::preference>
@@ -1026,8 +1028,9 @@ repository::analyze_merge(const reference &our_ref,
10261028
their_heads.size()))
10271029
throw git_exception();
10281030

1029-
return {static_cast<merge::analysis_result>(analysis_result),
1030-
static_cast<merge::preference>(preference)};
1031+
return std::pair<merge::analysis_result, merge::preference>{
1032+
static_cast<merge::analysis_result>(analysis_result),
1033+
static_cast<merge::preference>(preference)};
10311034
}
10321035

10331036
oid repository::find_merge_base(const oid &first_commit,
@@ -1166,7 +1169,7 @@ repository::create_note(const commit &parent, const signature &author,
11661169
committer.c_ptr(), id.c_ptr(), note.c_str(),
11671170
allow_note_override))
11681171
throw git_exception();
1169-
return {notes_commit_out, notes_blob_out};
1172+
return std::pair<oid, oid>{notes_commit_out, notes_blob_out};
11701173
}
11711174

11721175
note repository::read_note(const std::string &notes_ref, const oid &id) {
@@ -1582,7 +1585,7 @@ repository::revparse_to_object_and_reference(const std::string &spec) {
15821585
if (git_revparse_ext(&object_out.c_ptr_, &reference_out.c_ptr_, c_ptr_,
15831586
spec.c_str()))
15841587
throw git_exception();
1585-
return {object_out, reference_out};
1588+
return std::pair<object, reference>{object_out, reference_out};
15861589
}
15871590

15881591
object repository::revparse_to_object(const std::string &spec) {

src/worktree.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ std::pair<bool, std::string> worktree::is_locked() const {
1818
if (ret > 0) {
1919
// Locked
2020
if (result.c_ptr()->size) // size > 0 => reason available
21-
return {true, result.to_string()};
21+
return std::pair<bool, std::string>{true, result.to_string()};
2222
else
23-
return {true, ""};
23+
return std::pair<bool, std::string>{true, ""};
2424
} else if (ret == 0) {
2525
// Not locked
26-
return {false, ""};
26+
return std::pair<bool, std::string>{false, ""};
2727
} else {
2828
throw git_exception();
2929
}

0 commit comments

Comments
 (0)