Skip to content

Commit cf12982

Browse files
committed
Updated libgit2 to version 0.10.0
1 parent cb76e3c commit cf12982

45 files changed

Lines changed: 2511 additions & 1617 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
.lock-wscript
22
build/
3-
vendor/

vendor/libgit2/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ ELSEIF (SHA1_TYPE STREQUAL "openssl")
9696
ENDIF ()
9797

9898
# Compile and link libgit2
99+
INCLUDE_DIRECTORIES(src include)
99100
ADD_LIBRARY(git2 ${SRC} ${SRC_PLAT} ${SRC_SHA1})
100101
TARGET_LINK_LIBRARIES(git2 ${ZLIB_LIBRARY} ${LIB_SHA1} ${PTHREAD_LIBRARY} ${SQLITE3_LIBRARIES})
101102
SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})

vendor/libgit2/README.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ libgit2 is a portable, pure C implementation of the Git core methods provided as
55
re-entrant linkable library with a solid API, allowing you to write native
66
speed custom Git applications in any language with bindings.
77

8+
libgit2 is licensed under a **very permissive license** (GPLv2 with a special Linking Exception).
9+
This basically means that you can link it (unmodified) with any kind of software without having to
10+
release its source code.
11+
12+
* Mailing list: <libgit2@librelist.org>
813
* Website: <http://libgit2.github.com>
914
* API documentation: <http://libgit2.github.com/libgit2/modules.html>
1015
* Usage guide: <http://libgit2.github.com/api.html>
@@ -14,13 +19,17 @@ What It Can Do
1419

1520
libgit2 is already very usable.
1621

17-
* raw <-> hex SHA conversions
18-
* raw object reading (loose and packed)
19-
* raw object writing (loose)
20-
* revlist walker
21-
* commit, tag and tree object parsing and write-back
22+
* SHA conversions, formatting and shortening
23+
* object reading (loose and packed)
24+
* object writing (loose)
25+
* commit, tag, tree and blob parsing and write-back
2226
* tree traversal
23-
* basic index file (staging area) operations
27+
* revision walking
28+
* index file (staging area) manipulation
29+
* custom ODB backends
30+
* reference management (including packed references)
31+
* ...and more
32+
2433

2534
Building libgit2 - External dependencies
2635
========================================
@@ -112,11 +121,14 @@ Language Bindings
112121
Here are the bindings to libgit2 that are currently available:
113122

114123
* Rugged (Ruby bindings) <https://github.com/libgit2/rugged>
124+
* objective-git (Objective-C bindings) <https://github.com/libgit2/objective-git>
115125
* pygit2 (Python bindings) <https://github.com/libgit2/pygit2>
116-
* libgit2sharp (.NET bindings) <https://github.com/nulltoken/libgit2sharp>
117-
* php-git (PHP bindings) <https://github.com/chobie/php-git>
118-
* luagit2 (Lua bindings) <https://github.com/Neopallium/luagit2>
119-
* GitForDelphi (Delphi bindings) <https://github.com/jasonpenny/GitForDelphi>
126+
* libgit2sharp (.NET bindings) <https://github.com/libgit2/libgit2sharp>
127+
* php-git (PHP bindings) <https://github.com/libgit2/php-git>
128+
* luagit2 (Lua bindings) <https://github.com/libgit2/luagit2>
129+
* GitForDelphi (Delphi bindings) <https://github.com/libgit2/GitForDelphi>
130+
* node-gitteh (Node.js bindings) <https://github.com/libgit2/node-gitteh>
131+
* libqgit2 (C++ QT bindings) <https://projects.kde.org/projects/playground/libs/libqgit2/>
120132
* Geef (Erlang bindings) <https://github.com/schacon/geef>
121133

122134
If you start another language binding to libgit2, please let us know so

vendor/libgit2/include/git2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
#ifndef INCLUDE_git_git_h__
2727
#define INCLUDE_git_git_h__
2828

