rugged 0.21.4 → 0.22.0b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -5
- data/ext/rugged/extconf.rb +9 -9
- data/ext/rugged/rugged.c +4 -2
- data/ext/rugged/rugged.h +3 -7
- data/ext/rugged/rugged_blob.c +57 -0
- data/ext/rugged/rugged_cred.c +23 -0
- data/ext/rugged/rugged_index.c +6 -2
- data/ext/rugged/rugged_remote.c +65 -52
- data/ext/rugged/rugged_remote_collection.c +59 -10
- data/ext/rugged/rugged_repo.c +345 -11
- data/ext/rugged/rugged_revwalk.c +10 -0
- data/ext/rugged/rugged_submodule.c +1042 -0
- data/ext/rugged/rugged_submodule_collection.c +236 -0
- data/ext/rugged/rugged_tag_collection.c +70 -2
- data/ext/rugged/rugged_tree.c +29 -10
- data/lib/rugged.rb +3 -0
- data/lib/rugged/attributes.rb +41 -0
- data/lib/rugged/blob.rb +28 -0
- data/lib/rugged/diff.rb +0 -1
- data/lib/rugged/diff/line.rb +1 -3
- data/lib/rugged/patch.rb +12 -2
- data/lib/rugged/repository.rb +7 -0
- data/lib/rugged/submodule_collection.rb +48 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +27 -3
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +324 -0
- data/vendor/libgit2/deps/http-parser/http_parser.h +2 -0
- data/vendor/libgit2/deps/zlib/adler32.c +39 -29
- data/vendor/libgit2/deps/zlib/crc32.c +33 -50
- data/vendor/libgit2/deps/zlib/crc32.h +1 -1
- data/vendor/libgit2/deps/zlib/deflate.c +198 -65
- data/vendor/libgit2/deps/zlib/deflate.h +8 -4
- data/vendor/libgit2/deps/zlib/infback.c +640 -0
- 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 +84 -52
- data/vendor/libgit2/deps/zlib/inftrees.c +15 -39
- data/vendor/libgit2/deps/zlib/trees.c +18 -36
- data/vendor/libgit2/deps/zlib/zconf.h +4 -0
- data/vendor/libgit2/deps/zlib/zlib.h +250 -95
- data/vendor/libgit2/deps/zlib/zutil.c +13 -10
- data/vendor/libgit2/deps/zlib/zutil.h +41 -62
- data/vendor/libgit2/include/git2.h +4 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +99 -0
- data/vendor/libgit2/include/git2/attr.h +16 -13
- data/vendor/libgit2/include/git2/branch.h +11 -0
- data/vendor/libgit2/include/git2/buffer.h +16 -0
- 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 +77 -69
- data/vendor/libgit2/include/git2/common.h +13 -1
- data/vendor/libgit2/include/git2/config.h +0 -14
- data/vendor/libgit2/include/git2/describe.h +162 -0
- data/vendor/libgit2/include/git2/diff.h +13 -8
- data/vendor/libgit2/include/git2/errors.h +5 -0
- data/vendor/libgit2/include/git2/global.h +38 -0
- data/vendor/libgit2/include/git2/merge.h +38 -64
- data/vendor/libgit2/include/git2/net.h +2 -2
- data/vendor/libgit2/include/git2/notes.h +17 -0
- data/vendor/libgit2/include/git2/oid.h +8 -4
- data/vendor/libgit2/include/git2/oidarray.h +40 -0
- data/vendor/libgit2/include/git2/rebase.h +261 -0
- data/vendor/libgit2/include/git2/reflog.h +1 -1
- data/vendor/libgit2/include/git2/remote.h +25 -47
- data/vendor/libgit2/include/git2/repository.h +4 -1
- data/vendor/libgit2/include/git2/reset.h +10 -1
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +28 -23
- data/vendor/libgit2/include/git2/status.h +19 -15
- data/vendor/libgit2/include/git2/submodule.h +18 -0
- data/vendor/libgit2/include/git2/sys/config.h +0 -1
- data/vendor/libgit2/{src → include/git2/sys}/hashsig.h +11 -7
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +13 -0
- data/vendor/libgit2/include/git2/sys/refs.h +0 -11
- data/vendor/libgit2/include/git2/sys/repository.h +13 -0
- data/vendor/libgit2/include/git2/sys/transport.h +352 -0
- data/vendor/libgit2/include/git2/threads.h +10 -20
- data/vendor/libgit2/include/git2/transaction.h +111 -0
- data/vendor/libgit2/include/git2/transport.h +79 -313
- data/vendor/libgit2/include/git2/tree.h +4 -2
- data/vendor/libgit2/include/git2/types.h +77 -8
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/annotated_commit.c +121 -0
- data/vendor/libgit2/src/annotated_commit.h +22 -0
- data/vendor/libgit2/src/attr.c +8 -4
- data/vendor/libgit2/src/attr_file.c +24 -2
- data/vendor/libgit2/src/blame.c +0 -1
- data/vendor/libgit2/src/branch.c +32 -3
- data/vendor/libgit2/src/buf_text.c +9 -5
- data/vendor/libgit2/src/buf_text.h +3 -2
- data/vendor/libgit2/src/buffer.c +67 -10
- data/vendor/libgit2/src/buffer.h +4 -2
- data/vendor/libgit2/src/cache.c +9 -9
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +2 -0
- data/vendor/libgit2/src/checkout.c +263 -82
- data/vendor/libgit2/src/checkout.h +1 -0
- data/vendor/libgit2/src/cherrypick.c +41 -44
- data/vendor/libgit2/src/clone.c +96 -58
- data/vendor/libgit2/src/commit.c +5 -31
- data/vendor/libgit2/src/commit_list.h +3 -1
- data/vendor/libgit2/src/config.c +0 -17
- data/vendor/libgit2/src/config_cache.c +0 -2
- data/vendor/libgit2/src/config_file.c +12 -15
- data/vendor/libgit2/src/crlf.c +2 -1
- data/vendor/libgit2/src/describe.c +886 -0
- data/vendor/libgit2/src/diff.c +29 -3
- data/vendor/libgit2/src/diff_file.c +1 -0
- data/vendor/libgit2/src/diff_patch.c +2 -3
- data/vendor/libgit2/src/diff_print.c +11 -9
- data/vendor/libgit2/src/diff_tform.c +4 -4
- data/vendor/libgit2/src/errors.c +9 -7
- data/vendor/libgit2/src/fetch.c +6 -6
- data/vendor/libgit2/src/fetchhead.h +2 -4
- data/vendor/libgit2/src/filebuf.c +0 -2
- data/vendor/libgit2/src/filebuf.h +2 -3
- data/vendor/libgit2/src/fileops.c +9 -7
- data/vendor/libgit2/src/global.c +44 -35
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/graph.c +2 -2
- data/vendor/libgit2/src/hash.h +3 -1
- data/vendor/libgit2/src/hash/hash_common_crypto.h +44 -0
- data/vendor/libgit2/src/hash/hash_win32.c +1 -1
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/src/ignore.c +5 -88
- data/vendor/libgit2/src/index.c +70 -57
- data/vendor/libgit2/src/index.h +1 -0
- data/vendor/libgit2/src/indexer.c +16 -5
- data/vendor/libgit2/src/iterator.c +70 -1
- data/vendor/libgit2/src/iterator.h +5 -1
- data/vendor/libgit2/src/map.h +0 -1
- data/vendor/libgit2/src/merge.c +203 -327
- data/vendor/libgit2/src/merge.h +3 -13
- data/vendor/libgit2/src/mwindow.c +119 -8
- data/vendor/libgit2/src/mwindow.h +9 -1
- data/vendor/libgit2/src/netops.c +7 -8
- data/vendor/libgit2/src/netops.h +6 -16
- data/vendor/libgit2/src/notes.c +31 -4
- data/vendor/libgit2/src/notes.h +3 -0
- data/vendor/libgit2/src/odb.c +23 -1
- data/vendor/libgit2/src/odb_loose.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +6 -3
- data/vendor/libgit2/src/oid.c +9 -1
- data/vendor/libgit2/src/oid.h +11 -0
- data/vendor/libgit2/src/oidarray.c +21 -0
- data/vendor/libgit2/src/oidarray.h +18 -0
- data/vendor/libgit2/src/oidmap.h +16 -0
- data/vendor/libgit2/src/pack.c +20 -7
- data/vendor/libgit2/src/pack.h +3 -0
- data/vendor/libgit2/src/path.c +120 -293
- data/vendor/libgit2/src/path.h +21 -44
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/pool.c +5 -11
- data/vendor/libgit2/src/pool.h +0 -2
- data/vendor/libgit2/src/posix.c +6 -6
- data/vendor/libgit2/src/posix.h +48 -28
- data/vendor/libgit2/src/push.c +19 -48
- data/vendor/libgit2/src/push.h +2 -4
- data/vendor/libgit2/src/rebase.c +1125 -0
- data/vendor/libgit2/src/refdb.c +19 -0
- data/vendor/libgit2/src/refdb.h +2 -1
- data/vendor/libgit2/src/refdb_fs.c +101 -29
- data/vendor/libgit2/src/reflog.c +1 -1
- data/vendor/libgit2/src/refs.c +38 -3
- data/vendor/libgit2/src/refs.h +13 -2
- data/vendor/libgit2/src/refspec.c +20 -2
- data/vendor/libgit2/src/remote.c +288 -154
- data/vendor/libgit2/src/remote.h +5 -1
- data/vendor/libgit2/src/repository.c +75 -36
- data/vendor/libgit2/src/repository.h +3 -25
- data/vendor/libgit2/src/reset.c +5 -1
- data/vendor/libgit2/src/revert.c +4 -6
- data/vendor/libgit2/src/revparse.c +15 -18
- data/vendor/libgit2/src/revwalk.c +96 -22
- data/vendor/libgit2/src/revwalk.h +5 -4
- data/vendor/libgit2/src/settings.c +22 -0
- data/vendor/libgit2/src/signature.c +37 -2
- data/vendor/libgit2/src/signature.h +3 -0
- data/vendor/libgit2/src/stash.c +17 -12
- data/vendor/libgit2/src/status.c +13 -3
- data/vendor/libgit2/src/strnlen.h +2 -1
- data/vendor/libgit2/src/submodule.c +75 -35
- data/vendor/libgit2/src/thread-utils.h +4 -9
- data/vendor/libgit2/src/trace.h +9 -1
- data/vendor/libgit2/src/transaction.c +352 -0
- data/vendor/libgit2/src/transport.c +91 -97
- data/vendor/libgit2/src/transports/auth.c +71 -0
- data/vendor/libgit2/src/transports/auth.h +63 -0
- data/vendor/libgit2/src/transports/auth_negotiate.c +275 -0
- data/vendor/libgit2/src/transports/auth_negotiate.h +27 -0
- data/vendor/libgit2/src/transports/cred.c +58 -0
- data/vendor/libgit2/src/transports/cred.h +14 -0
- data/vendor/libgit2/src/transports/cred_helpers.c +3 -0
- data/vendor/libgit2/src/transports/git.c +1 -0
- data/vendor/libgit2/src/transports/http.c +208 -82
- data/vendor/libgit2/src/transports/local.c +2 -2
- data/vendor/libgit2/src/transports/smart.c +2 -0
- data/vendor/libgit2/src/transports/smart.h +2 -0
- data/vendor/libgit2/src/transports/smart_protocol.c +10 -10
- data/vendor/libgit2/src/transports/ssh.c +243 -57
- data/vendor/libgit2/src/transports/winhttp.c +139 -35
- data/vendor/libgit2/src/tree-cache.c +118 -31
- data/vendor/libgit2/src/tree-cache.h +12 -7
- data/vendor/libgit2/src/tree.c +83 -64
- data/vendor/libgit2/src/tree.h +2 -3
- data/vendor/libgit2/src/unix/map.c +8 -2
- data/vendor/libgit2/src/unix/posix.h +23 -9
- data/vendor/libgit2/src/unix/realpath.c +8 -7
- data/vendor/libgit2/src/userdiff.h +3 -3
- data/vendor/libgit2/src/util.c +2 -92
- data/vendor/libgit2/src/util.h +3 -15
- data/vendor/libgit2/src/win32/findfile.c +0 -1
- data/vendor/libgit2/src/win32/map.c +3 -2
- data/vendor/libgit2/src/win32/mingw-compat.h +5 -12
- data/vendor/libgit2/src/win32/msvc-compat.h +3 -32
- data/vendor/libgit2/src/win32/posix.h +20 -32
- data/vendor/libgit2/src/win32/posix_w32.c +103 -31
- data/vendor/libgit2/src/win32/utf-conv.c +6 -36
- data/vendor/libgit2/src/win32/utf-conv.h +39 -0
- data/vendor/libgit2/src/win32/w32_util.h +0 -1
- metadata +32 -7
- data/vendor/libgit2/src/win32/path_w32.c +0 -305
- data/vendor/libgit2/src/win32/path_w32.h +0 -82
@@ -152,6 +152,12 @@ 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
|
+
|
155
161
|
/*
|
156
162
|
* Options controlling how output will be generated
|
157
163
|
*/
|
@@ -237,6 +243,7 @@ typedef enum {
|
|
237
243
|
GIT_DELTA_IGNORED = 6, /**< entry is ignored item in workdir */
|
238
244
|
GIT_DELTA_UNTRACKED = 7, /**< entry is untracked item in workdir */
|
239
245
|
GIT_DELTA_TYPECHANGE = 8, /**< type of entry changed between old and new */
|
246
|
+
GIT_DELTA_UNREADABLE = 9, /**< entry is unreadable */
|
240
247
|
} git_delta_t;
|
241
248
|
|
242
249
|
/**
|
@@ -370,8 +377,8 @@ typedef struct {
|
|
370
377
|
|
371
378
|
/* options controlling how to diff text is generated */
|
372
379
|
|
373
|
-
|
374
|
-
|
380
|
+
uint32_t context_lines; /**< defaults to 3 */
|
381
|
+
uint32_t interhunk_lines; /**< defaults to 0 */
|
375
382
|
uint16_t id_abbrev; /**< default 'core.abbrev' or 7 if unset */
|
376
383
|
git_off_t max_size; /**< defaults to 512MB */
|
377
384
|
const char *old_prefix; /**< defaults to "a" */
|
@@ -414,15 +421,14 @@ typedef int (*git_diff_file_cb)(
|
|
414
421
|
/**
|
415
422
|
* Structure describing a hunk of a diff.
|
416
423
|
*/
|
417
|
-
typedef struct
|
418
|
-
struct git_diff_hunk {
|
424
|
+
typedef struct {
|
419
425
|
int old_start; /**< Starting line number in old_file */
|
420
426
|
int old_lines; /**< Number of lines in old_file */
|
421
427
|
int new_start; /**< Starting line number in new_file */
|
422
428
|
int new_lines; /**< Number of lines in new_file */
|
423
429
|
size_t header_len; /**< Number of bytes in header text */
|
424
430
|
char header[128]; /**< Header text, NUL-byte terminated */
|
425
|
-
};
|
431
|
+
} git_diff_hunk;
|
426
432
|
|
427
433
|
/**
|
428
434
|
* When iterating over a diff, callback that will be made per hunk.
|
@@ -462,8 +468,7 @@ typedef enum {
|
|
462
468
|
/**
|
463
469
|
* Structure describing a line (or data span) of a diff.
|
464
470
|
*/
|
465
|
-
typedef struct
|
466
|
-
struct git_diff_line {
|
471
|
+
typedef struct {
|
467
472
|
char origin; /**< A git_diff_line_t value */
|
468
473
|
int old_lineno; /**< Line number in old file or -1 for added line */
|
469
474
|
int new_lineno; /**< Line number in new file or -1 for deleted line */
|
@@ -471,7 +476,7 @@ struct git_diff_line {
|
|
471
476
|
size_t content_len; /**< Number of bytes of data */
|
472
477
|
git_off_t content_offset; /**< Offset in the original file to the content */
|
473
478
|
const char *content; /**< Pointer to diff text, not NUL-byte terminated */
|
474
|
-
};
|
479
|
+
} git_diff_line;
|
475
480
|
|
476
481
|
/**
|
477
482
|
* When iterating over a diff, callback that will be made per text diff
|
@@ -41,6 +41,9 @@ 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
|
+
GIT_EAPPLIED = -18, /**< Patch/merge has already been applied */
|
44
47
|
|
45
48
|
GIT_PASSTHROUGH = -30, /**< Internal only */
|
46
49
|
GIT_ITEROVER = -31, /**< Signals end of iteration with iterator */
|
@@ -87,6 +90,8 @@ typedef enum {
|
|
87
90
|
GITERR_REVERT,
|
88
91
|
GITERR_CALLBACK,
|
89
92
|
GITERR_CHERRYPICK,
|
93
|
+
GITERR_DESCRIBE,
|
94
|
+
GITERR_REBASE,
|
90
95
|
} git_error_t;
|
91
96
|
|
92
97
|
/**
|
@@ -0,0 +1,38 @@
|
|
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_global_h__
|
8
|
+
#define INCLUDE_git_global_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
GIT_BEGIN_DECL
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Init the global state
|
16
|
+
*
|
17
|
+
* This function must the called before any other libgit2 function in
|
18
|
+
* order to set up global state and threading.
|
19
|
+
*
|
20
|
+
* This function may be called multiple times.
|
21
|
+
*
|
22
|
+
* @return 0 or an error code
|
23
|
+
*/
|
24
|
+
GIT_EXTERN(int) git_libgit2_init(void);
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Shutdown the global state
|
28
|
+
*
|
29
|
+
* Clean up the global state and threading context after calling it as
|
30
|
+
* many times as `git_libgit2_init()` was called.
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
GIT_EXTERN(void) git_libgit2_shutdown(void);
|
34
|
+
|
35
|
+
/** @} */
|
36
|
+
GIT_END_DECL
|
37
|
+
#endif
|
38
|
+
|
@@ -10,8 +10,10 @@
|
|
10
10
|
#include "common.h"
|
11
11
|
#include "types.h"
|
12
12
|
#include "oid.h"
|
13
|
+
#include "oidarray.h"
|
13
14
|
#include "checkout.h"
|
14
15
|
#include "index.h"
|
16
|
+
#include "annotated_commit.h"
|
15
17
|
|
16
18
|
/**
|
17
19
|
* @file git2/merge.h
|
@@ -302,7 +304,7 @@ GIT_EXTERN(int) git_merge_analysis(
|
|
302
304
|
git_merge_analysis_t *analysis_out,
|
303
305
|
git_merge_preference_t *preference_out,
|
304
306
|
git_repository *repo,
|
305
|
-
const
|
307
|
+
const git_annotated_commit **their_heads,
|
306
308
|
size_t their_heads_len);
|
307
309
|
|
308
310
|
/**
|
@@ -320,6 +322,21 @@ GIT_EXTERN(int) git_merge_base(
|
|
320
322
|
const git_oid *one,
|
321
323
|
const git_oid *two);
|
322
324
|
|
325
|
+
/**
|
326
|
+
* Find merge bases between two commits
|
327
|
+
*
|
328
|
+
* @param out array in which to store the resulting ids
|
329
|
+
* @param repo the repository where the commits exist
|
330
|
+
* @param one one of the commits
|
331
|
+
* @param two the other commit
|
332
|
+
* @return 0 on success, GIT_ENOTFOUND if not found or error code
|
333
|
+
*/
|
334
|
+
GIT_EXTERN(int) git_merge_bases(
|
335
|
+
git_oidarray *out,
|
336
|
+
git_repository *repo,
|
337
|
+
const git_oid *one,
|
338
|
+
const git_oid *two);
|
339
|
+
|
323
340
|
/**
|
324
341
|
* Find a merge base given a list of commits
|
325
342
|
*
|
@@ -336,82 +353,34 @@ GIT_EXTERN(int) git_merge_base_many(
|
|
336
353
|
const git_oid input_array[]);
|
337
354
|
|
338
355
|
/**
|
339
|
-
* Find
|
356
|
+
* Find all merge bases given a list of commits
|
340
357
|
*
|
341
|
-
* @param out
|
358
|
+
* @param out array in which to store the resulting ids
|
342
359
|
* @param repo the repository where the commits exist
|
343
360
|
* @param length The number of commits in the provided `input_array`
|
344
361
|
* @param input_array oids of the commits
|
345
362
|
* @return Zero on success; GIT_ENOTFOUND or -1 on failure.
|
346
363
|
*/
|
347
|
-
GIT_EXTERN(int)
|
348
|
-
|
364
|
+
GIT_EXTERN(int) git_merge_bases_many(
|
365
|
+
git_oidarray *out,
|
349
366
|
git_repository *repo,
|
350
367
|
size_t length,
|
351
368
|
const git_oid input_array[]);
|
352
369
|
|
353
370
|
/**
|
354
|
-
*
|
355
|
-
* git_merge_head must be freed with `git_merge_head_free`.
|
356
|
-
*
|
357
|
-
* @param out pointer to store the git_merge_head result in
|
358
|
-
* @param repo repository that contains the given reference
|
359
|
-
* @param ref reference to use as a merge input
|
360
|
-
* @return 0 on success or error code
|
361
|
-
*/
|
362
|
-
GIT_EXTERN(int) git_merge_head_from_ref(
|
363
|
-
git_merge_head **out,
|
364
|
-
git_repository *repo,
|
365
|
-
const git_reference *ref);
|
366
|
-
|
367
|
-
/**
|
368
|
-
* Creates a `git_merge_head` from the given fetch head data. The resulting
|
369
|
-
* git_merge_head must be freed with `git_merge_head_free`.
|
370
|
-
*
|
371
|
-
* @param out pointer to store the git_merge_head result in
|
372
|
-
* @param repo repository that contains the given commit
|
373
|
-
* @param branch_name name of the (remote) branch
|
374
|
-
* @param remote_url url of the remote
|
375
|
-
* @param oid the commit object id to use as a merge input
|
376
|
-
* @return 0 on success or error code
|
377
|
-
*/
|
378
|
-
GIT_EXTERN(int) git_merge_head_from_fetchhead(
|
379
|
-
git_merge_head **out,
|
380
|
-
git_repository *repo,
|
381
|
-
const char *branch_name,
|
382
|
-
const char *remote_url,
|
383
|
-
const git_oid *oid);
|
384
|
-
|
385
|
-
/**
|
386
|
-
* Creates a `git_merge_head` from the given commit id. The resulting
|
387
|
-
* git_merge_head must be freed with `git_merge_head_free`.
|
371
|
+
* Find a merge base in preparation for an octopus merge
|
388
372
|
*
|
389
|
-
* @param out
|
390
|
-
* @param repo repository
|
391
|
-
* @param
|
392
|
-
* @
|
373
|
+
* @param out the OID of a merge base considering all the commits
|
374
|
+
* @param repo the repository where the commits exist
|
375
|
+
* @param length The number of commits in the provided `input_array`
|
376
|
+
* @param input_array oids of the commits
|
377
|
+
* @return Zero on success; GIT_ENOTFOUND or -1 on failure.
|
393
378
|
*/
|
394
|
-
GIT_EXTERN(int)
|
395
|
-
|
379
|
+
GIT_EXTERN(int) git_merge_base_octopus(
|
380
|
+
git_oid *out,
|
396
381
|
git_repository *repo,
|
397
|
-
|
398
|
-
|
399
|
-
/**
|
400
|
-
* Gets the commit ID that the given `git_merge_head` refers to.
|
401
|
-
*
|
402
|
-
* @param head the given merge head
|
403
|
-
* @return commit id
|
404
|
-
*/
|
405
|
-
GIT_EXTERN(const git_oid *) git_merge_head_id(
|
406
|
-
const git_merge_head *head);
|
407
|
-
|
408
|
-
/**
|
409
|
-
* Frees a `git_merge_head`.
|
410
|
-
*
|
411
|
-
* @param head merge head to free
|
412
|
-
*/
|
413
|
-
GIT_EXTERN(void) git_merge_head_free(
|
414
|
-
git_merge_head *head);
|
382
|
+
size_t length,
|
383
|
+
const git_oid input_array[]);
|
415
384
|
|
416
385
|
/**
|
417
386
|
* Merge two files as they exist in the in-memory data structures, using
|
@@ -517,6 +486,11 @@ GIT_EXTERN(int) git_merge_commits(
|
|
517
486
|
* to the index. Callers should inspect the repository's index after this
|
518
487
|
* completes, resolve any conflicts and prepare a commit.
|
519
488
|
*
|
489
|
+
* For compatibility with git, the repository is put into a merging
|
490
|
+
* state. Once the commit is done (or if the uses wishes to abort),
|
491
|
+
* you should clear this state by calling
|
492
|
+
* `git_repository_state_cleanup()`.
|
493
|
+
*
|
520
494
|
* @param repo the repository to merge
|
521
495
|
* @param their_heads the heads to merge into
|
522
496
|
* @param their_heads_len the number of heads to merge
|
@@ -526,7 +500,7 @@ GIT_EXTERN(int) git_merge_commits(
|
|
526
500
|
*/
|
527
501
|
GIT_EXTERN(int) git_merge(
|
528
502
|
git_repository *repo,
|
529
|
-
const
|
503
|
+
const git_annotated_commit **their_heads,
|
530
504
|
size_t their_heads_len,
|
531
505
|
const git_merge_options *merge_opts,
|
532
506
|
const git_checkout_options *checkout_opts);
|
@@ -32,9 +32,9 @@ typedef enum {
|
|
32
32
|
GIT_DIRECTION_PUSH = 1
|
33
33
|
} git_direction;
|
34
34
|
|
35
|
-
|
36
35
|
/**
|
37
|
-
*
|
36
|
+
* Description of a reference advertised by a remote server, given out
|
37
|
+
* on `ls` calls.
|
38
38
|
*/
|
39
39
|
struct git_remote_head {
|
40
40
|
int local; /* available locally */
|
@@ -96,6 +96,23 @@ GIT_EXTERN(int) git_note_read(
|
|
96
96
|
const char *notes_ref,
|
97
97
|
const git_oid *oid);
|
98
98
|
|
99
|
+
/**
|
100
|
+
* Get the note author
|
101
|
+
*
|
102
|
+
* @param note the note
|
103
|
+
* @return the author
|
104
|
+
*/
|
105
|
+
GIT_EXTERN(const git_signature *) git_note_author(const git_note *note);
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Get the note committer
|
109
|
+
*
|
110
|
+
* @param note the note
|
111
|
+
* @return the committer
|
112
|
+
*/
|
113
|
+
GIT_EXTERN(const git_signature *) git_note_committer(const git_note *note);
|
114
|
+
|
115
|
+
|
99
116
|
/**
|
100
117
|
* Get the note message
|
101
118
|
*
|
@@ -116,13 +116,17 @@ 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
|
119
|
+
* Format a git_oid into a statically allocated c-string.
|
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.
|
120
125
|
*
|
121
126
|
* @param id the oid structure to format
|
122
|
-
* @return the c-string
|
123
|
-
* deallocate the string with git__free().
|
127
|
+
* @return the c-string
|
124
128
|
*/
|
125
|
-
GIT_EXTERN(char *)
|
129
|
+
GIT_EXTERN(char *) git_oid_tostr_s(const git_oid *oid);
|
126
130
|
|
127
131
|
/**
|
128
132
|
* Format a git_oid into a buffer as a hex format c-string.
|
@@ -0,0 +1,40 @@
|
|
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_oidarray_h__
|
8
|
+
#define INCLUDE_git_oidarray_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "oid.h"
|
12
|
+
|
13
|
+
GIT_BEGIN_DECL
|
14
|
+
|
15
|
+
/** Array of object ids */
|
16
|
+
typedef struct git_oidarray {
|
17
|
+
git_oid *ids;
|
18
|
+
size_t count;
|
19
|
+
} git_oidarray;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Free the OID array
|
23
|
+
*
|
24
|
+
* This method must (and must only) be called on `git_oidarray`
|
25
|
+
* objects where the array is allocated by the library. Not doing so,
|
26
|
+
* will result in a memory leak.
|
27
|
+
*
|
28
|
+
* This does not free the `git_oidarray` itself, since the library will
|
29
|
+
* never allocate that object directly itself (it is more commonly embedded
|
30
|
+
* inside another struct or created on the stack).
|
31
|
+
*
|
32
|
+
* @param array git_oidarray from which to free oid data
|
33
|
+
*/
|
34
|
+
GIT_EXTERN(void) git_oidarray_free(git_oidarray *array);
|
35
|
+
|
36
|
+
/** @} */
|
37
|
+
GIT_END_DECL
|
38
|
+
|
39
|
+
#endif
|
40
|
+
|
@@ -0,0 +1,261 @@
|
|
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_rebase_h__
|
8
|
+
#define INCLUDE_git_rebase_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "types.h"
|
12
|
+
#include "oid.h"
|
13
|
+
#include "annotated_commit.h"
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @file git2/rebase.h
|
17
|
+
* @brief Git rebase routines
|
18
|
+
* @defgroup git_rebase Git merge routines
|
19
|
+
* @ingroup Git
|
20
|
+
* @{
|
21
|
+
*/
|
22
|
+
GIT_BEGIN_DECL
|
23
|
+
|
24
|
+
typedef struct {
|
25
|
+
unsigned int version;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Provide a quiet rebase experience; unused by libgit2 but provided for
|
29
|
+
* interoperability with other clients.
|
30
|
+
*/
|
31
|
+
int quiet;
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Canonical name of the notes reference used to rewrite notes for
|
35
|
+
* rebased commits when finishing the rebase; if NULL, the contents of
|
36
|
+
* the coniguration option `notes.rewriteRef` is examined, unless the
|
37
|
+
* configuration option `notes.rewrite.rebase` is set to false. If
|
38
|
+
* `notes.rewriteRef` is NULL, notes will not be rewritten.
|
39
|
+
*/
|
40
|
+
const char *rewrite_notes_ref;
|
41
|
+
} git_rebase_options;
|
42
|
+
|
43
|
+
/** Type of rebase operation in-progress after calling `git_rebase_next`. */
|
44
|
+
typedef enum {
|
45
|
+
/**
|
46
|
+
* The given commit is to be cherry-picked. The client should commit
|
47
|
+
* the changes and continue if there are no conflicts.
|
48
|
+
*/
|
49
|
+
GIT_REBASE_OPERATION_PICK = 0,
|
50
|
+
|
51
|
+
/**
|
52
|
+
* The given commit is to be cherry-picked, but the client should prompt
|
53
|
+
* the user to provide an updated commit message.
|
54
|
+
*/
|
55
|
+
GIT_REBASE_OPERATION_REWORD,
|
56
|
+
|
57
|
+
/**
|
58
|
+
* The given commit is to be cherry-picked, but the client should stop
|
59
|
+
* to allow the user to edit the changes before committing them.
|
60
|
+
*/
|
61
|
+
GIT_REBASE_OPERATION_EDIT,
|
62
|
+
|
63
|
+
/**
|
64
|
+
* The given commit is to be squashed into the previous commit. The
|
65
|
+
* commit message will be merged with the previous message.
|
66
|
+
*/
|
67
|
+
GIT_REBASE_OPERATION_SQUASH,
|
68
|
+
|
69
|
+
/**
|
70
|
+
* The given commit is to be squashed into the previous commit. The
|
71
|
+
* commit message from this commit will be discarded.
|
72
|
+
*/
|
73
|
+
GIT_REBASE_OPERATION_FIXUP,
|
74
|
+
|
75
|
+
/**
|
76
|
+
* No commit will be cherry-picked. The client should run the given
|
77
|
+
* command and (if successful) continue.
|
78
|
+
*/
|
79
|
+
GIT_REBASE_OPERATION_EXEC,
|
80
|
+
} git_rebase_operation_t;
|
81
|
+
|
82
|
+
#define GIT_REBASE_OPTIONS_VERSION 1
|
83
|
+
#define GIT_REBASE_OPTIONS_INIT {GIT_REBASE_OPTIONS_VERSION}
|
84
|
+
|
85
|
+
typedef struct {
|
86
|
+
/** The type of rebase operation. */
|
87
|
+
git_rebase_operation_t type;
|
88
|
+
|
89
|
+
/**
|
90
|
+
* The commit ID being cherry-picked. This will be populated for
|
91
|
+
* all operations except those of type `GIT_REBASE_OPERATION_EXEC`.
|
92
|
+
*/
|
93
|
+
const git_oid id;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* The executable the user has requested be run. This will only
|
97
|
+
* be populated for operations of type `GIT_REBASE_OPERATION_EXEC`.
|
98
|
+
*/
|
99
|
+
const char *exec;
|
100
|
+
} git_rebase_operation;
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Initializes a `git_rebase_options` with default values. Equivalent to
|
104
|
+
* creating an instance with GIT_REBASE_OPTIONS_INIT.
|
105
|
+
*
|
106
|
+
* @param opts the `git_rebase_options` instance to initialize.
|
107
|
+
* @param version the version of the struct; you should pass
|
108
|
+
* `GIT_REBASE_OPTIONS_VERSION` here.
|
109
|
+
* @return Zero on success; -1 on failure.
|
110
|
+
*/
|
111
|
+
GIT_EXTERN(int) git_rebase_init_options(
|
112
|
+
git_rebase_options *opts,
|
113
|
+
unsigned int version);
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Initializes a rebase operation to rebase the changes in `branch`
|
117
|
+
* relative to `upstream` onto another branch. To begin the rebase
|
118
|
+
* process, call `git_rebase_next`. When you have finished with this
|
119
|
+
* object, call `git_rebase_free`.
|
120
|
+
*
|
121
|
+
* @param out Pointer to store the rebase object
|
122
|
+
* @param repo The repository to perform the rebase
|
123
|
+
* @param branch The terminal commit to rebase
|
124
|
+
* @param upstream The commit to begin rebasing from, or NULL to rebase all
|
125
|
+
* reachable commits
|
126
|
+
* @param onto The branch to rebase onto, or NULL to rebase onto the given
|
127
|
+
* upstream
|
128
|
+
* @param signature The signature of the rebaser (optional)
|
129
|
+
* @param opts Options to specify how rebase is performed
|
130
|
+
* @return Zero on success; -1 on failure.
|
131
|
+
*/
|
132
|
+
GIT_EXTERN(int) git_rebase_init(
|
133
|
+
git_rebase **out,
|
134
|
+
git_repository *repo,
|
135
|
+
const git_annotated_commit *branch,
|
136
|
+
const git_annotated_commit *upstream,
|
137
|
+
const git_annotated_commit *onto,
|
138
|
+
const git_signature *signature,
|
139
|
+
const git_rebase_options *opts);
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Opens an existing rebase that was previously started by either an
|
143
|
+
* invocation of `git_rebase_init` or by another client.
|
144
|
+
*
|
145
|
+
* @param out Pointer to store the rebase object
|
146
|
+
* @param reop The repository that has a rebase in-progress
|
147
|
+
* @return Zero on success; -1 on failure.
|
148
|
+
*/
|
149
|
+
GIT_EXTERN(int) git_rebase_open(git_rebase **out, git_repository *repo);
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Gets the count of rebase operations that are to be applied.
|
153
|
+
*
|
154
|
+
* @param rebase The in-progress rebase
|
155
|
+
* @return The number of rebase operations in total
|
156
|
+
*/
|
157
|
+
GIT_EXTERN(size_t) git_rebase_operation_entrycount(git_rebase *rebase);
|
158
|
+
|
159
|
+
/**
|
160
|
+
* Gets the index of the rebase operation that is currently being applied.
|
161
|
+
*
|
162
|
+
* @param rebase The in-progress rebase
|
163
|
+
* @return The index of the rebase operation currently being applied.
|
164
|
+
*/
|
165
|
+
GIT_EXTERN(size_t) git_rebase_operation_current(git_rebase *rebase);
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Gets the rebase operation specified by the given index.
|
169
|
+
*
|
170
|
+
* @param rebase The in-progress rebase
|
171
|
+
* @param idx The index of the rebase operation to retrieve
|
172
|
+
* @return The rebase operation or NULL if `idx` was out of bounds
|
173
|
+
*/
|
174
|
+
GIT_EXTERN(git_rebase_operation *) git_rebase_operation_byindex(
|
175
|
+
git_rebase *rebase,
|
176
|
+
size_t idx);
|
177
|
+
|
178
|
+
/**
|
179
|
+
* Performs the next rebase operation and returns the information about it.
|
180
|
+
* If the operation is one that applies a patch (which is any operation except
|
181
|
+
* GIT_REBASE_OPERATION_EXEC) then the patch will be applied and the index and
|
182
|
+
* working directory will be updated with the changes. If there are conflicts,
|
183
|
+
* you will need to address those before committing the changes.
|
184
|
+
*
|
185
|
+
* @param out Pointer to store the rebase operation that is to be performed next
|
186
|
+
* @param repo The rebase in progress
|
187
|
+
* @param checkout_opts Options to specify how the patch should be checked out
|
188
|
+
* @return Zero on success; -1 on failure.
|
189
|
+
*/
|
190
|
+
GIT_EXTERN(int) git_rebase_next(
|
191
|
+
git_rebase_operation **operation,
|
192
|
+
git_rebase *rebase,
|
193
|
+
git_checkout_options *checkout_opts);
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Commits the current patch. You must have resolved any conflicts that
|
197
|
+
* were introduced during the patch application from the `git_rebase_next`
|
198
|
+
* invocation.
|
199
|
+
*
|
200
|
+
* @param id Pointer in which to store the OID of the newly created commit
|
201
|
+
* @param repo The rebase that is in-progress
|
202
|
+
* @param author The author of the updated commit, or NULL to keep the
|
203
|
+
* author from the original commit
|
204
|
+
* @param committer The committer of the rebase
|
205
|
+
* @param message_encoding The encoding for the message in the commit,
|
206
|
+
* represented with a standard encoding name. If message is NULL,
|
207
|
+
* this should also be NULL, and the encoding from the original
|
208
|
+
* commit will be maintained. If message is specified, this may be
|
209
|
+
* NULL to indicate that "UTF-8" is to be used.
|
210
|
+
* @param message The message for this commit, or NULL to use the message
|
211
|
+
* from the original commit.
|
212
|
+
* @return Zero on success, GIT_EUNMERGED if there are unmerged changes in
|
213
|
+
* the index, GIT_EAPPLIED if the current commit has already
|
214
|
+
* been applied to the upstream and there is nothing to commit,
|
215
|
+
* -1 on failure.
|
216
|
+
*/
|
217
|
+
GIT_EXTERN(int) git_rebase_commit(
|
218
|
+
git_oid *id,
|
219
|
+
git_rebase *rebase,
|
220
|
+
const git_signature *author,
|
221
|
+
const git_signature *committer,
|
222
|
+
const char *message_encoding,
|
223
|
+
const char *message);
|
224
|
+
|
225
|
+
/**
|
226
|
+
* Aborts a rebase that is currently in progress, resetting the repository
|
227
|
+
* and working directory to their state before rebase began.
|
228
|
+
*
|
229
|
+
* @param rebase The rebase that is in-progress
|
230
|
+
* @param signature The identity that is aborting the rebase
|
231
|
+
* @return Zero on success; GIT_ENOTFOUND if a rebase is not in progress,
|
232
|
+
* -1 on other errors.
|
233
|
+
*/
|
234
|
+
GIT_EXTERN(int) git_rebase_abort(
|
235
|
+
git_rebase *rebase,
|
236
|
+
const git_signature *signature);
|
237
|
+
|
238
|
+
/**
|
239
|
+
* Finishes a rebase that is currently in progress once all patches have
|
240
|
+
* been applied.
|
241
|
+
*
|
242
|
+
* @param rebase The rebase that is in-progress
|
243
|
+
* @param signature The identity that is finishing the rebase (optional)
|
244
|
+
* @param opts Options to specify how rebase is finished
|
245
|
+
* @param Zero on success; -1 on error
|
246
|
+
*/
|
247
|
+
GIT_EXTERN(int) git_rebase_finish(
|
248
|
+
git_rebase *rebase,
|
249
|
+
const git_signature *signature,
|
250
|
+
const git_rebase_options *opts);
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Frees the `git_rebase` object.
|
254
|
+
*
|
255
|
+
* @param rebase The rebase object
|
256
|
+
*/
|
257
|
+
GIT_EXTERN(void) git_rebase_free(git_rebase *rebase);
|
258
|
+
|
259
|
+
/** @} */
|
260
|
+
GIT_END_DECL
|
261
|
+
#endif
|