rugged 0.21.1b2 → 0.21.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -12
- data/ext/rugged/extconf.rb +8 -8
- data/ext/rugged/rugged.h +1 -1
- data/ext/rugged/rugged_blob.c +0 -57
- data/ext/rugged/rugged_cred.c +0 -23
- data/ext/rugged/rugged_index.c +2 -6
- data/ext/rugged/rugged_remote.c +1 -69
- data/ext/rugged/rugged_repo.c +5 -287
- data/ext/rugged/rugged_tag_collection.c +2 -70
- data/ext/rugged/rugged_tree.c +10 -29
- data/lib/rugged.rb +0 -2
- data/lib/rugged/diff.rb +1 -0
- data/lib/rugged/diff/line.rb +3 -1
- data/lib/rugged/patch.rb +2 -12
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +0 -11
- data/vendor/libgit2/deps/http-parser/http_parser.h +0 -2
- data/vendor/libgit2/deps/zlib/adler32.c +29 -39
- data/vendor/libgit2/deps/zlib/crc32.c +50 -33
- data/vendor/libgit2/deps/zlib/crc32.h +1 -1
- data/vendor/libgit2/deps/zlib/deflate.c +65 -198
- data/vendor/libgit2/deps/zlib/deflate.h +4 -8
- data/vendor/libgit2/deps/zlib/inffast.c +3 -3
- data/vendor/libgit2/deps/zlib/inffixed.h +3 -3
- data/vendor/libgit2/deps/zlib/inflate.c +52 -84
- data/vendor/libgit2/deps/zlib/inftrees.c +39 -15
- data/vendor/libgit2/deps/zlib/trees.c +36 -18
- data/vendor/libgit2/deps/zlib/zconf.h +0 -4
- data/vendor/libgit2/deps/zlib/zlib.h +95 -250
- data/vendor/libgit2/deps/zlib/zutil.c +10 -13
- data/vendor/libgit2/deps/zlib/zutil.h +62 -41
- data/vendor/libgit2/include/git2/attr.h +13 -16
- data/vendor/libgit2/include/git2/buffer.h +0 -16
- data/vendor/libgit2/include/git2/checkout.h +12 -12
- data/vendor/libgit2/include/git2/cherrypick.h +15 -15
- data/vendor/libgit2/include/git2/clone.h +69 -77
- data/vendor/libgit2/include/git2/diff.h +0 -7
- data/vendor/libgit2/include/git2/errors.h +0 -2
- data/vendor/libgit2/include/git2/merge.h +0 -16
- data/vendor/libgit2/include/git2/oid.h +4 -8
- data/vendor/libgit2/include/git2/remote.h +32 -13
- data/vendor/libgit2/include/git2/repository.h +1 -4
- data/vendor/libgit2/include/git2/reset.h +0 -4
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/status.h +14 -17
- data/vendor/libgit2/include/git2/submodule.h +0 -18
- data/vendor/libgit2/include/git2/sys/repository.h +0 -13
- data/vendor/libgit2/include/git2/transport.h +313 -79
- data/vendor/libgit2/include/git2/tree.h +2 -4
- data/vendor/libgit2/include/git2/types.h +6 -54
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/attr.c +4 -8
- data/vendor/libgit2/src/attr_file.c +1 -14
- data/vendor/libgit2/src/blame.c +1 -0
- data/vendor/libgit2/src/buf_text.c +5 -9
- data/vendor/libgit2/src/buf_text.h +2 -3
- data/vendor/libgit2/src/buffer.c +10 -67
- data/vendor/libgit2/src/buffer.h +2 -4
- data/vendor/libgit2/src/cache.c +9 -9
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/checkout.c +44 -121
- data/vendor/libgit2/src/cherrypick.c +44 -41
- data/vendor/libgit2/src/clone.c +56 -94
- data/vendor/libgit2/src/config_file.c +7 -2
- data/vendor/libgit2/src/crlf.c +1 -2
- data/vendor/libgit2/src/diff.c +0 -21
- data/vendor/libgit2/src/diff_file.c +0 -1
- data/vendor/libgit2/src/diff_print.c +9 -11
- data/vendor/libgit2/src/diff_tform.c +2 -4
- data/vendor/libgit2/src/errors.c +7 -9
- data/vendor/libgit2/src/filebuf.c +2 -0
- data/vendor/libgit2/src/fileops.c +7 -9
- data/vendor/libgit2/src/filter.c +11 -2
- data/vendor/libgit2/src/global.c +20 -3
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/graph.c +2 -2
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/{include/git2/sys → src}/hashsig.h +7 -11
- data/vendor/libgit2/src/ignore.c +2 -2
- data/vendor/libgit2/src/indexer.c +1 -13
- data/vendor/libgit2/src/merge.c +145 -99
- data/vendor/libgit2/src/merge.h +1 -1
- data/vendor/libgit2/src/mwindow.c +8 -117
- data/vendor/libgit2/src/mwindow.h +1 -9
- data/vendor/libgit2/src/netops.c +7 -6
- data/vendor/libgit2/src/netops.h +4 -0
- data/vendor/libgit2/src/odb_loose.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +3 -6
- data/vendor/libgit2/src/oid.c +0 -8
- data/vendor/libgit2/src/oid.h +0 -11
- data/vendor/libgit2/src/pack.c +6 -20
- data/vendor/libgit2/src/pack.h +0 -3
- data/vendor/libgit2/src/path.c +64 -134
- data/vendor/libgit2/src/path.h +1 -22
- data/vendor/libgit2/src/posix.h +28 -46
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +2 -14
- data/vendor/libgit2/src/remote.c +26 -29
- data/vendor/libgit2/src/remote.h +1 -3
- data/vendor/libgit2/src/repository.c +14 -54
- data/vendor/libgit2/src/revert.c +6 -4
- data/vendor/libgit2/src/revparse.c +18 -15
- data/vendor/libgit2/src/signature.c +2 -2
- data/vendor/libgit2/src/stash.c +1 -2
- data/vendor/libgit2/src/status.c +2 -11
- data/vendor/libgit2/src/strnlen.h +1 -2
- data/vendor/libgit2/src/submodule.c +33 -73
- data/vendor/libgit2/src/tag.c +3 -2
- data/vendor/libgit2/src/thread-utils.h +7 -0
- data/vendor/libgit2/src/trace.h +1 -9
- data/vendor/libgit2/src/transport.c +90 -93
- data/vendor/libgit2/src/transports/cred.c +0 -58
- data/vendor/libgit2/src/transports/cred_helpers.c +0 -3
- data/vendor/libgit2/src/transports/git.c +0 -1
- data/vendor/libgit2/src/transports/http.c +82 -205
- data/vendor/libgit2/src/transports/smart.c +0 -2
- data/vendor/libgit2/src/transports/smart.h +0 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +5 -7
- data/vendor/libgit2/src/transports/ssh.c +35 -224
- data/vendor/libgit2/src/transports/winhttp.c +34 -140
- data/vendor/libgit2/src/tree.c +60 -64
- data/vendor/libgit2/src/tree.h +3 -2
- data/vendor/libgit2/src/unix/posix.h +9 -23
- data/vendor/libgit2/src/unix/realpath.c +7 -8
- data/vendor/libgit2/src/util.c +1 -2
- data/vendor/libgit2/src/util.h +3 -3
- data/vendor/libgit2/src/win32/mingw-compat.h +12 -5
- data/vendor/libgit2/src/win32/msvc-compat.h +32 -3
- data/vendor/libgit2/src/win32/posix.h +31 -20
- data/vendor/libgit2/src/win32/posix_w32.c +18 -62
- metadata +5 -18
- data/lib/rugged/attributes.rb +0 -41
- data/lib/rugged/blob.rb +0 -28
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +0 -324
- data/vendor/libgit2/deps/zlib/infback.c +0 -640
- data/vendor/libgit2/include/git2/oidarray.h +0 -40
- data/vendor/libgit2/include/git2/sys/transport.h +0 -352
- data/vendor/libgit2/src/oidarray.c +0 -21
- data/vendor/libgit2/src/oidarray.h +0 -18
- data/vendor/libgit2/src/transports/auth.c +0 -71
- data/vendor/libgit2/src/transports/auth.h +0 -63
- data/vendor/libgit2/src/transports/auth_negotiate.c +0 -275
- data/vendor/libgit2/src/transports/auth_negotiate.h +0 -27
- data/vendor/libgit2/src/transports/cred.h +0 -14
@@ -152,12 +152,6 @@ typedef enum {
|
|
152
152
|
*/
|
153
153
|
GIT_DIFF_UPDATE_INDEX = (1u << 15),
|
154
154
|
|
155
|
-
/** Include unreadable files in the diff */
|
156
|
-
GIT_DIFF_INCLUDE_UNREADABLE = (1u << 16),
|
157
|
-
|
158
|
-
/** Include unreadable files in the diff */
|
159
|
-
GIT_DIFF_INCLUDE_UNREADABLE_AS_UNTRACKED = (1u << 17),
|
160
|
-
|
161
155
|
/*
|
162
156
|
* Options controlling how output will be generated
|
163
157
|
*/
|
@@ -243,7 +237,6 @@ typedef enum {
|
|
243
237
|
GIT_DELTA_IGNORED = 6, /**< entry is ignored item in workdir */
|
244
238
|
GIT_DELTA_UNTRACKED = 7, /**< entry is untracked item in workdir */
|
245
239
|
GIT_DELTA_TYPECHANGE = 8, /**< type of entry changed between old and new */
|
246
|
-
GIT_DELTA_UNREADABLE = 9, /**< entry is unreadable */
|
247
240
|
} git_delta_t;
|
248
241
|
|
249
242
|
/**
|
@@ -41,8 +41,6 @@ typedef enum {
|
|
41
41
|
GIT_EMERGECONFLICT = -13, /**< Merge conflicts prevented operation */
|
42
42
|
GIT_ELOCKED = -14, /**< Lock file prevented operation */
|
43
43
|
GIT_EMODIFIED = -15, /**< Reference value does not match expected */
|
44
|
-
GIT_EAUTH = -16, /**< Authentication error */
|
45
|
-
GIT_ECERTIFICATE = -17, /**< Server certificate is invalid */
|
46
44
|
|
47
45
|
GIT_PASSTHROUGH = -30, /**< Internal only */
|
48
46
|
GIT_ITEROVER = -31, /**< Signals end of iteration with iterator */
|
@@ -10,7 +10,6 @@
|
|
10
10
|
#include "common.h"
|
11
11
|
#include "types.h"
|
12
12
|
#include "oid.h"
|
13
|
-
#include "oidarray.h"
|
14
13
|
#include "checkout.h"
|
15
14
|
#include "index.h"
|
16
15
|
|
@@ -321,21 +320,6 @@ GIT_EXTERN(int) git_merge_base(
|
|
321
320
|
const git_oid *one,
|
322
321
|
const git_oid *two);
|
323
322
|
|
324
|
-
/**
|
325
|
-
* Find merge bases between two commits
|
326
|
-
*
|
327
|
-
* @param out array in which to store the resulting ids
|
328
|
-
* @param repo the repository where the commits exist
|
329
|
-
* @param one one of the commits
|
330
|
-
* @param two the other commit
|
331
|
-
* @return 0 on success, GIT_ENOTFOUND if not found or error code
|
332
|
-
*/
|
333
|
-
GIT_EXTERN(int) git_merge_bases(
|
334
|
-
git_oidarray *out,
|
335
|
-
git_repository *repo,
|
336
|
-
const git_oid *one,
|
337
|
-
const git_oid *two);
|
338
|
-
|
339
323
|
/**
|
340
324
|
* Find a merge base given a list of commits
|
341
325
|
*
|
@@ -116,17 +116,13 @@ GIT_EXTERN(void) git_oid_nfmt(char *out, size_t n, const git_oid *id);
|
|
116
116
|
GIT_EXTERN(void) git_oid_pathfmt(char *out, const git_oid *id);
|
117
117
|
|
118
118
|
/**
|
119
|
-
* Format a git_oid into a
|
120
|
-
*
|
121
|
-
* The c-string is owned by the library and should not be freed
|
122
|
-
* by the user. If libgit2 is built with thread support, the string
|
123
|
-
* will be stored in TLS (i.e. one buffer per thread) to allow for
|
124
|
-
* concurrent calls of the function.
|
119
|
+
* Format a git_oid into a newly allocated c-string.
|
125
120
|
*
|
126
121
|
* @param id the oid structure to format
|
127
|
-
* @return the c-string
|
122
|
+
* @return the c-string; NULL if memory is exhausted. Caller must
|
123
|
+
* deallocate the string with git__free().
|
128
124
|
*/
|
129
|
-
GIT_EXTERN(char *)
|
125
|
+
GIT_EXTERN(char *) git_oid_allocfmt(const git_oid *id);
|
130
126
|
|
131
127
|
/**
|
132
128
|
* Format a git_oid into a buffer as a hex format c-string.
|
@@ -384,12 +384,15 @@ GIT_EXTERN(int) git_remote_fetch(
|
|
384
384
|
const char *reflog_message);
|
385
385
|
|
386
386
|
/**
|
387
|
+
* Return whether a string is a valid remote URL
|
387
388
|
*
|
388
|
-
*
|
389
|
-
*
|
390
|
-
|
391
|
-
|
392
|
-
|
389
|
+
* @param url the url to check
|
390
|
+
* @return 1 if the url is valid, 0 otherwise
|
391
|
+
*/
|
392
|
+
GIT_EXTERN(int) git_remote_valid_url(const char *url);
|
393
|
+
|
394
|
+
/**
|
395
|
+
* Return whether the passed URL is supported by this version of the library.
|
393
396
|
*
|
394
397
|
* @param url the url to check
|
395
398
|
* @return 1 if the url is supported, 0 otherwise
|
@@ -407,6 +410,30 @@ GIT_EXTERN(int) git_remote_supported_url(const char* url);
|
|
407
410
|
*/
|
408
411
|
GIT_EXTERN(int) git_remote_list(git_strarray *out, git_repository *repo);
|
409
412
|
|
413
|
+
/**
|
414
|
+
* Choose whether to check the server's certificate (applies to HTTPS only)
|
415
|
+
*
|
416
|
+
* @param remote the remote to configure
|
417
|
+
* @param check whether to check the server's certificate (defaults to yes)
|
418
|
+
*/
|
419
|
+
GIT_EXTERN(void) git_remote_check_cert(git_remote *remote, int check);
|
420
|
+
|
421
|
+
/**
|
422
|
+
* Sets a custom transport for the remote. The caller can use this function
|
423
|
+
* to bypass the automatic discovery of a transport by URL scheme (i.e.
|
424
|
+
* http://, https://, git://) and supply their own transport to be used
|
425
|
+
* instead. After providing the transport to a remote using this function,
|
426
|
+
* the transport object belongs exclusively to that remote, and the remote will
|
427
|
+
* free it when it is freed with git_remote_free.
|
428
|
+
*
|
429
|
+
* @param remote the remote to configure
|
430
|
+
* @param transport the transport object for the remote to use
|
431
|
+
* @return 0 or an error code
|
432
|
+
*/
|
433
|
+
GIT_EXTERN(int) git_remote_set_transport(
|
434
|
+
git_remote *remote,
|
435
|
+
git_transport *transport);
|
436
|
+
|
410
437
|
/**
|
411
438
|
* Argument to the completion callback which tells it which operation
|
412
439
|
* finished.
|
@@ -447,14 +474,6 @@ struct git_remote_callbacks {
|
|
447
474
|
*/
|
448
475
|
git_cred_acquire_cb credentials;
|
449
476
|
|
450
|
-
/**
|
451
|
-
* If cert verification fails, this will be called to let the
|
452
|
-
* user make the final decision of whether to allow the
|
453
|
-
* connection to proceed. Returns 1 to allow the connection, 0
|
454
|
-
* to disallow it or a negative value to indicate an error.
|
455
|
-
*/
|
456
|
-
git_transport_certificate_check_cb certificate_check;
|
457
|
-
|
458
477
|
/**
|
459
478
|
* During the download of new data, this will be regularly
|
460
479
|
* called with the current count of progress done by the
|
@@ -196,8 +196,6 @@ GIT_EXTERN(int) git_repository_init(
|
|
196
196
|
* looking the "template_path" from the options if set, or the
|
197
197
|
* `init.templatedir` global config if not, or falling back on
|
198
198
|
* "/usr/share/git-core/templates" if it exists.
|
199
|
-
* * GIT_REPOSITORY_INIT_RELATIVE_GITLINK - If an alternate workdir is
|
200
|
-
* specified, use relative paths for the gitdir and core.worktree.
|
201
199
|
*/
|
202
200
|
typedef enum {
|
203
201
|
GIT_REPOSITORY_INIT_BARE = (1u << 0),
|
@@ -206,7 +204,6 @@ typedef enum {
|
|
206
204
|
GIT_REPOSITORY_INIT_MKDIR = (1u << 3),
|
207
205
|
GIT_REPOSITORY_INIT_MKPATH = (1u << 4),
|
208
206
|
GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE = (1u << 5),
|
209
|
-
GIT_REPOSITORY_INIT_RELATIVE_GITLINK = (1u << 6),
|
210
207
|
} git_repository_init_flag_t;
|
211
208
|
|
212
209
|
/**
|
@@ -665,7 +662,7 @@ typedef enum {
|
|
665
662
|
GIT_REPOSITORY_STATE_NONE,
|
666
663
|
GIT_REPOSITORY_STATE_MERGE,
|
667
664
|
GIT_REPOSITORY_STATE_REVERT,
|
668
|
-
|
665
|
+
GIT_REPOSITORY_STATE_CHERRY_PICK,
|
669
666
|
GIT_REPOSITORY_STATE_BISECT,
|
670
667
|
GIT_REPOSITORY_STATE_REBASE,
|
671
668
|
GIT_REPOSITORY_STATE_REBASE_INTERACTIVE,
|
@@ -59,7 +59,7 @@ GIT_EXTERN(int) git_revert_init_options(
|
|
59
59
|
* @param merge_options the merge options (or null for defaults)
|
60
60
|
* @return zero on success, -1 on failure.
|
61
61
|
*/
|
62
|
-
|
62
|
+
int git_revert_commit(
|
63
63
|
git_index **out,
|
64
64
|
git_repository *repo,
|
65
65
|
git_commit *revert_commit,
|
@@ -43,7 +43,6 @@ typedef enum {
|
|
43
43
|
GIT_STATUS_WT_DELETED = (1u << 9),
|
44
44
|
GIT_STATUS_WT_TYPECHANGE = (1u << 10),
|
45
45
|
GIT_STATUS_WT_RENAMED = (1u << 11),
|
46
|
-
GIT_STATUS_WT_UNREADABLE = (1u << 12),
|
47
46
|
|
48
47
|
GIT_STATUS_IGNORED = (1u << 14),
|
49
48
|
} git_status_t;
|
@@ -134,22 +133,20 @@ typedef enum {
|
|
134
133
|
* together as `GIT_STATUS_OPT_DEFAULTS` if you want them as a baseline.
|
135
134
|
*/
|
136
135
|
typedef enum {
|
137
|
-
GIT_STATUS_OPT_INCLUDE_UNTRACKED
|
138
|
-
GIT_STATUS_OPT_INCLUDE_IGNORED
|
139
|
-
GIT_STATUS_OPT_INCLUDE_UNMODIFIED
|
140
|
-
GIT_STATUS_OPT_EXCLUDE_SUBMODULES
|
141
|
-
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS
|
142
|
-
GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH
|
143
|
-
GIT_STATUS_OPT_RECURSE_IGNORED_DIRS
|
144
|
-
GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX
|
145
|
-
GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR
|
146
|
-
GIT_STATUS_OPT_SORT_CASE_SENSITIVELY
|
147
|
-
GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY
|
148
|
-
GIT_STATUS_OPT_RENAMES_FROM_REWRITES
|
149
|
-
GIT_STATUS_OPT_NO_REFRESH
|
150
|
-
GIT_STATUS_OPT_UPDATE_INDEX
|
151
|
-
GIT_STATUS_OPT_INCLUDE_UNREADABLE = (1u << 14),
|
152
|
-
GIT_STATUS_OPT_INCLUDE_UNREADABLE_AS_UNTRACKED = (1u << 15),
|
136
|
+
GIT_STATUS_OPT_INCLUDE_UNTRACKED = (1u << 0),
|
137
|
+
GIT_STATUS_OPT_INCLUDE_IGNORED = (1u << 1),
|
138
|
+
GIT_STATUS_OPT_INCLUDE_UNMODIFIED = (1u << 2),
|
139
|
+
GIT_STATUS_OPT_EXCLUDE_SUBMODULES = (1u << 3),
|
140
|
+
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = (1u << 4),
|
141
|
+
GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH = (1u << 5),
|
142
|
+
GIT_STATUS_OPT_RECURSE_IGNORED_DIRS = (1u << 6),
|
143
|
+
GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX = (1u << 7),
|
144
|
+
GIT_STATUS_OPT_RENAMES_INDEX_TO_WORKDIR = (1u << 8),
|
145
|
+
GIT_STATUS_OPT_SORT_CASE_SENSITIVELY = (1u << 9),
|
146
|
+
GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY = (1u << 10),
|
147
|
+
GIT_STATUS_OPT_RENAMES_FROM_REWRITES = (1u << 11),
|
148
|
+
GIT_STATUS_OPT_NO_REFRESH = (1u << 12),
|
149
|
+
GIT_STATUS_OPT_UPDATE_INDEX = (1u << 13),
|
153
150
|
} git_status_opt_t;
|
154
151
|
|
155
152
|
#define GIT_STATUS_OPT_DEFAULTS \
|
@@ -470,24 +470,6 @@ GIT_EXTERN(git_submodule_recurse_t) git_submodule_set_fetch_recurse_submodules(
|
|
470
470
|
*/
|
471
471
|
GIT_EXTERN(int) git_submodule_init(git_submodule *submodule, int overwrite);
|
472
472
|
|
473
|
-
/**
|
474
|
-
* Set up the subrepository for a submodule in preparation for clone.
|
475
|
-
*
|
476
|
-
* This function can be called to init and set up a submodule
|
477
|
-
* repository from a submodule in preparation to clone it from
|
478
|
-
* its remote.
|
479
|
-
*
|
480
|
-
* @param out Output pointer to the created git repository.
|
481
|
-
* @param sm The submodule to create a new subrepository from.
|
482
|
-
* @param use_gitlink Should the workdir contain a gitlink to
|
483
|
-
* the repo in .git/modules vs. repo directly in workdir.
|
484
|
-
* @return 0 on success, <0 on failure.
|
485
|
-
*/
|
486
|
-
GIT_EXTERN(int) git_submodule_repo_init(
|
487
|
-
git_repository **out,
|
488
|
-
const git_submodule *sm,
|
489
|
-
int use_gitlink);
|
490
|
-
|
491
473
|
/**
|
492
474
|
* Copy submodule remote info into submodule repo.
|
493
475
|
*
|
@@ -119,19 +119,6 @@ GIT_EXTERN(void) git_repository_set_refdb(git_repository *repo, git_refdb *refdb
|
|
119
119
|
*/
|
120
120
|
GIT_EXTERN(void) git_repository_set_index(git_repository *repo, git_index *index);
|
121
121
|
|
122
|
-
/**
|
123
|
-
* Set a repository to be bare.
|
124
|
-
*
|
125
|
-
* Clear the working directory and set core.bare to true. You may also
|
126
|
-
* want to call `git_repository_set_index(repo, NULL)` since a bare repo
|
127
|
-
* typically does not have an index, but this function will not do that
|
128
|
-
* for you.
|
129
|
-
*
|
130
|
-
* @param repo Repo to make bare
|
131
|
-
* @return 0 on success, <0 on failure
|
132
|
-
*/
|
133
|
-
GIT_EXTERN(int) git_repository_set_bare(git_repository *repo);
|
134
|
-
|
135
122
|
/** @} */
|
136
123
|
GIT_END_DECL
|
137
124
|
#endif
|
@@ -20,63 +20,6 @@
|
|
20
20
|
*/
|
21
21
|
GIT_BEGIN_DECL
|
22
22
|
|
23
|
-
/**
|
24
|
-
* Type of SSH host fingerprint
|
25
|
-
*/
|
26
|
-
typedef enum {
|
27
|
-
/** MD5 is available */
|
28
|
-
GIT_CERT_SSH_MD5 = (1 << 0),
|
29
|
-
/** SHA-1 is available */
|
30
|
-
GIT_CERT_SSH_SHA1 = (1 << 1),
|
31
|
-
} git_cert_ssh_t;
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Hostkey information taken from libssh2
|
35
|
-
*/
|
36
|
-
typedef struct {
|
37
|
-
/**
|
38
|
-
* Type of certificate. Here to share the header with
|
39
|
-
* `git_cert`.
|
40
|
-
*/
|
41
|
-
git_cert_t cert_type;
|
42
|
-
/**
|
43
|
-
* A hostkey type from libssh2, either
|
44
|
-
* `GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1`
|
45
|
-
*/
|
46
|
-
git_cert_ssh_t type;
|
47
|
-
|
48
|
-
/**
|
49
|
-
* Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will
|
50
|
-
* have the MD5 hash of the hostkey.
|
51
|
-
*/
|
52
|
-
unsigned char hash_md5[16];
|
53
|
-
|
54
|
-
/**
|
55
|
-
* Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will
|
56
|
-
* have the SHA-1 hash of the hostkey.
|
57
|
-
*/
|
58
|
-
unsigned char hash_sha1[20];
|
59
|
-
} git_cert_hostkey;
|
60
|
-
|
61
|
-
/**
|
62
|
-
* X.509 certificate information
|
63
|
-
*/
|
64
|
-
typedef struct {
|
65
|
-
/**
|
66
|
-
* Type of certificate. Here to share the header with
|
67
|
-
* `git_cert`.
|
68
|
-
*/
|
69
|
-
git_cert_t cert_type;
|
70
|
-
/**
|
71
|
-
* Pointer to the X.509 certificate data
|
72
|
-
*/
|
73
|
-
void *data;
|
74
|
-
/**
|
75
|
-
* Length of the memory block pointed to by `data`.
|
76
|
-
*/
|
77
|
-
size_t len;
|
78
|
-
} git_cert_x509;
|
79
|
-
|
80
23
|
/*
|
81
24
|
*** Begin interface for credentials acquisition ***
|
82
25
|
*/
|
@@ -97,14 +40,6 @@ typedef enum {
|
|
97
40
|
|
98
41
|
/* git_cred_ssh_interactive */
|
99
42
|
GIT_CREDTYPE_SSH_INTERACTIVE = (1u << 4),
|
100
|
-
|
101
|
-
/**
|
102
|
-
* Username-only information
|
103
|
-
*
|
104
|
-
* If the SSH transport does not know which username to use,
|
105
|
-
* it will ask via this credential type.
|
106
|
-
*/
|
107
|
-
GIT_CREDTYPE_USERNAME = (1u << 5),
|
108
43
|
} git_credtype_t;
|
109
44
|
|
110
45
|
/* The base structure for all credential types */
|
@@ -172,12 +107,6 @@ typedef struct git_cred_ssh_custom {
|
|
172
107
|
/** A key for NTLM/Kerberos "default" credentials */
|
173
108
|
typedef struct git_cred git_cred_default;
|
174
109
|
|
175
|
-
/** Username-only credential information */
|
176
|
-
typedef struct git_cred_username {
|
177
|
-
git_cred parent;
|
178
|
-
char username[1];
|
179
|
-
} git_cred_username;
|
180
|
-
|
181
110
|
/**
|
182
111
|
* Check whether a credential object contains username information.
|
183
112
|
*
|
@@ -279,14 +208,6 @@ GIT_EXTERN(int) git_cred_ssh_custom_new(
|
|
279
208
|
*/
|
280
209
|
GIT_EXTERN(int) git_cred_default_new(git_cred **out);
|
281
210
|
|
282
|
-
/**
|
283
|
-
* Create a credential to specify a username.
|
284
|
-
*
|
285
|
-
* This is used with ssh authentication to query for the username if
|
286
|
-
* none is specified in the url.
|
287
|
-
*/
|
288
|
-
GIT_EXTERN(int) git_cred_username_new(git_cred **cred, const char *username);
|
289
|
-
|
290
211
|
/**
|
291
212
|
* Signature of a function which acquires a credential object.
|
292
213
|
*
|
@@ -306,6 +227,319 @@ typedef int (*git_cred_acquire_cb)(
|
|
306
227
|
unsigned int allowed_types,
|
307
228
|
void *payload);
|
308
229
|
|
230
|
+
/*
|
231
|
+
*** End interface for credentials acquisition ***
|
232
|
+
*** Begin base transport interface ***
|
233
|
+
*/
|
234
|
+
|
235
|
+
typedef enum {
|
236
|
+
GIT_TRANSPORTFLAGS_NONE = 0,
|
237
|
+
/* If the connection is secured with SSL/TLS, the authenticity
|
238
|
+
* of the server certificate should not be verified. */
|
239
|
+
GIT_TRANSPORTFLAGS_NO_CHECK_CERT = 1
|
240
|
+
} git_transport_flags_t;
|
241
|
+
|
242
|
+
typedef int (*git_transport_message_cb)(const char *str, int len, void *data);
|
243
|
+
|
244
|
+
typedef struct git_transport git_transport;
|
245
|
+
|
246
|
+
struct git_transport {
|
247
|
+
unsigned int version;
|
248
|
+
/* Set progress and error callbacks */
|
249
|
+
int (*set_callbacks)(
|
250
|
+
git_transport *transport,
|
251
|
+
git_transport_message_cb progress_cb,
|
252
|
+
git_transport_message_cb error_cb,
|
253
|
+
void *payload);
|
254
|
+
|
255
|
+
/* Connect the transport to the remote repository, using the given
|
256
|
+
* direction. */
|
257
|
+
int (*connect)(
|
258
|
+
git_transport *transport,
|
259
|
+
const char *url,
|
260
|
+
git_cred_acquire_cb cred_acquire_cb,
|
261
|
+
void *cred_acquire_payload,
|
262
|
+
int direction,
|
263
|
+
int flags);
|
264
|
+
|
265
|
+
/* This function may be called after a successful call to
|
266
|
+
* connect(). The array returned is owned by the transport and
|
267
|
+
* is guranteed until the next call of a transport function. */
|
268
|
+
int (*ls)(
|
269
|
+
const git_remote_head ***out,
|
270
|
+
size_t *size,
|
271
|
+
git_transport *transport);
|
272
|
+
|
273
|
+
/* Executes the push whose context is in the git_push object. */
|
274
|
+
int (*push)(git_transport *transport, git_push *push);
|
275
|
+
|
276
|
+
/* This function may be called after a successful call to connect(), when
|
277
|
+
* the direction is FETCH. The function performs a negotiation to calculate
|
278
|
+
* the wants list for the fetch. */
|
279
|
+
int (*negotiate_fetch)(
|
280
|
+
git_transport *transport,
|
281
|
+
git_repository *repo,
|
282
|
+
const git_remote_head * const *refs,
|
283
|
+
size_t count);
|
284
|
+
|
285
|
+
/* This function may be called after a successful call to negotiate_fetch(),
|
286
|
+
* when the direction is FETCH. This function retrieves the pack file for
|
287
|
+
* the fetch from the remote end. */
|
288
|
+
int (*download_pack)(
|
289
|
+
git_transport *transport,
|
290
|
+
git_repository *repo,
|
291
|
+
git_transfer_progress *stats,
|
292
|
+
git_transfer_progress_cb progress_cb,
|
293
|
+
void *progress_payload);
|
294
|
+
|
295
|
+
/* Checks to see if the transport is connected */
|
296
|
+
int (*is_connected)(git_transport *transport);
|
297
|
+
|
298
|
+
/* Reads the flags value previously passed into connect() */
|
299
|
+
int (*read_flags)(git_transport *transport, int *flags);
|
300
|
+
|
301
|
+
/* Cancels any outstanding transport operation */
|
302
|
+
void (*cancel)(git_transport *transport);
|
303
|
+
|
304
|
+
/* This function is the reverse of connect() -- it terminates the
|
305
|
+
* connection to the remote end. */
|
306
|
+
int (*close)(git_transport *transport);
|
307
|
+
|
308
|
+
/* Frees/destructs the git_transport object. */
|
309
|
+
void (*free)(git_transport *transport);
|
310
|
+
};
|
311
|
+
|
312
|
+
#define GIT_TRANSPORT_VERSION 1
|
313
|
+
#define GIT_TRANSPORT_INIT {GIT_TRANSPORT_VERSION}
|
314
|
+
|
315
|
+
/**
|
316
|
+
* Initializes a `git_transport` with default values. Equivalent to
|
317
|
+
* creating an instance with GIT_TRANSPORT_INIT.
|
318
|
+
*
|
319
|
+
* @param opts the `git_transport` struct to initialize
|
320
|
+
* @param version Version of struct; pass `GIT_TRANSPORT_VERSION`
|
321
|
+
* @return Zero on success; -1 on failure.
|
322
|
+
*/
|
323
|
+
GIT_EXTERN(int) git_transport_init(
|
324
|
+
git_transport *opts,
|
325
|
+
unsigned int version);
|
326
|
+
|
327
|
+
/**
|
328
|
+
* Function to use to create a transport from a URL. The transport database
|
329
|
+
* is scanned to find a transport that implements the scheme of the URI (i.e.
|
330
|
+
* git:// or http://) and a transport object is returned to the caller.
|
331
|
+
*
|
332
|
+
* @param out The newly created transport (out)
|
333
|
+
* @param owner The git_remote which will own this transport
|
334
|
+
* @param url The URL to connect to
|
335
|
+
* @return 0 or an error code
|
336
|
+
*/
|
337
|
+
GIT_EXTERN(int) git_transport_new(git_transport **out, git_remote *owner, const char *url);
|
338
|
+
|
339
|
+
/* Signature of a function which creates a transport */
|
340
|
+
typedef int (*git_transport_cb)(git_transport **out, git_remote *owner, void *param);
|
341
|
+
|
342
|
+
/**
|
343
|
+
* Add a custom transport definition, to be used in addition to the built-in
|
344
|
+
* set of transports that come with libgit2.
|
345
|
+
*
|
346
|
+
* The caller is responsible for synchronizing calls to git_transport_register
|
347
|
+
* and git_transport_unregister with other calls to the library that
|
348
|
+
* instantiate transports.
|
349
|
+
*
|
350
|
+
* @param prefix The scheme (ending in "://") to match, i.e. "git://"
|
351
|
+
* @param priority The priority of this transport relative to others with
|
352
|
+
* the same prefix. Built-in transports have a priority of 1.
|
353
|
+
* @param cb The callback used to create an instance of the transport
|
354
|
+
* @param param A fixed parameter to pass to cb at creation time
|
355
|
+
* @return 0 or an error code
|
356
|
+
*/
|
357
|
+
GIT_EXTERN(int) git_transport_register(
|
358
|
+
const char *prefix,
|
359
|
+
unsigned priority,
|
360
|
+
git_transport_cb cb,
|
361
|
+
void *param);
|
362
|
+
|
363
|
+
/**
|
364
|
+
*
|
365
|
+
* Unregister a custom transport definition which was previously registered
|
366
|
+
* with git_transport_register.
|
367
|
+
*
|
368
|
+
* @param prefix From the previous call to git_transport_register
|
369
|
+
* @param priority From the previous call to git_transport_register
|
370
|
+
* @return 0 or an error code
|
371
|
+
*/
|
372
|
+
GIT_EXTERN(int) git_transport_unregister(
|
373
|
+
const char *prefix,
|
374
|
+
unsigned priority);
|
375
|
+
|
376
|
+
/* Transports which come with libgit2 (match git_transport_cb). The expected
|
377
|
+
* value for "param" is listed in-line below. */
|
378
|
+
|
379
|
+
/**
|
380
|
+
* Create an instance of the dummy transport.
|
381
|
+
*
|
382
|
+
* @param out The newly created transport (out)
|
383
|
+
* @param owner The git_remote which will own this transport
|
384
|
+
* @param payload You must pass NULL for this parameter.
|
385
|
+
* @return 0 or an error code
|
386
|
+
*/
|
387
|
+
GIT_EXTERN(int) git_transport_dummy(
|
388
|
+
git_transport **out,
|
389
|
+
git_remote *owner,
|
390
|
+
/* NULL */ void *payload);
|
391
|
+
|
392
|
+
/**
|
393
|
+
* Create an instance of the local transport.
|
394
|
+
*
|
395
|
+
* @param out The newly created transport (out)
|
396
|
+
* @param owner The git_remote which will own this transport
|
397
|
+
* @param payload You must pass NULL for this parameter.
|
398
|
+
* @return 0 or an error code
|
399
|
+
*/
|
400
|
+
GIT_EXTERN(int) git_transport_local(
|
401
|
+
git_transport **out,
|
402
|
+
git_remote *owner,
|
403
|
+
/* NULL */ void *payload);
|
404
|
+
|
405
|
+
/**
|
406
|
+
* Create an instance of the smart transport.
|
407
|
+
*
|
408
|
+
* @param out The newly created transport (out)
|
409
|
+
* @param owner The git_remote which will own this transport
|
410
|
+
* @param payload A pointer to a git_smart_subtransport_definition
|
411
|
+
* @return 0 or an error code
|
412
|
+
*/
|
413
|
+
GIT_EXTERN(int) git_transport_smart(
|
414
|
+
git_transport **out,
|
415
|
+
git_remote *owner,
|
416
|
+
/* (git_smart_subtransport_definition *) */ void *payload);
|
417
|
+
|
418
|
+
/*
|
419
|
+
*** End of base transport interface ***
|
420
|
+
*** Begin interface for subtransports for the smart transport ***
|
421
|
+
*/
|
422
|
+
|
423
|
+
/* The smart transport knows how to speak the git protocol, but it has no
|
424
|
+
* knowledge of how to establish a connection between it and another endpoint,
|
425
|
+
* or how to move data back and forth. For this, a subtransport interface is
|
426
|
+
* declared, and the smart transport delegates this work to the subtransports.
|
427
|
+
* Three subtransports are implemented: git, http, and winhttp. (The http and
|
428
|
+
* winhttp transports each implement both http and https.) */
|
429
|
+
|
430
|
+
/* Subtransports can either be RPC = 0 (persistent connection) or RPC = 1
|
431
|
+
* (request/response). The smart transport handles the differences in its own
|
432
|
+
* logic. The git subtransport is RPC = 0, while http and winhttp are both
|
433
|
+
* RPC = 1. */
|
434
|
+
|
435
|
+
/* Actions that the smart transport can ask
|
436
|
+
* a subtransport to perform */
|
437
|
+
typedef enum {
|
438
|
+
GIT_SERVICE_UPLOADPACK_LS = 1,
|
439
|
+
GIT_SERVICE_UPLOADPACK = 2,
|
440
|
+
GIT_SERVICE_RECEIVEPACK_LS = 3,
|
441
|
+
GIT_SERVICE_RECEIVEPACK = 4,
|
442
|
+
} git_smart_service_t;
|
443
|
+
|
444
|
+
typedef struct git_smart_subtransport git_smart_subtransport;
|
445
|
+
typedef struct git_smart_subtransport_stream git_smart_subtransport_stream;
|
446
|
+
|
447
|
+
/* A stream used by the smart transport to read and write data
|
448
|
+
* from a subtransport */
|
449
|
+
struct git_smart_subtransport_stream {
|
450
|
+
/* The owning subtransport */
|
451
|
+
git_smart_subtransport *subtransport;
|
452
|
+
|
453
|
+
int (*read)(
|
454
|
+
git_smart_subtransport_stream *stream,
|
455
|
+
char *buffer,
|
456
|
+
size_t buf_size,
|
457
|
+
size_t *bytes_read);
|
458
|
+
|
459
|
+
int (*write)(
|
460
|
+
git_smart_subtransport_stream *stream,
|
461
|
+
const char *buffer,
|
462
|
+
size_t len);
|
463
|
+
|
464
|
+
void (*free)(
|
465
|
+
git_smart_subtransport_stream *stream);
|
466
|
+
};
|
467
|
+
|
468
|
+
/* An implementation of a subtransport which carries data for the
|
469
|
+
* smart transport */
|
470
|
+
struct git_smart_subtransport {
|
471
|
+
int (* action)(
|
472
|
+
git_smart_subtransport_stream **out,
|
473
|
+
git_smart_subtransport *transport,
|
474
|
+
const char *url,
|
475
|
+
git_smart_service_t action);
|
476
|
+
|
477
|
+
/* Subtransports are guaranteed a call to close() between
|
478
|
+
* calls to action(), except for the following two "natural" progressions
|
479
|
+
* of actions against a constant URL.
|
480
|
+
*
|
481
|
+
* 1. UPLOADPACK_LS -> UPLOADPACK
|
482
|
+
* 2. RECEIVEPACK_LS -> RECEIVEPACK */
|
483
|
+
int (*close)(git_smart_subtransport *transport);
|
484
|
+
|
485
|
+
void (*free)(git_smart_subtransport *transport);
|
486
|
+
};
|
487
|
+
|
488
|
+
/* A function which creates a new subtransport for the smart transport */
|
489
|
+
typedef int (*git_smart_subtransport_cb)(
|
490
|
+
git_smart_subtransport **out,
|
491
|
+
git_transport* owner);
|
492
|
+
|
493
|
+
typedef struct git_smart_subtransport_definition {
|
494
|
+
/* The function to use to create the git_smart_subtransport */
|
495
|
+
git_smart_subtransport_cb callback;
|
496
|
+
|
497
|
+
/* True if the protocol is stateless; false otherwise. For example,
|
498
|
+
* http:// is stateless, but git:// is not. */
|
499
|
+
unsigned rpc;
|
500
|
+
} git_smart_subtransport_definition;
|
501
|
+
|
502
|
+
/* Smart transport subtransports that come with libgit2 */
|
503
|
+
|
504
|
+
/**
|
505
|
+
* Create an instance of the http subtransport. This subtransport
|
506
|
+
* also supports https. On Win32, this subtransport may be implemented
|
507
|
+
* using the WinHTTP library.
|
508
|
+
*
|
509
|
+
* @param out The newly created subtransport
|
510
|
+
* @param owner The smart transport to own this subtransport
|
511
|
+
* @return 0 or an error code
|
512
|
+
*/
|
513
|
+
GIT_EXTERN(int) git_smart_subtransport_http(
|
514
|
+
git_smart_subtransport **out,
|
515
|
+
git_transport* owner);
|
516
|
+
|
517
|
+
/**
|
518
|
+
* Create an instance of the git subtransport.
|
519
|
+
*
|
520
|
+
* @param out The newly created subtransport
|
521
|
+
* @param owner The smart transport to own this subtransport
|
522
|
+
* @return 0 or an error code
|
523
|
+
*/
|
524
|
+
GIT_EXTERN(int) git_smart_subtransport_git(
|
525
|
+
git_smart_subtransport **out,
|
526
|
+
git_transport* owner);
|
527
|
+
|
528
|
+
/**
|
529
|
+
* Create an instance of the ssh subtransport.
|
530
|
+
*
|
531
|
+
* @param out The newly created subtransport
|
532
|
+
* @param owner The smart transport to own this subtransport
|
533
|
+
* @return 0 or an error code
|
534
|
+
*/
|
535
|
+
GIT_EXTERN(int) git_smart_subtransport_ssh(
|
536
|
+
git_smart_subtransport **out,
|
537
|
+
git_transport* owner);
|
538
|
+
|
539
|
+
/*
|
540
|
+
*** End interface for subtransports for the smart transport ***
|
541
|
+
*/
|
542
|
+
|
309
543
|
/** @} */
|
310
544
|
GIT_END_DECL
|
311
545
|
#endif
|