29-
#define LIBGIT2_VERSION "0.8.0"
29+
#define LIBGIT2_VERSION "0.10.0"
3030
#define LIBGIT2_VER_MAJOR 0
31-
#define LIBGIT2_VER_MINOR 8
31+
#define LIBGIT2_VER_MINOR 10
3232
#define LIBGIT2_VER_REVISION 0
3333

3434
#include "git2/common.h"

vendor/libgit2/include/git2/blob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ GIT_EXTERN(int) git_blob_set_rawcontent(git_blob *blob, const void *buffer, size
102102
* @param blob pointer to the blob
103103
* @return the pointer; NULL if the blob has no contents
104104
*/
105-
GIT_EXTERN(const char *) git_blob_rawcontent(git_blob *blob);
105+
GIT_EXTERN(const void *) git_blob_rawcontent(git_blob *blob);
106106

107107
/**
108108
* Get the size in bytes of the contents of a blob

vendor/libgit2/include/git2/commit.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,11 @@ GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
122122

123123
/**
124124
* Get the tree pointed to by a commit.
125+
* @param tree_out pointer where to store the tree object
125126
* @param commit a previously loaded commit.
126-
* @return the tree of a commit
127+
* @return 0 on success; error code otherwise
127128
*/
128-
GIT_EXTERN(const git_tree *) git_commit_tree(git_commit *commit);
129+
GIT_EXTERN(int) git_commit_tree(git_tree **tree_out, git_commit *commit);
129130

130131
/**
131132
* Get the number of parents of this commit
@@ -137,11 +138,13 @@ GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit);
137138

138139
/**
139140
* Get the specified parent of the commit.
141+
*
142+
* @param parent Pointer where to store the parent commit
140143
* @param commit a previously loaded commit.
141-
* @param n the position of the entry
142-
* @return a pointer to the commit; NULL if out of bounds
144+
* @param n the position of the parent (from 0 to `parentcount`)
145+
* @return 0 on success; error code otherwise
143146
*/
144-
GIT_EXTERN(git_commit *) git_commit_parent(git_commit *commit, unsigned int n);
147+
GIT_EXTERN(int) git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n);
145148

146149
/**
147150
* Add a new parent commit to an existing commit
@@ -176,8 +179,9 @@ GIT_EXTERN(void) git_commit_set_author(git_commit *commit, const git_signature *
176179
* Set the tree which is pointed to by a commit
177180
* @param commit the commit object
178181
* @param tree the new tree
182+
* @param 0 on success; error code otherwise
179183
*/
180-
GIT_EXTERN(void) git_commit_set_tree(git_commit *commit, git_tree *tree);
184+
GIT_EXTERN(int) git_commit_set_tree(git_commit *commit, git_tree *tree);
181185

182186
/** @} */
183187
GIT_END_DECL

vendor/libgit2/include/git2/common.h

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

2828
#include "thread-utils.h"
2929
#include <time.h>
30+
#include <stdlib.h>
3031

3132
#ifdef __cplusplus
3233
# define GIT_BEGIN_DECL extern "C" {
@@ -158,6 +159,21 @@
158159
#define GIT_EINVALIDREFSTATE (GIT_ERROR - 21)
159160

160161
GIT_BEGIN_DECL
162+
163+
typedef struct {
164+
char **strings;
165+
size_t count;
166+
} git_strarray;
167+
168+
GIT_INLINE(void) git_strarray_free(git_strarray *array)
169+
{
170+
size_t i;
171+
for (i = 0; i < array->count; ++i)
172+
free(array->strings[i]);
173+
174+
free(array->strings);
175+
}
176+
161177
/** @} */
162178
GIT_END_DECL
163179
#endif

