rugged 0.25.0b2 → 0.25.0b3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/ext/rugged/extconf.rb +3 -1
- data/ext/rugged/rugged.c +1 -1
- data/ext/rugged/rugged.h +1 -1
- data/ext/rugged/rugged_blob.c +29 -38
- data/ext/rugged/rugged_commit.c +215 -78
- data/ext/rugged/rugged_rebase.c +18 -11
- data/ext/rugged/rugged_remote.c +2 -2
- data/ext/rugged/rugged_tree.c +132 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +11 -3
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/include/git2/blob.h +39 -28
- data/vendor/libgit2/include/git2/commit.h +30 -0
- data/vendor/libgit2/include/git2/common.h +16 -1
- data/vendor/libgit2/include/git2/merge.h +10 -1
- data/vendor/libgit2/include/git2/proxy.h +92 -0
- data/vendor/libgit2/include/git2/refs.h +11 -0
- data/vendor/libgit2/include/git2/remote.h +17 -4
- data/vendor/libgit2/include/git2/signature.h +13 -0
- data/vendor/libgit2/include/git2/sys/merge.h +177 -0
- data/vendor/libgit2/include/git2/sys/remote.h +16 -0
- data/vendor/libgit2/include/git2/sys/stream.h +2 -1
- data/vendor/libgit2/include/git2/sys/transport.h +3 -1
- data/vendor/libgit2/include/git2/tag.h +9 -0
- data/vendor/libgit2/include/git2/tree.h +55 -0
- data/vendor/libgit2/src/annotated_commit.c +99 -80
- data/vendor/libgit2/src/annotated_commit.h +5 -2
- data/vendor/libgit2/src/array.h +40 -0
- data/vendor/libgit2/src/blame.c +8 -3
- data/vendor/libgit2/src/blame_git.c +2 -1
- data/vendor/libgit2/src/blob.c +71 -39
- data/vendor/libgit2/src/branch.c +2 -1
- data/vendor/libgit2/src/checkout.c +66 -42
- data/vendor/libgit2/src/commit.c +67 -3
- data/vendor/libgit2/src/config_cache.c +2 -1
- data/vendor/libgit2/src/config_file.c +32 -27
- data/vendor/libgit2/src/curl_stream.c +89 -6
- data/vendor/libgit2/src/delta-apply.c +36 -5
- data/vendor/libgit2/src/delta-apply.h +12 -0
- data/vendor/libgit2/src/describe.c +3 -2
- data/vendor/libgit2/src/diff.c +13 -20
- data/vendor/libgit2/src/diff_tform.c +5 -3
- data/vendor/libgit2/src/filebuf.c +12 -2
- data/vendor/libgit2/src/filebuf.h +1 -0
- data/vendor/libgit2/src/fnmatch.c +18 -5
- data/vendor/libgit2/src/global.c +18 -0
- data/vendor/libgit2/src/global.h +1 -0
- data/vendor/libgit2/src/ignore.c +11 -3
- data/vendor/libgit2/src/index.c +11 -5
- data/vendor/libgit2/src/indexer.c +11 -7
- data/vendor/libgit2/src/iterator.c +1575 -1468
- data/vendor/libgit2/src/iterator.h +52 -69
- data/vendor/libgit2/src/merge.c +160 -63
- data/vendor/libgit2/src/merge.h +61 -2
- data/vendor/libgit2/src/merge_driver.c +397 -0
- data/vendor/libgit2/src/merge_driver.h +60 -0
- data/vendor/libgit2/src/merge_file.c +11 -49
- data/vendor/libgit2/src/netops.c +12 -10
- data/vendor/libgit2/src/object.c +3 -6
- data/vendor/libgit2/src/object_api.c +19 -1
- data/vendor/libgit2/src/odb_loose.c +1 -1
- data/vendor/libgit2/src/openssl_stream.c +16 -3
- data/vendor/libgit2/src/pack-objects.c +3 -1
- data/vendor/libgit2/src/pack.c +5 -9
- data/vendor/libgit2/src/path.c +14 -0
- data/vendor/libgit2/src/path.h +12 -0
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/posix.c +7 -0
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/proxy.c +32 -0
- data/vendor/libgit2/src/proxy.h +14 -0
- data/vendor/libgit2/src/push.c +7 -7
- data/vendor/libgit2/src/rebase.c +61 -31
- data/vendor/libgit2/src/refdb_fs.c +1 -0
- data/vendor/libgit2/src/refs.c +16 -1
- data/vendor/libgit2/src/remote.c +20 -6
- data/vendor/libgit2/src/repository.c +1 -1
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/settings.c +23 -1
- data/vendor/libgit2/src/signature.c +26 -1
- data/vendor/libgit2/src/stransport_stream.c +5 -2
- data/vendor/libgit2/src/stream.h +2 -2
- data/vendor/libgit2/src/submodule.c +3 -2
- data/vendor/libgit2/src/tag.c +8 -2
- data/vendor/libgit2/src/transports/http.c +32 -9
- data/vendor/libgit2/src/transports/local.c +4 -1
- data/vendor/libgit2/src/transports/smart.c +6 -0
- data/vendor/libgit2/src/transports/smart.h +1 -0
- data/vendor/libgit2/src/transports/smart_protocol.c +61 -17
- data/vendor/libgit2/src/transports/winhttp.c +130 -11
- data/vendor/libgit2/src/tree.c +329 -98
- data/vendor/libgit2/src/tree.h +4 -5
- data/vendor/libgit2/src/unix/map.c +5 -0
- data/vendor/libgit2/src/win32/map.c +24 -5
- data/vendor/libgit2/src/xdiff/xprepare.c +2 -1
- metadata +10 -4
- data/vendor/libgit2/Makefile.embed +0 -60
@@ -24,10 +24,19 @@
|
|
24
24
|
GIT_BEGIN_DECL
|
25
25
|
# include "inttypes.h"
|
26
26
|
GIT_END_DECL
|
27
|
-
|
27
|
+
/** This check is needed for importing this file in an iOS/OS X framework throws an error in Xcode otherwise.*/
|
28
|
+
#elif !defined(__CLANG_INTTYPES_H)
|
28
29
|
# include <inttypes.h>
|
29
30
|
#endif
|
30
31
|
|
32
|
+
#ifdef DOCURIUM
|
33
|
+
/*
|
34
|
+
* This is so clang's doc parser acknowledges comments on functions
|
35
|
+
* with size_t parameters.
|
36
|
+
*/
|
37
|
+
typedef size_t size_t;
|
38
|
+
#endif
|
39
|
+
|
31
40
|
/** Declare a public function exported for application use. */
|
32
41
|
#if __GNUC__ >= 4
|
33
42
|
# define GIT_EXTERN(type) extern \
|
@@ -148,6 +157,7 @@ typedef enum {
|
|
148
157
|
GIT_OPT_SET_SSL_CERT_LOCATIONS,
|
149
158
|
GIT_OPT_SET_USER_AGENT,
|
150
159
|
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION,
|
160
|
+
GIT_OPT_SET_SSL_CIPHERS,
|
151
161
|
} git_libgit2_opt_t;
|
152
162
|
|
153
163
|
/**
|
@@ -259,6 +269,11 @@ typedef enum {
|
|
259
269
|
* > example, when this is enabled, the parent(s) and tree inputs
|
260
270
|
* > will be validated when creating a new commit. This defaults
|
261
271
|
* > to disabled.
|
272
|
+
* * opts(GIT_OPT_SET_SSL_CIPHERS, const char *ciphers)
|
273
|
+
*
|
274
|
+
* > Set the SSL ciphers use for HTTPS connections.
|
275
|
+
* >
|
276
|
+
* > - `ciphers` is the list of ciphers that are eanbled.
|
262
277
|
*
|
263
278
|
* @param option Option key
|
264
279
|
* @param ... value to set the option
|
@@ -273,7 +273,16 @@ typedef struct {
|
|
273
273
|
*/
|
274
274
|
unsigned int recursion_limit;
|
275
275
|
|
276
|
-
/**
|
276
|
+
/**
|
277
|
+
* Default merge driver to be used when both sides of a merge have
|
278
|
+
* changed. The default is the `text` driver.
|
279
|
+
*/
|
280
|
+
const char *default_driver;
|
281
|
+
|
282
|
+
/**
|
283
|
+
* Flags for handling conflicting content, to be used with the standard
|
284
|
+
* (`text`) merge driver.
|
285
|
+
*/
|
277
286
|
git_merge_file_favor_t file_favor;
|
278
287
|
|
279
288
|
/** see `git_merge_file_flag_t` above */
|
@@ -0,0 +1,92 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_git_proxy_h__
|
8
|
+
#define INCLUDE_git_proxy_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "transport.h"
|
12
|
+
|
13
|
+
GIT_BEGIN_DECL
|
14
|
+
|
15
|
+
/**
|
16
|
+
* The type of proxy to use.
|
17
|
+
*/
|
18
|
+
typedef enum {
|
19
|
+
/**
|
20
|
+
* Do not attempt to connect through a proxy
|
21
|
+
*
|
22
|
+
* If built against lbicurl, it itself may attempt to connect
|
23
|
+
* to a proxy if the environment variables specify it.
|
24
|
+
*/
|
25
|
+
GIT_PROXY_NONE,
|
26
|
+
/**
|
27
|
+
* Try to auto-detect the proxy from the git configuration.
|
28
|
+
*/
|
29
|
+
GIT_PROXY_AUTO,
|
30
|
+
/**
|
31
|
+
* Connect via the URL given in the options
|
32
|
+
*/
|
33
|
+
GIT_PROXY_SPECIFIED,
|
34
|
+
} git_proxy_t;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Options for connecting through a proxy
|
38
|
+
*
|
39
|
+
* Note that not all types may be supported, depending on the platform
|
40
|
+
* and compilation options.
|
41
|
+
*/
|
42
|
+
typedef struct {
|
43
|
+
unsigned int version;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* The type of proxy to use, by URL, auto-detect.
|
47
|
+
*/
|
48
|
+
git_proxy_t type;
|
49
|
+
|
50
|
+
/**
|
51
|
+
* The URL of the proxy.
|
52
|
+
*/
|
53
|
+
const char *url;
|
54
|
+
|
55
|
+
/**
|
56
|
+
* This will be called if the remote host requires
|
57
|
+
* authentication in order to connect to it.
|
58
|
+
*
|
59
|
+
* Returning GIT_PASSTHROUGH will make libgit2 behave as
|
60
|
+
* though this field isn't set.
|
61
|
+
*/
|
62
|
+
git_cred_acquire_cb credentials;
|
63
|
+
|
64
|
+
/**
|
65
|
+
* If cert verification fails, this will be called to let the
|
66
|
+
* user make the final decision of whether to allow the
|
67
|
+
* connection to proceed. Returns 1 to allow the connection, 0
|
68
|
+
* to disallow it or a negative value to indicate an error.
|
69
|
+
*/
|
70
|
+
git_transport_certificate_check_cb certificate_check;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Payload to be provided to the credentials and certificate
|
74
|
+
* check callbacks.
|
75
|
+
*/
|
76
|
+
void *payload;
|
77
|
+
} git_proxy_options;
|
78
|
+
|
79
|
+
#define GIT_PROXY_OPTIONS_VERSION 1
|
80
|
+
#define GIT_PROXY_OPTIONS_INIT {GIT_PROXY_OPTIONS_VERSION}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Initialize a proxy options structure
|
84
|
+
*
|
85
|
+
* @param opts the options struct to initialize
|
86
|
+
* @param version the version of the struct, use `GIT_PROXY_OPTIONS_VERSION`
|
87
|
+
*/
|
88
|
+
GIT_EXTERN(int) git_proxy_init_options(git_proxy_options *opts, unsigned int version);
|
89
|
+
|
90
|
+
GIT_END_DECL
|
91
|
+
|
92
|
+
#endif
|
@@ -461,6 +461,17 @@ GIT_EXTERN(int) git_reference_foreach_name(
|
|
461
461
|
git_reference_foreach_name_cb callback,
|
462
462
|
void *payload);
|
463
463
|
|
464
|
+
/**
|
465
|
+
* Create a copy of an existing reference.
|
466
|
+
*
|
467
|
+
* Call `git_reference_free` to free the data.
|
468
|
+
*
|
469
|
+
* @param dest pointer where to store the copy
|
470
|
+
* @param source object to copy
|
471
|
+
* @return 0 or an error code
|
472
|
+
*/
|
473
|
+
GIT_EXTERN(int) git_reference_dup(git_reference **dest, git_reference *source);
|
474
|
+
|
464
475
|
/**
|
465
476
|
* Free the given reference.
|
466
477
|
*
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#include "strarray.h"
|
16
16
|
#include "transport.h"
|
17
17
|
#include "pack.h"
|
18
|
+
#include "proxy.h"
|
18
19
|
|
19
20
|
/**
|
20
21
|
* @file git2/remote.h
|
@@ -241,10 +242,11 @@ GIT_EXTERN(const git_refspec *)git_remote_get_refspec(const git_remote *remote,
|
|
241
242
|
* @param direction GIT_DIRECTION_FETCH if you want to fetch or
|
242
243
|
* GIT_DIRECTION_PUSH if you want to push
|
243
244
|
* @param callbacks the callbacks to use for this connection
|
245
|
+
* @param proxy_opts proxy settings
|
244
246
|
* @param custom_headers extra HTTP headers to use in this connection
|
245
247
|
* @return 0 or an error code
|
246
248
|
*/
|
247
|
-
GIT_EXTERN(int) git_remote_connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_strarray *custom_headers);
|
249
|
+
GIT_EXTERN(int) git_remote_connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_proxy_options *proxy_opts, const git_strarray *custom_headers);
|
248
250
|
|
249
251
|
/**
|
250
252
|
* Get the remote repository's reference advertisement list
|
@@ -376,7 +378,7 @@ struct git_remote_callbacks {
|
|
376
378
|
/**
|
377
379
|
* Textual progress from the remote. Text send over the
|
378
380
|
* progress side-band will be passed to this function (this is
|
379
|
-
* the 'counting objects' output.
|
381
|
+
* the 'counting objects' output).
|
380
382
|
*/
|
381
383
|
git_transport_message_cb sideband_progress;
|
382
384
|
|
@@ -548,6 +550,11 @@ typedef struct {
|
|
548
550
|
*/
|
549
551
|
git_remote_autotag_option_t download_tags;
|
550
552
|
|
553
|
+
/**
|
554
|
+
* Proxy options to use, by default no proxy is used.
|
555
|
+
*/
|
556
|
+
git_proxy_options proxy_opts;
|
557
|
+
|
551
558
|
/**
|
552
559
|
* Extra headers for this fetch operation
|
553
560
|
*/
|
@@ -555,7 +562,8 @@ typedef struct {
|
|
555
562
|
} git_fetch_options;
|
556
563
|
|
557
564
|
#define GIT_FETCH_OPTIONS_VERSION 1
|
558
|
-
#define GIT_FETCH_OPTIONS_INIT { GIT_FETCH_OPTIONS_VERSION, GIT_REMOTE_CALLBACKS_INIT, GIT_FETCH_PRUNE_UNSPECIFIED, 1
|
565
|
+
#define GIT_FETCH_OPTIONS_INIT { GIT_FETCH_OPTIONS_VERSION, GIT_REMOTE_CALLBACKS_INIT, GIT_FETCH_PRUNE_UNSPECIFIED, 1, \
|
566
|
+
GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED, GIT_PROXY_OPTIONS_INIT }
|
559
567
|
|
560
568
|
/**
|
561
569
|
* Initializes a `git_fetch_options` with default values. Equivalent to
|
@@ -592,6 +600,11 @@ typedef struct {
|
|
592
600
|
*/
|
593
601
|
git_remote_callbacks callbacks;
|
594
602
|
|
603
|
+
/**
|
604
|
+
* Proxy options to use, by default no proxy is used.
|
605
|
+
*/
|
606
|
+
git_proxy_options proxy_opts;
|
607
|
+
|
595
608
|
/**
|
596
609
|
* Extra headers for this push operation
|
597
610
|
*/
|
@@ -599,7 +612,7 @@ typedef struct {
|
|
599
612
|
} git_push_options;
|
600
613
|
|
601
614
|
#define GIT_PUSH_OPTIONS_VERSION 1
|
602
|
-
#define GIT_PUSH_OPTIONS_INIT { GIT_PUSH_OPTIONS_VERSION, 0, GIT_REMOTE_CALLBACKS_INIT }
|
615
|
+
#define GIT_PUSH_OPTIONS_INIT { GIT_PUSH_OPTIONS_VERSION, 0, GIT_REMOTE_CALLBACKS_INIT, GIT_PROXY_OPTIONS_INIT }
|
603
616
|
|
604
617
|
/**
|
605
618
|
* Initializes a `git_push_options` with default values. Equivalent to
|
@@ -62,6 +62,19 @@ GIT_EXTERN(int) git_signature_now(git_signature **out, const char *name, const c
|
|
62
62
|
*/
|
63
63
|
GIT_EXTERN(int) git_signature_default(git_signature **out, git_repository *repo);
|
64
64
|
|
65
|
+
/**
|
66
|
+
* Create a new signature by parsing the given buffer, which is
|
67
|
+
* expected to be in the format "Real Name <email> timestamp tzoffset",
|
68
|
+
* where `timestamp` is the number of seconds since the Unix epoch and
|
69
|
+
* `tzoffset` is the timezone offset in `hhmm` format (note the lack
|
70
|
+
* of a colon separator).
|
71
|
+
*
|
72
|
+
* @param out new signature
|
73
|
+
* @param buf signature string
|
74
|
+
* @return 0 on success, or an error code
|
75
|
+
*/
|
76
|
+
GIT_EXTERN(int) git_signature_from_buffer(git_signature **out, const char *buf);
|
77
|
+
|
65
78
|
/**
|
66
79
|
* Create a copy of an existing signature. All internal strings are also
|
67
80
|
* duplicated.
|
@@ -0,0 +1,177 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_sys_git_merge_h__
|
8
|
+
#define INCLUDE_sys_git_merge_h__
|
9
|
+
|
10
|
+
/**
|
11
|
+
* @file git2/sys/merge.h
|
12
|
+
* @brief Git merge driver backend and plugin routines
|
13
|
+
* @defgroup git_backend Git custom backend APIs
|
14
|
+
* @ingroup Git
|
15
|
+
* @{
|
16
|
+
*/
|
17
|
+
GIT_BEGIN_DECL
|
18
|
+
|
19
|
+
typedef struct git_merge_driver git_merge_driver;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Look up a merge driver by name
|
23
|
+
*
|
24
|
+
* @param name The name of the merge driver
|
25
|
+
* @return Pointer to the merge driver object or NULL if not found
|
26
|
+
*/
|
27
|
+
GIT_EXTERN(git_merge_driver *) git_merge_driver_lookup(const char *name);
|
28
|
+
|
29
|
+
#define GIT_MERGE_DRIVER_TEXT "text"
|
30
|
+
#define GIT_MERGE_DRIVER_BINARY "binary"
|
31
|
+
#define GIT_MERGE_DRIVER_UNION "union"
|
32
|
+
|
33
|
+
/**
|
34
|
+
* A merge driver source represents the file to be merged
|
35
|
+
*/
|
36
|
+
typedef struct git_merge_driver_source git_merge_driver_source;
|
37
|
+
|
38
|
+
/** Get the repository that the source data is coming from. */
|
39
|
+
GIT_EXTERN(git_repository *) git_merge_driver_source_repo(
|
40
|
+
const git_merge_driver_source *src);
|
41
|
+
|
42
|
+
/** Gets the ancestor of the file to merge. */
|
43
|
+
GIT_EXTERN(git_index_entry *) git_merge_driver_source_ancestor(
|
44
|
+
const git_merge_driver_source *src);
|
45
|
+
|
46
|
+
/** Gets the ours side of the file to merge. */
|
47
|
+
GIT_EXTERN(git_index_entry *) git_merge_driver_source_ours(
|
48
|
+
const git_merge_driver_source *src);
|
49
|
+
|
50
|
+
/** Gets the theirs side of the file to merge. */
|
51
|
+
GIT_EXTERN(git_index_entry *) git_merge_driver_source_theirs(
|
52
|
+
const git_merge_driver_source *src);
|
53
|
+
|
54
|
+
/** Gets the merge file options that the merge was invoked with */
|
55
|
+
GIT_EXTERN(git_merge_file_options *) git_merge_driver_source_file_options(
|
56
|
+
const git_merge_driver_source *src);
|
57
|
+
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Initialize callback on merge driver
|
61
|
+
*
|
62
|
+
* Specified as `driver.initialize`, this is an optional callback invoked
|
63
|
+
* before a merge driver is first used. It will be called once at most
|
64
|
+
* per library lifetime.
|
65
|
+
*
|
66
|
+
* If non-NULL, the merge driver's `initialize` callback will be invoked
|
67
|
+
* right before the first use of the driver, so you can defer expensive
|
68
|
+
* initialization operations (in case libgit2 is being used in a way that
|
69
|
+
* doesn't need the merge driver).
|
70
|
+
*/
|
71
|
+
typedef int (*git_merge_driver_init_fn)(git_merge_driver *self);
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Shutdown callback on merge driver
|
75
|
+
*
|
76
|
+
* Specified as `driver.shutdown`, this is an optional callback invoked
|
77
|
+
* when the merge driver is unregistered or when libgit2 is shutting down.
|
78
|
+
* It will be called once at most and should release resources as needed.
|
79
|
+
* This may be called even if the `initialize` callback was not made.
|
80
|
+
*
|
81
|
+
* Typically this function will free the `git_merge_driver` object itself.
|
82
|
+
*/
|
83
|
+
typedef void (*git_merge_driver_shutdown_fn)(git_merge_driver *self);
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Callback to perform the merge.
|
87
|
+
*
|
88
|
+
* Specified as `driver.apply`, this is the callback that actually does the
|
89
|
+
* merge. If it can successfully perform a merge, it should populate
|
90
|
+
* `path_out` with a pointer to the filename to accept, `mode_out` with
|
91
|
+
* the resultant mode, and `merged_out` with the buffer of the merged file
|
92
|
+
* and then return 0. If the driver returns `GIT_PASSTHROUGH`, then the
|
93
|
+
* default merge driver should instead be run. It can also return
|
94
|
+
* `GIT_EMERGECONFLICT` if the driver is not able to produce a merge result,
|
95
|
+
* and the file will remain conflicted. Any other errors will fail and
|
96
|
+
* return to the caller.
|
97
|
+
*
|
98
|
+
* The `filter_name` contains the name of the filter that was invoked, as
|
99
|
+
* specified by the file's attributes.
|
100
|
+
*
|
101
|
+
* The `src` contains the data about the file to be merged.
|
102
|
+
*/
|
103
|
+
typedef int (*git_merge_driver_apply_fn)(
|
104
|
+
git_merge_driver *self,
|
105
|
+
const char **path_out,
|
106
|
+
uint32_t *mode_out,
|
107
|
+
git_buf *merged_out,
|
108
|
+
const char *filter_name,
|
109
|
+
const git_merge_driver_source *src);
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Merge driver structure used to register custom merge drivers.
|
113
|
+
*
|
114
|
+
* To associate extra data with a driver, allocate extra data and put the
|
115
|
+
* `git_merge_driver` struct at the start of your data buffer, then cast
|
116
|
+
* the `self` pointer to your larger structure when your callback is invoked.
|
117
|
+
*/
|
118
|
+
struct git_merge_driver {
|
119
|
+
/** The `version` should be set to `GIT_MERGE_DRIVER_VERSION`. */
|
120
|
+
unsigned int version;
|
121
|
+
|
122
|
+
/** Called when the merge driver is first used for any file. */
|
123
|
+
git_merge_driver_init_fn initialize;
|
124
|
+
|
125
|
+
/** Called when the merge driver is unregistered from the system. */
|
126
|
+
git_merge_driver_shutdown_fn shutdown;
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Called to merge the contents of a conflict. If this function
|
130
|
+
* returns `GIT_PASSTHROUGH` then the default (`text`) merge driver
|
131
|
+
* will instead be invoked. If this function returns
|
132
|
+
* `GIT_EMERGECONFLICT` then the file will remain conflicted.
|
133
|
+
*/
|
134
|
+
git_merge_driver_apply_fn apply;
|
135
|
+
};
|
136
|
+
|
137
|
+
#define GIT_MERGE_DRIVER_VERSION 1
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Register a merge driver under a given name.
|
141
|
+
*
|
142
|
+
* As mentioned elsewhere, the initialize callback will not be invoked
|
143
|
+
* immediately. It is deferred until the driver is used in some way.
|
144
|
+
*
|
145
|
+
* Currently the merge driver registry is not thread safe, so any
|
146
|
+
* registering or deregistering of merge drivers must be done outside of
|
147
|
+
* any possible usage of the drivers (i.e. during application setup or
|
148
|
+
* shutdown).
|
149
|
+
*
|
150
|
+
* @param name The name of this driver to match an attribute. Attempting
|
151
|
+
* to register with an in-use name will return GIT_EEXISTS.
|
152
|
+
* @param driver The merge driver definition. This pointer will be stored
|
153
|
+
* as is by libgit2 so it must be a durable allocation (either
|
154
|
+
* static or on the heap).
|
155
|
+
* @return 0 on successful registry, error code <0 on failure
|
156
|
+
*/
|
157
|
+
GIT_EXTERN(int) git_merge_driver_register(
|
158
|
+
const char *name, git_merge_driver *driver);
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Remove the merge driver with the given name.
|
162
|
+
*
|
163
|
+
* Attempting to remove the builtin libgit2 merge drivers is not permitted
|
164
|
+
* and will return an error.
|
165
|
+
*
|
166
|
+
* Currently the merge driver registry is not thread safe, so any
|
167
|
+
* registering or deregistering of drivers must be done outside of any
|
168
|
+
* possible usage of the drivers (i.e. during application setup or shutdown).
|
169
|
+
*
|
170
|
+
* @param name The name under which the merge driver was registered
|
171
|
+
* @return 0 on success, error code <0 on failure
|
172
|
+
*/
|
173
|
+
GIT_EXTERN(int) git_merge_driver_unregister(const char *name);
|
174
|
+
|
175
|
+
/** @} */
|
176
|
+
GIT_END_DECL
|
177
|
+
#endif
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef INCLUDE_sys_git_transport_h
|
9
|
+
#define INCLUDE_sys_git_transport_h
|
10
|
+
|
11
|
+
#include "git2/net.h"
|
12
|
+
#include "git2/types.h"
|
13
|
+
|
14
|
+
GIT_BEGIN_DECL
|
15
|
+
|
16
|
+
GIT_END_DECL
|