vendor/libgit2/include/git2/object.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ GIT_EXTERN(git_repository *) git_object_owner(const git_object *obj);
131131
* Close an open object
132132
*
133133
* This method instructs the library to close an existing
134-
* object; note that git_objects are owned by the repository
135-
* and are reference counted, so the object may or may not be
136-
* freed after this library call, depending on whether any other
137-
* objects still depend on it.
134+
* object; note that git_objects are owned and cached by the repository
135+
* so the object may or may not be freed after this library call,
136+
* depending on how agressive is the caching mechanism used
137+
* by the repository.
138138
*
139139
* IMPORTANT:
140140
* It is *not* necessary to call this method when you stop using

vendor/libgit2/include/git2/oid.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,60 @@ GIT_EXTERN(void) git_oid_cpy(git_oid *out, const git_oid *src);
132132
*/
133133
GIT_EXTERN(int) git_oid_cmp(const git_oid *a, const git_oid *b);
134134

135+
/**
136+
* OID Shortener object
137+
*/
138+
typedef struct git_oid_shorten git_oid_shorten;
139+
140+
/**
141+
* Create a new OID shortener.
142+
*
143+
* The OID shortener is used to process a list of OIDs
144+
* in text form and return the shortest length that would
145+
* uniquely identify all of them.
146+
*
147+
* E.g. look at the result of `git log --abbrev`.
148+
*
149+
* @param min_length The minimal length for all identifiers,
150+
* which will be used even if shorter OIDs would still
151+
* be unique.
152+
* @return a `git_oid_shorten` instance, NULL if OOM
153+
*/
154+
git_oid_shorten *git_oid_shorten_new(size_t min_length);
155+
156+
/**
157+
* Add a new OID to set of shortened OIDs and calculate
158+
* the minimal length to uniquely identify all the OIDs in
159+
* the set.
160+
*
161+
* The OID is expected to be a 40-char hexadecimal string.
162+
* The OID is owned by the user and will not be modified
163+
* or freed.
164+
*
165+
* For performance reasons, there is a hard-limit of how many
166+
* OIDs can be added to a single set (around ~22000, assuming
167+
* a mostly randomized distribution), which should be enough
168+
* for any kind of program, and keeps the algorithm fast and
169+
* memory-efficient.
170+
*
171+
* Attempting to add more than those OIDs will result in a
172+
* GIT_ENOMEM error
173+
*
174+
* @param os a `git_oid_shorten` instance
175+
* @param text_oid an OID in text form
176+
* @return the minimal length to uniquely identify all OIDs
177+
* added so far to the set; or an error code (<0) if an
178+
* error occurs.
179+
*/
180+
int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid);
181+
182+
/**
183+
* Free an OID shortener instance
184+
*
185+
* @param os a `git_oid_shorten` instance
186+
*/
187+
void git_oid_shorten_free(git_oid_shorten *os);
188+
135189
/** @} */
136190
GIT_END_DECL
137191
#endif

vendor/libgit2/include/git2/refs.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,29 @@ GIT_EXTERN(int) git_reference_delete(git_reference *ref);
218218
*/
219219
GIT_EXTERN(int) git_reference_packall(git_repository *repo);
220220

221+
/**
222+
* Fill a list with all the references that can be found
223+
* in a repository.
224+
*
225+
* The listed references may be filtered by type, or using
226+
* a bitwise OR of several types. Use the magic value
227+
* `GIT_REF_LISTALL` to obtain all references, including
228+
* packed ones.
229+
*
230+
* The string array will be filled with the names of all
231+
* references; these values are owned by the user and
232+
* should be free'd manually when no longer needed, using
233+
* `git_strarray_free`.
234+
*
235+
* @param array Pointer to a git_strarray structure where
236+
* the reference names will be stored
237+
* @param repo Repository where to find the refs
238+
* @param list_flags Filtering flags for the reference
239+
* listing.
240+
* @return 0 on success; error code otherwise
241+
*/
242+
GIT_EXTERN(int) git_reference_listall(git_strarray *array, git_repository *repo, unsigned int list_flags);
243+
221244
/** @} */
222245
GIT_END_DECL
223246
#endif

0 commit comments

Comments
 (0)