rugged 0.17.0.b7 → 0.18.0.b1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +88 -32
- data/ext/rugged/extconf.rb +4 -2
- data/ext/rugged/rugged.c +72 -10
- data/ext/rugged/rugged.h +14 -10
- data/ext/rugged/rugged_blob.c +8 -10
- data/ext/rugged/rugged_branch.c +11 -14
- data/ext/rugged/rugged_commit.c +31 -24
- data/ext/rugged/rugged_config.c +2 -2
- data/ext/rugged/rugged_index.c +133 -198
- data/ext/rugged/rugged_note.c +372 -0
- data/ext/rugged/rugged_object.c +50 -22
- data/ext/rugged/rugged_reference.c +122 -130
- data/ext/rugged/rugged_remote.c +72 -29
- data/ext/rugged/rugged_repo.c +402 -20
- data/ext/rugged/rugged_revwalk.c +7 -3
- data/ext/rugged/rugged_settings.c +110 -0
- data/ext/rugged/rugged_signature.c +23 -7
- data/ext/rugged/rugged_tag.c +32 -16
- data/ext/rugged/rugged_tree.c +44 -15
- data/lib/rugged.rb +1 -0
- data/lib/rugged/index.rb +8 -0
- data/lib/rugged/remote.rb +13 -0
- data/lib/rugged/repository.rb +3 -3
- data/lib/rugged/version.rb +1 -1
- data/test/blob_test.rb +13 -15
- data/test/branch_test.rb +32 -67
- data/test/commit_test.rb +50 -12
- data/test/config_test.rb +12 -11
- data/test/coverage/HEAD.json +1 -1
- data/test/coverage/cover.rb +40 -21
- data/test/errors_test.rb +34 -0
- data/test/fixtures/alternate/objects/14/6ae76773c91e3b1d00cf7a338ec55ae58297e2 +0 -0
- data/test/fixtures/alternate/objects/14/9c32d47e99d0a3572ff1e70a2e0051bbf347a9 +0 -0
- data/test/fixtures/alternate/objects/14/fb3108588f9421bf764041e5e3ac305eb6277f +0 -0
- data/test/fixtures/testrepo.git/logs/refs/notes/commits +1 -0
- data/test/fixtures/testrepo.git/objects/44/1034f860c1d5d90e4188d11ae0d325176869a8 +1 -0
- data/test/fixtures/testrepo.git/objects/60/d415052a33de2150bf68757f6461df4f563ae4 +0 -0
- data/test/fixtures/testrepo.git/objects/68/8a8f4ef7496901d15322972f96e212a9e466cc +1 -0
- data/test/fixtures/testrepo.git/objects/94/eca2de348d5f672faf56b0decafa5937e3235e +0 -0
- data/test/fixtures/testrepo.git/objects/9b/7384fe1676186192842f5d3e129457b62db9e3 +0 -0
- data/test/fixtures/testrepo.git/objects/b7/4713326bc972cc15751ed504dca6f6f3b91f7a +3 -0
- data/test/fixtures/testrepo.git/refs/notes/commits +1 -0
- data/test/index_test.rb +65 -69
- data/test/lib_test.rb +76 -11
- data/test/note_test.rb +158 -0
- data/test/object_test.rb +8 -11
- data/test/reference_test.rb +77 -85
- data/test/remote_test.rb +86 -8
- data/test/repo_pack_test.rb +9 -7
- data/test/repo_reset_test.rb +80 -0
- data/test/repo_test.rb +176 -53
- data/test/tag_test.rb +44 -7
- data/test/test_helper.rb +63 -35
- data/test/tree_test.rb +34 -13
- data/test/walker_test.rb +14 -14
- data/vendor/libgit2/Makefile.embed +1 -1
- data/vendor/libgit2/deps/http-parser/http_parser.c +974 -578
- data/vendor/libgit2/deps/http-parser/http_parser.h +106 -70
- data/vendor/libgit2/deps/regex/regcomp.c +7 -6
- data/vendor/libgit2/deps/regex/regex_internal.c +1 -1
- data/vendor/libgit2/deps/regex/regex_internal.h +12 -3
- data/vendor/libgit2/deps/regex/regexec.c +5 -5
- data/vendor/libgit2/include/git2.h +5 -1
- data/vendor/libgit2/include/git2/attr.h +4 -2
- data/vendor/libgit2/include/git2/blob.h +39 -12
- data/vendor/libgit2/include/git2/branch.h +123 -35
- data/vendor/libgit2/include/git2/checkout.h +206 -48
- data/vendor/libgit2/include/git2/clone.h +72 -27
- data/vendor/libgit2/include/git2/commit.h +20 -17
- data/vendor/libgit2/include/git2/common.h +67 -1
- data/vendor/libgit2/include/git2/config.h +81 -60
- data/vendor/libgit2/include/git2/cred_helpers.h +53 -0
- data/vendor/libgit2/include/git2/diff.h +459 -150
- data/vendor/libgit2/include/git2/errors.h +9 -1
- data/vendor/libgit2/include/git2/graph.h +41 -0
- data/vendor/libgit2/include/git2/ignore.h +7 -6
- data/vendor/libgit2/include/git2/index.h +323 -97
- data/vendor/libgit2/include/git2/indexer.h +27 -59
- data/vendor/libgit2/include/git2/inttypes.h +4 -0
- data/vendor/libgit2/include/git2/merge.h +13 -3
- data/vendor/libgit2/include/git2/message.h +14 -8
- data/vendor/libgit2/include/git2/net.h +9 -7
- data/vendor/libgit2/include/git2/notes.h +88 -29
- data/vendor/libgit2/include/git2/object.h +16 -6
- data/vendor/libgit2/include/git2/odb.h +80 -17
- data/vendor/libgit2/include/git2/odb_backend.h +47 -11
- data/vendor/libgit2/include/git2/oid.h +26 -17
- data/vendor/libgit2/include/git2/pack.h +62 -8
- data/vendor/libgit2/include/git2/push.h +131 -0
- data/vendor/libgit2/include/git2/refdb.h +103 -0
- data/vendor/libgit2/include/git2/refdb_backend.h +109 -0
- data/vendor/libgit2/include/git2/reflog.h +30 -21
- data/vendor/libgit2/include/git2/refs.h +215 -193
- data/vendor/libgit2/include/git2/refspec.h +22 -2
- data/vendor/libgit2/include/git2/remote.h +158 -37
- data/vendor/libgit2/include/git2/repository.h +150 -31
- data/vendor/libgit2/include/git2/reset.h +43 -9
- data/vendor/libgit2/include/git2/revparse.h +48 -4
- data/vendor/libgit2/include/git2/revwalk.h +25 -10
- data/vendor/libgit2/include/git2/signature.h +20 -12
- data/vendor/libgit2/include/git2/stash.h +121 -0
- data/vendor/libgit2/include/git2/status.h +122 -53
- data/vendor/libgit2/include/git2/strarray.h +17 -11
- data/vendor/libgit2/include/git2/submodule.h +42 -7
- data/vendor/libgit2/include/git2/tag.h +72 -59
- data/vendor/libgit2/include/git2/threads.h +4 -2
- data/vendor/libgit2/include/git2/trace.h +68 -0
- data/vendor/libgit2/include/git2/transport.h +328 -0
- data/vendor/libgit2/include/git2/tree.h +149 -120
- data/vendor/libgit2/include/git2/types.h +13 -12
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/src/amiga/map.c +2 -2
- data/vendor/libgit2/src/attr.c +58 -48
- data/vendor/libgit2/src/attr.h +4 -18
- data/vendor/libgit2/src/attr_file.c +30 -6
- data/vendor/libgit2/src/attr_file.h +6 -8
- data/vendor/libgit2/src/attrcache.h +24 -0
- data/vendor/libgit2/src/blob.c +30 -7
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +361 -68
- data/vendor/libgit2/src/branch.h +17 -0
- data/vendor/libgit2/src/bswap.h +1 -1
- data/vendor/libgit2/src/buf_text.c +291 -0
- data/vendor/libgit2/src/buf_text.h +122 -0
- data/vendor/libgit2/src/buffer.c +27 -101
- data/vendor/libgit2/src/buffer.h +54 -39
- data/vendor/libgit2/src/cache.c +15 -6
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +3 -1
- data/vendor/libgit2/src/checkout.c +1165 -222
- data/vendor/libgit2/src/checkout.h +24 -0
- data/vendor/libgit2/src/clone.c +171 -86
- data/vendor/libgit2/src/commit.c +44 -45
- data/vendor/libgit2/src/commit.h +3 -3
- data/vendor/libgit2/src/commit_list.c +194 -0
- data/vendor/libgit2/src/commit_list.h +49 -0
- data/vendor/libgit2/src/common.h +44 -10
- data/vendor/libgit2/src/compress.c +1 -1
- data/vendor/libgit2/src/compress.h +1 -1
- data/vendor/libgit2/src/config.c +211 -124
- data/vendor/libgit2/src/config.h +23 -4
- data/vendor/libgit2/src/config_cache.c +2 -2
- data/vendor/libgit2/src/config_file.c +129 -53
- data/vendor/libgit2/src/config_file.h +10 -8
- data/vendor/libgit2/src/crlf.c +66 -67
- data/vendor/libgit2/src/date.c +12 -12
- data/vendor/libgit2/src/delta-apply.c +14 -1
- data/vendor/libgit2/src/delta-apply.h +18 -1
- data/vendor/libgit2/src/delta.c +40 -107
- data/vendor/libgit2/src/delta.h +19 -17
- data/vendor/libgit2/src/diff.c +347 -496
- data/vendor/libgit2/src/diff.h +27 -1
- data/vendor/libgit2/src/diff_output.c +564 -249
- data/vendor/libgit2/src/diff_output.h +15 -8
- data/vendor/libgit2/src/diff_tform.c +687 -0
- data/vendor/libgit2/src/errors.c +27 -36
- data/vendor/libgit2/src/fetch.c +13 -351
- data/vendor/libgit2/src/fetch.h +13 -3
- data/vendor/libgit2/src/fetchhead.c +295 -0
- data/vendor/libgit2/src/fetchhead.h +34 -0
- data/vendor/libgit2/src/filebuf.c +42 -15
- data/vendor/libgit2/src/filebuf.h +4 -2
- data/vendor/libgit2/src/fileops.c +466 -113
- data/vendor/libgit2/src/fileops.h +154 -28
- data/vendor/libgit2/src/filter.c +3 -75
- data/vendor/libgit2/src/filter.h +1 -29
- data/vendor/libgit2/src/fnmatch.c +1 -1
- data/vendor/libgit2/src/fnmatch.h +1 -1
- data/vendor/libgit2/src/global.c +54 -10
- data/vendor/libgit2/src/global.h +10 -1
- data/vendor/libgit2/src/graph.c +178 -0
- data/vendor/libgit2/src/hash.c +25 -52
- data/vendor/libgit2/src/hash.h +21 -9
- data/vendor/libgit2/src/{sha1/sha1.c → hash/hash_generic.c} +20 -12
- data/vendor/libgit2/src/hash/hash_generic.h +24 -0
- data/vendor/libgit2/src/hash/hash_openssl.h +45 -0
- data/vendor/libgit2/src/hash/hash_win32.c +291 -0
- data/vendor/libgit2/src/hash/hash_win32.h +140 -0
- data/vendor/libgit2/src/hashsig.c +368 -0
- data/vendor/libgit2/src/hashsig.h +72 -0
- data/vendor/libgit2/src/ignore.c +22 -15
- data/vendor/libgit2/src/ignore.h +6 -1
- data/vendor/libgit2/src/index.c +770 -171
- data/vendor/libgit2/src/index.h +13 -5
- data/vendor/libgit2/src/indexer.c +286 -431
- data/vendor/libgit2/src/iterator.c +854 -466
- data/vendor/libgit2/src/iterator.h +134 -109
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +296 -0
- data/vendor/libgit2/src/merge.h +22 -0
- data/vendor/libgit2/src/message.c +1 -1
- data/vendor/libgit2/src/message.h +1 -1
- data/vendor/libgit2/src/mwindow.c +35 -30
- data/vendor/libgit2/src/mwindow.h +2 -2
- data/vendor/libgit2/src/netops.c +162 -98
- data/vendor/libgit2/src/netops.h +50 -15
- data/vendor/libgit2/src/notes.c +109 -58
- data/vendor/libgit2/src/notes.h +2 -1
- data/vendor/libgit2/src/object.c +46 -57
- data/vendor/libgit2/src/object.h +1 -8
- data/vendor/libgit2/src/odb.c +151 -40
- data/vendor/libgit2/src/odb.h +5 -1
- data/vendor/libgit2/src/odb_loose.c +4 -5
- data/vendor/libgit2/src/odb_pack.c +122 -80
- data/vendor/libgit2/src/offmap.h +65 -0
- data/vendor/libgit2/src/oid.c +12 -4
- data/vendor/libgit2/src/oidmap.h +1 -1
- data/vendor/libgit2/src/pack-objects.c +88 -61
- data/vendor/libgit2/src/pack-objects.h +8 -8
- data/vendor/libgit2/src/pack.c +293 -28
- data/vendor/libgit2/src/pack.h +49 -4
- data/vendor/libgit2/src/path.c +103 -14
- data/vendor/libgit2/src/path.h +23 -7
- data/vendor/libgit2/src/pathspec.c +168 -0
- data/vendor/libgit2/src/pathspec.h +40 -0
- data/vendor/libgit2/src/pool.c +29 -4
- data/vendor/libgit2/src/pool.h +8 -1
- data/vendor/libgit2/src/posix.c +26 -27
- data/vendor/libgit2/src/posix.h +2 -3
- data/vendor/libgit2/src/pqueue.c +23 -1
- data/vendor/libgit2/src/pqueue.h +23 -1
- data/vendor/libgit2/src/push.c +653 -0
- data/vendor/libgit2/src/push.h +51 -0
- data/vendor/libgit2/src/refdb.c +185 -0
- data/vendor/libgit2/src/refdb.h +46 -0
- data/vendor/libgit2/src/refdb_fs.c +1024 -0
- data/vendor/libgit2/src/refdb_fs.h +15 -0
- data/vendor/libgit2/src/reflog.c +77 -45
- data/vendor/libgit2/src/reflog.h +1 -3
- data/vendor/libgit2/src/refs.c +366 -1326
- data/vendor/libgit2/src/refs.h +22 -13
- data/vendor/libgit2/src/refspec.c +46 -7
- data/vendor/libgit2/src/refspec.h +11 -1
- data/vendor/libgit2/src/remote.c +758 -120
- data/vendor/libgit2/src/remote.h +10 -5
- data/vendor/libgit2/src/repo_template.h +6 -6
- data/vendor/libgit2/src/repository.c +315 -96
- data/vendor/libgit2/src/repository.h +5 -3
- data/vendor/libgit2/src/reset.c +99 -81
- data/vendor/libgit2/src/revparse.c +157 -84
- data/vendor/libgit2/src/revwalk.c +68 -470
- data/vendor/libgit2/src/revwalk.h +44 -0
- data/vendor/libgit2/src/sha1_lookup.c +1 -1
- data/vendor/libgit2/src/sha1_lookup.h +1 -1
- data/vendor/libgit2/src/signature.c +68 -200
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/stash.c +663 -0
- data/vendor/libgit2/src/status.c +101 -79
- data/vendor/libgit2/src/strmap.h +1 -1
- data/vendor/libgit2/src/submodule.c +67 -51
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/tag.c +35 -29
- data/vendor/libgit2/src/tag.h +1 -1
- data/vendor/libgit2/src/thread-utils.c +1 -1
- data/vendor/libgit2/src/thread-utils.h +2 -2
- data/vendor/libgit2/src/trace.c +39 -0
- data/vendor/libgit2/src/trace.h +56 -0
- data/vendor/libgit2/src/transport.c +81 -34
- data/vendor/libgit2/src/transports/cred.c +60 -0
- data/vendor/libgit2/src/transports/cred_helpers.c +49 -0
- data/vendor/libgit2/src/transports/git.c +234 -127
- data/vendor/libgit2/src/transports/http.c +761 -433
- data/vendor/libgit2/src/transports/local.c +460 -64
- data/vendor/libgit2/src/transports/smart.c +345 -0
- data/vendor/libgit2/src/transports/smart.h +179 -0
- data/vendor/libgit2/src/{pkt.c → transports/smart_pkt.c} +131 -12
- data/vendor/libgit2/src/transports/smart_protocol.c +856 -0
- data/vendor/libgit2/src/transports/winhttp.c +1136 -0
- data/vendor/libgit2/src/tree-cache.c +2 -2
- data/vendor/libgit2/src/tree-cache.h +1 -1
- data/vendor/libgit2/src/tree.c +239 -166
- data/vendor/libgit2/src/tree.h +11 -2
- data/vendor/libgit2/src/tsort.c +39 -23
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +12 -2
- data/vendor/libgit2/src/unix/realpath.c +30 -0
- data/vendor/libgit2/src/util.c +250 -13
- data/vendor/libgit2/src/util.h +71 -14
- data/vendor/libgit2/src/vector.c +123 -60
- data/vendor/libgit2/src/vector.h +24 -22
- data/vendor/libgit2/src/win32/dir.c +1 -1
- data/vendor/libgit2/src/win32/dir.h +1 -1
- data/vendor/libgit2/src/win32/error.c +77 -0
- data/vendor/libgit2/src/win32/error.h +13 -0
- data/vendor/libgit2/src/win32/findfile.c +143 -54
- data/vendor/libgit2/src/win32/findfile.h +10 -6
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/mingw-compat.h +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +10 -1
- data/vendor/libgit2/src/win32/posix.h +10 -1
- data/vendor/libgit2/src/win32/posix_w32.c +132 -63
- data/vendor/libgit2/src/win32/precompiled.c +1 -1
- data/vendor/libgit2/src/win32/pthread.c +1 -1
- data/vendor/libgit2/src/win32/pthread.h +1 -1
- data/vendor/libgit2/src/win32/utf-conv.c +5 -5
- data/vendor/libgit2/src/win32/utf-conv.h +3 -3
- data/vendor/libgit2/src/win32/version.h +20 -0
- metadata +308 -252
- data/test/fixtures/testrepo.git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 +0 -0
- data/test/fixtures/testrepo.git/objects/7f/043268ea43ce18e3540acaabf9e090c91965b0 +0 -0
- data/test/fixtures/testrepo.git/objects/a3/e05719b428a2d0ed7a55c4ce53dcc5768c6d5e +0 -0
- data/test/index_test.rb~ +0 -218
- data/vendor/libgit2/src/pkt.h +0 -91
- data/vendor/libgit2/src/ppc/sha1.c +0 -70
- data/vendor/libgit2/src/ppc/sha1.h +0 -26
- data/vendor/libgit2/src/protocol.c +0 -110
- data/vendor/libgit2/src/protocol.h +0 -21
- data/vendor/libgit2/src/sha1.h +0 -33
- data/vendor/libgit2/src/transport.h +0 -148
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C)
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -28,6 +28,10 @@ enum {
|
|
28
28
|
GIT_EUSER = -7,
|
29
29
|
GIT_EBAREREPO = -8,
|
30
30
|
GIT_EORPHANEDHEAD = -9,
|
31
|
+
GIT_EUNMERGED = -10,
|
32
|
+
GIT_ENONFASTFORWARD = -11,
|
33
|
+
GIT_EINVALIDSPEC = -12,
|
34
|
+
GIT_EMERGECONFLICT = -13,
|
31
35
|
|
32
36
|
GIT_PASSTHROUGH = -30,
|
33
37
|
GIT_ITEROVER = -31,
|
@@ -58,6 +62,10 @@ typedef enum {
|
|
58
62
|
GITERR_SSL,
|
59
63
|
GITERR_SUBMODULE,
|
60
64
|
GITERR_THREAD,
|
65
|
+
GITERR_STASH,
|
66
|
+
GITERR_CHECKOUT,
|
67
|
+
GITERR_FETCHHEAD,
|
68
|
+
GITERR_MERGE,
|
61
69
|
} git_error_t;
|
62
70
|
|
63
71
|
/**
|
@@ -0,0 +1,41 @@
|
|
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_graph_h__
|
8
|
+
#define INCLUDE_git_graph_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "types.h"
|
12
|
+
#include "oid.h"
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @file git2/graph.h
|
16
|
+
* @brief Git graph traversal routines
|
17
|
+
* @defgroup git_revwalk Git graph traversal routines
|
18
|
+
* @ingroup Git
|
19
|
+
* @{
|
20
|
+
*/
|
21
|
+
GIT_BEGIN_DECL
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Count the number of unique commits between two commit objects
|
25
|
+
*
|
26
|
+
* There is no need for branches containing the commits to have any
|
27
|
+
* upstream relationship, but it helps to think of one as a branch and
|
28
|
+
* the other as its upstream, the `ahead` and `behind` values will be
|
29
|
+
* what git would report for the branches.
|
30
|
+
*
|
31
|
+
* @param ahead number of unique from commits in `upstream`
|
32
|
+
* @param behind number of unique from commits in `local`
|
33
|
+
* @param repo the repository where the commits exist
|
34
|
+
* @param local the commit for local
|
35
|
+
* @param upstream the commit for upstream
|
36
|
+
*/
|
37
|
+
GIT_EXTERN(int) git_graph_ahead_behind(size_t *ahead, size_t *behind, git_repository *repo, const git_oid *local, const git_oid *upstream);
|
38
|
+
|
39
|
+
/** @} */
|
40
|
+
GIT_END_DECL
|
41
|
+
#endif
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C)
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -24,7 +24,7 @@ GIT_BEGIN_DECL
|
|
24
24
|
*
|
25
25
|
* Example usage:
|
26
26
|
*
|
27
|
-
* error =
|
27
|
+
* error = git_ignore_add_rule(myrepo, "*.c\ndir/\nFile with space\n");
|
28
28
|
*
|
29
29
|
* This would add three rules to the ignores.
|
30
30
|
*
|
@@ -41,9 +41,10 @@ GIT_EXTERN(int) git_ignore_add_rule(
|
|
41
41
|
/**
|
42
42
|
* Clear ignore rules that were explicitly added.
|
43
43
|
*
|
44
|
-
*
|
45
|
-
*
|
46
|
-
*
|
44
|
+
* Resets to the default internal ignore rules. This will not turn off
|
45
|
+
* rules in .gitignore files that actually exist in the filesystem.
|
46
|
+
*
|
47
|
+
* The default internal ignores ignore ".", ".." and ".git" entries.
|
47
48
|
*
|
48
49
|
* @param repo The repository to remove ignore rules from.
|
49
50
|
* @return 0 on success
|
@@ -56,7 +57,7 @@ GIT_EXTERN(int) git_ignore_clear_internal_rules(
|
|
56
57
|
*
|
57
58
|
* This function checks the ignore rules to see if they would apply to the
|
58
59
|
* given file. This indicates if the file would be ignored regardless of
|
59
|
-
* whether the file is already in the index or
|
60
|
+
* whether the file is already in the index or committed to the repository.
|
60
61
|
*
|
61
62
|
* One way to think of this is if you were to do "git add ." on the
|
62
63
|
* directory containing the file, would it be added or not?
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C)
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -21,10 +21,10 @@
|
|
21
21
|
*/
|
22
22
|
GIT_BEGIN_DECL
|
23
23
|
|
24
|
-
#define GIT_IDXENTRY_NAMEMASK
|
24
|
+
#define GIT_IDXENTRY_NAMEMASK (0x0fff)
|
25
25
|
#define GIT_IDXENTRY_STAGEMASK (0x3000)
|
26
|
-
#define GIT_IDXENTRY_EXTENDED
|
27
|
-
#define GIT_IDXENTRY_VALID
|
26
|
+
#define GIT_IDXENTRY_EXTENDED (0x4000)
|
27
|
+
#define GIT_IDXENTRY_VALID (0x8000)
|
28
28
|
#define GIT_IDXENTRY_STAGESHIFT 12
|
29
29
|
|
30
30
|
/*
|
@@ -34,26 +34,26 @@ GIT_BEGIN_DECL
|
|
34
34
|
*
|
35
35
|
* In-memory only flags:
|
36
36
|
*/
|
37
|
-
#define GIT_IDXENTRY_UPDATE
|
38
|
-
#define GIT_IDXENTRY_REMOVE
|
39
|
-
#define GIT_IDXENTRY_UPTODATE
|
40
|
-
#define GIT_IDXENTRY_ADDED
|
37
|
+
#define GIT_IDXENTRY_UPDATE (1 << 0)
|
38
|
+
#define GIT_IDXENTRY_REMOVE (1 << 1)
|
39
|
+
#define GIT_IDXENTRY_UPTODATE (1 << 2)
|
40
|
+
#define GIT_IDXENTRY_ADDED (1 << 3)
|
41
41
|
|
42
|
-
#define GIT_IDXENTRY_HASHED
|
43
|
-
#define GIT_IDXENTRY_UNHASHED
|
44
|
-
#define GIT_IDXENTRY_WT_REMOVE
|
45
|
-
#define GIT_IDXENTRY_CONFLICTED
|
42
|
+
#define GIT_IDXENTRY_HASHED (1 << 4)
|
43
|
+
#define GIT_IDXENTRY_UNHASHED (1 << 5)
|
44
|
+
#define GIT_IDXENTRY_WT_REMOVE (1 << 6) /* remove in work directory */
|
45
|
+
#define GIT_IDXENTRY_CONFLICTED (1 << 7)
|
46
46
|
|
47
|
-
#define GIT_IDXENTRY_UNPACKED
|
47
|
+
#define GIT_IDXENTRY_UNPACKED (1 << 8)
|
48
48
|
#define GIT_IDXENTRY_NEW_SKIP_WORKTREE (1 << 9)
|
49
49
|
|
50
50
|
/*
|
51
51
|
* Extended on-disk flags:
|
52
52
|
*/
|
53
|
-
#define GIT_IDXENTRY_INTENT_TO_ADD
|
54
|
-
#define GIT_IDXENTRY_SKIP_WORKTREE
|
53
|
+
#define GIT_IDXENTRY_INTENT_TO_ADD (1 << 13)
|
54
|
+
#define GIT_IDXENTRY_SKIP_WORKTREE (1 << 14)
|
55
55
|
/* GIT_IDXENTRY_EXTENDED2 is for future extension */
|
56
|
-
#define GIT_IDXENTRY_EXTENDED2
|
56
|
+
#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
|
57
57
|
|
58
58
|
#define GIT_IDXENTRY_EXTENDED_FLAGS (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE)
|
59
59
|
|
@@ -84,12 +84,12 @@ typedef struct git_index_entry {
|
|
84
84
|
char *path;
|
85
85
|
} git_index_entry;
|
86
86
|
|
87
|
-
/** Representation of
|
88
|
-
typedef struct
|
87
|
+
/** Representation of a resolve undo entry in the index. */
|
88
|
+
typedef struct git_index_reuc_entry {
|
89
89
|
unsigned int mode[3];
|
90
90
|
git_oid oid[3];
|
91
91
|
char *path;
|
92
|
-
}
|
92
|
+
} git_index_reuc_entry;
|
93
93
|
|
94
94
|
/** Capabilities of system that affect index actions. */
|
95
95
|
enum {
|
@@ -99,6 +99,12 @@ enum {
|
|
99
99
|
GIT_INDEXCAP_FROM_OWNER = ~0u
|
100
100
|
};
|
101
101
|
|
102
|
+
/** @name Index File Functions
|
103
|
+
*
|
104
|
+
* These functions work on the index file itself.
|
105
|
+
*/
|
106
|
+
/**@{*/
|
107
|
+
|
102
108
|
/**
|
103
109
|
* Create a new bare Git index object as a memory representation
|
104
110
|
* of the Git index file in 'index_path', without a repository
|
@@ -113,20 +119,24 @@ enum {
|
|
113
119
|
*
|
114
120
|
* The index must be freed once it's no longer in use.
|
115
121
|
*
|
116
|
-
* @param
|
122
|
+
* @param out the pointer for the new index
|
117
123
|
* @param index_path the path to the index file in disk
|
118
124
|
* @return 0 or an error code
|
119
125
|
*/
|
120
|
-
GIT_EXTERN(int) git_index_open(git_index **
|
126
|
+
GIT_EXTERN(int) git_index_open(git_index **out, const char *index_path);
|
121
127
|
|
122
128
|
/**
|
123
|
-
*
|
124
|
-
* This clears the index object in memory; changes must be manually
|
125
|
-
* written to disk for them to take effect.
|
129
|
+
* Create an in-memory index object.
|
126
130
|
*
|
127
|
-
*
|
131
|
+
* This index object cannot be read/written to the filesystem,
|
132
|
+
* but may be used to perform in-memory index operations.
|
133
|
+
*
|
134
|
+
* The index must be freed once it's no longer in use.
|
135
|
+
*
|
136
|
+
* @param out the pointer for the new index
|
137
|
+
* @return 0 or an error code
|
128
138
|
*/
|
129
|
-
GIT_EXTERN(
|
139
|
+
GIT_EXTERN(int) git_index_new(git_index **out);
|
130
140
|
|
131
141
|
/**
|
132
142
|
* Free an existing index object.
|
@@ -135,6 +145,14 @@ GIT_EXTERN(void) git_index_clear(git_index *index);
|
|
135
145
|
*/
|
136
146
|
GIT_EXTERN(void) git_index_free(git_index *index);
|
137
147
|
|
148
|
+
/**
|
149
|
+
* Get the repository this index relates to
|
150
|
+
*
|
151
|
+
* @param index The index
|
152
|
+
* @return A pointer to the repository
|
153
|
+
*/
|
154
|
+
GIT_EXTERN(git_repository *) git_index_owner(const git_index *index);
|
155
|
+
|
138
156
|
/**
|
139
157
|
* Read index capabilities flags.
|
140
158
|
*
|
@@ -175,44 +193,143 @@ GIT_EXTERN(int) git_index_read(git_index *index);
|
|
175
193
|
GIT_EXTERN(int) git_index_write(git_index *index);
|
176
194
|
|
177
195
|
/**
|
178
|
-
*
|
179
|
-
*
|
196
|
+
* Read a tree into the index file with stats
|
197
|
+
*
|
198
|
+
* The current index contents will be replaced by the specified tree.
|
180
199
|
*
|
181
200
|
* @param index an existing index object
|
182
|
-
* @param
|
183
|
-
* @return
|
201
|
+
* @param tree tree to read
|
202
|
+
* @return 0 or an error code
|
184
203
|
*/
|
185
|
-
GIT_EXTERN(int)
|
204
|
+
GIT_EXTERN(int) git_index_read_tree(git_index *index, const git_tree *tree);
|
186
205
|
|
187
206
|
/**
|
188
|
-
*
|
207
|
+
* Write the index as a tree
|
208
|
+
*
|
209
|
+
* This method will scan the index and write a representation
|
210
|
+
* of its current state back to disk; it recursively creates
|
211
|
+
* tree objects for each of the subtrees stored in the index,
|
212
|
+
* but only returns the OID of the root tree. This is the OID
|
213
|
+
* that can be used e.g. to create a commit.
|
214
|
+
*
|
215
|
+
* The index instance cannot be bare, and needs to be associated
|
216
|
+
* to an existing repository.
|
217
|
+
*
|
218
|
+
* The index must not contain any file in conflict.
|
219
|
+
*
|
220
|
+
* @param out Pointer where to store the OID of the written tree
|
221
|
+
* @param index Index to write
|
222
|
+
* @return 0 on success, GIT_EUNMERGED when the index is not clean
|
223
|
+
* or an error code
|
224
|
+
*/
|
225
|
+
GIT_EXTERN(int) git_index_write_tree(git_oid *out, git_index *index);
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Write the index as a tree to the given repository
|
229
|
+
*
|
230
|
+
* This method will do the same as `git_index_write_tree`, but
|
231
|
+
* letting the user choose the repository where the tree will
|
232
|
+
* be written.
|
233
|
+
*
|
234
|
+
* The index must not contain any file in conflict.
|
235
|
+
*
|
236
|
+
* @param out Pointer where to store OID of the the written tree
|
237
|
+
* @param index Index to write
|
238
|
+
* @param repo Repository where to write the tree
|
239
|
+
* @return 0 on success, GIT_EUNMERGED when the index is not clean
|
240
|
+
* or an error code
|
241
|
+
*/
|
242
|
+
GIT_EXTERN(int) git_index_write_tree_to(git_oid *out, git_index *index, git_repository *repo);
|
243
|
+
|
244
|
+
/**@}*/
|
245
|
+
|
246
|
+
/** @name Raw Index Entry Functions
|
247
|
+
*
|
248
|
+
* These functions work on index entries, and allow for raw manipulation
|
249
|
+
* of the entries.
|
250
|
+
*/
|
251
|
+
/**@{*/
|
252
|
+
|
253
|
+
/* Index entry manipulation */
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Get the count of entries currently in the index
|
189
257
|
*
|
190
258
|
* @param index an existing index object
|
259
|
+
* @return integer of count of current entries
|
191
260
|
*/
|
192
|
-
GIT_EXTERN(
|
261
|
+
GIT_EXTERN(size_t) git_index_entrycount(const git_index *index);
|
193
262
|
|
194
263
|
/**
|
195
|
-
*
|
264
|
+
* Clear the contents (all the entries) of an index object.
|
265
|
+
* This clears the index object in memory; changes must be manually
|
266
|
+
* written to disk for them to take effect.
|
196
267
|
*
|
197
|
-
*
|
198
|
-
|
268
|
+
* @param index an existing index object
|
269
|
+
*/
|
270
|
+
GIT_EXTERN(void) git_index_clear(git_index *index);
|
271
|
+
|
272
|
+
/**
|
273
|
+
* Get a pointer to one of the entries in the index
|
199
274
|
*
|
200
|
-
*
|
275
|
+
* The values of this entry can be modified (except the path)
|
276
|
+
* and the changes will be written back to disk on the next
|
277
|
+
* write() call.
|
201
278
|
*
|
202
|
-
*
|
203
|
-
* at gitignore rules. Those rules can be evaluated through
|
204
|
-
* the git_status APIs (in status.h) before calling this.
|
279
|
+
* The entry should not be freed by the caller.
|
205
280
|
*
|
206
281
|
* @param index an existing index object
|
207
|
-
* @param
|
208
|
-
* @
|
282
|
+
* @param n the position of the entry
|
283
|
+
* @return a pointer to the entry; NULL if out of bounds
|
284
|
+
*/
|
285
|
+
GIT_EXTERN(const git_index_entry *) git_index_get_byindex(
|
286
|
+
git_index *index, size_t n);
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Get a pointer to one of the entries in the index
|
290
|
+
*
|
291
|
+
* The values of this entry can be modified (except the path)
|
292
|
+
* and the changes will be written back to disk on the next
|
293
|
+
* write() call.
|
294
|
+
*
|
295
|
+
* The entry should not be freed by the caller.
|
296
|
+
*
|
297
|
+
* @param index an existing index object
|
298
|
+
* @param path path to search
|
299
|
+
* @param stage stage to search
|
300
|
+
* @return a pointer to the entry; NULL if it was not found
|
301
|
+
*/
|
302
|
+
GIT_EXTERN(const git_index_entry *) git_index_get_bypath(
|
303
|
+
git_index *index, const char *path, int stage);
|
304
|
+
|
305
|
+
/**
|
306
|
+
* Remove an entry from the index
|
307
|
+
*
|
308
|
+
* @param index an existing index object
|
309
|
+
* @param path path to search
|
310
|
+
* @param stage stage to search
|
311
|
+
* @return 0 or an error code
|
312
|
+
*/
|
313
|
+
GIT_EXTERN(int) git_index_remove(git_index *index, const char *path, int stage);
|
314
|
+
|
315
|
+
/**
|
316
|
+
* Remove all entries from the index under a given directory
|
317
|
+
*
|
318
|
+
* @param index an existing index object
|
319
|
+
* @param dir container directory path
|
320
|
+
* @param stage stage to search
|
209
321
|
* @return 0 or an error code
|
210
322
|
*/
|
211
|
-
GIT_EXTERN(int)
|
323
|
+
GIT_EXTERN(int) git_index_remove_directory(
|
324
|
+
git_index *index, const char *dir, int stage);
|
212
325
|
|
213
326
|
/**
|
214
327
|
* Add or update an index entry from an in-memory struct
|
215
328
|
*
|
329
|
+
* If a previous index entry exists that has the same path and stage
|
330
|
+
* as the given 'source_entry', it will be replaced. Otherwise, the
|
331
|
+
* 'source_entry' will be added.
|
332
|
+
*
|
216
333
|
* A full copy (including the 'path' string) of the given
|
217
334
|
* 'source_entry' will be inserted on the index.
|
218
335
|
*
|
@@ -220,133 +337,242 @@ GIT_EXTERN(int) git_index_add(git_index *index, const char *path, int stage);
|
|
220
337
|
* @param source_entry new entry object
|
221
338
|
* @return 0 or an error code
|
222
339
|
*/
|
223
|
-
GIT_EXTERN(int)
|
340
|
+
GIT_EXTERN(int) git_index_add(git_index *index, const git_index_entry *source_entry);
|
224
341
|
|
225
342
|
/**
|
226
|
-
*
|
343
|
+
* Return the stage number from a git index entry
|
344
|
+
*
|
345
|
+
* This entry is calculated from the entry's flag
|
346
|
+
* attribute like this:
|
227
347
|
*
|
228
|
-
*
|
229
|
-
*
|
230
|
-
*
|
348
|
+
* (entry->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT
|
349
|
+
*
|
350
|
+
* @param entry The entry
|
351
|
+
* @returns the stage number
|
352
|
+
*/
|
353
|
+
GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
|
354
|
+
|
355
|
+
/**@}*/
|
356
|
+
|
357
|
+
/** @name Workdir Index Entry Functions
|
358
|
+
*
|
359
|
+
* These functions work on index entries specifically in the working
|
360
|
+
* directory (ie, stage 0).
|
361
|
+
*/
|
362
|
+
/**@{*/
|
363
|
+
|
364
|
+
/**
|
365
|
+
* Add or update an index entry from a file on disk
|
231
366
|
*
|
232
367
|
* The file `path` must be relative to the repository's
|
233
368
|
* working folder and must be readable.
|
234
369
|
*
|
235
370
|
* This method will fail in bare index instances.
|
236
371
|
*
|
372
|
+
* This forces the file to be added to the index, not looking
|
373
|
+
* at gitignore rules. Those rules can be evaluated through
|
374
|
+
* the git_status APIs (in status.h) before calling this.
|
375
|
+
*
|
376
|
+
* If this file currently is the result of a merge conflict, this
|
377
|
+
* file will no longer be marked as conflicting. The data about
|
378
|
+
* the conflict will be moved to the "resolve undo" (REUC) section.
|
379
|
+
*
|
237
380
|
* @param index an existing index object
|
238
381
|
* @param path filename to add
|
239
|
-
* @param stage stage for the entry
|
240
382
|
* @return 0 or an error code
|
241
383
|
*/
|
242
|
-
GIT_EXTERN(int)
|
384
|
+
GIT_EXTERN(int) git_index_add_bypath(git_index *index, const char *path);
|
243
385
|
|
244
386
|
/**
|
245
|
-
*
|
387
|
+
* Remove an index entry corresponding to a file on disk
|
246
388
|
*
|
247
|
-
*
|
248
|
-
*
|
249
|
-
* in the `entry` struct, the old entry will **not** be
|
250
|
-
* replaced.
|
389
|
+
* The file `path` must be relative to the repository's
|
390
|
+
* working folder. It may exist.
|
251
391
|
*
|
252
|
-
*
|
253
|
-
*
|
392
|
+
* If this file currently is the result of a merge conflict, this
|
393
|
+
* file will no longer be marked as conflicting. The data about
|
394
|
+
* the conflict will be moved to the "resolve undo" (REUC) section.
|
254
395
|
*
|
255
396
|
* @param index an existing index object
|
256
|
-
* @param
|
397
|
+
* @param path filename to remove
|
257
398
|
* @return 0 or an error code
|
258
399
|
*/
|
259
|
-
GIT_EXTERN(int)
|
400
|
+
GIT_EXTERN(int) git_index_remove_bypath(git_index *index, const char *path);
|
260
401
|
|
261
402
|
/**
|
262
|
-
*
|
403
|
+
* Find the first position of any entries which point to given
|
404
|
+
* path in the Git index.
|
263
405
|
*
|
406
|
+
* @param at_pos the address to which the position of the index entry is written (optional)
|
264
407
|
* @param index an existing index object
|
265
|
-
* @param
|
266
|
-
* @return
|
408
|
+
* @param path path to search
|
409
|
+
* @return a zero-based position in the index if found;
|
410
|
+
* GIT_ENOTFOUND otherwise
|
267
411
|
*/
|
268
|
-
GIT_EXTERN(int)
|
412
|
+
GIT_EXTERN(int) git_index_find(size_t *at_pos, git_index *index, const char *path);
|
413
|
+
|
414
|
+
/**@}*/
|
269
415
|
|
416
|
+
/** @name Conflict Index Entry Functions
|
417
|
+
*
|
418
|
+
* These functions work on conflict index entries specifically (ie, stages 1-3)
|
419
|
+
*/
|
420
|
+
/**@{*/
|
270
421
|
|
271
422
|
/**
|
272
|
-
*
|
423
|
+
* Add or update index entries to represent a conflict
|
273
424
|
*
|
274
|
-
*
|
275
|
-
*
|
425
|
+
* The entries are the entries from the tree included in the merge. Any
|
426
|
+
* entry may be null to indicate that that file was not present in the
|
427
|
+
* trees during the merge. For example, ancestor_entry may be NULL to
|
428
|
+
* indicate that a file was added in both branches and must be resolved.
|
276
429
|
*
|
277
|
-
*
|
430
|
+
* @param index an existing index object
|
431
|
+
* @param ancestor_entry the entry data for the ancestor of the conflict
|
432
|
+
* @param our_entry the entry data for our side of the merge conflict
|
433
|
+
* @param their_entry the entry data for their side of the merge conflict
|
434
|
+
* @return 0 or an error code
|
435
|
+
*/
|
436
|
+
GIT_EXTERN(int) git_index_conflict_add(
|
437
|
+
git_index *index,
|
438
|
+
const git_index_entry *ancestor_entry,
|
439
|
+
const git_index_entry *our_entry,
|
440
|
+
const git_index_entry *their_entry);
|
441
|
+
|
442
|
+
/**
|
443
|
+
* Get the index entries that represent a conflict of a single file.
|
444
|
+
*
|
445
|
+
* The values of this entry can be modified (except the paths)
|
446
|
+
* and the changes will be written back to disk on the next
|
447
|
+
* write() call.
|
278
448
|
*
|
449
|
+
* @param ancestor_out Pointer to store the ancestor entry
|
450
|
+
* @param our_out Pointer to store the our entry
|
451
|
+
* @param their_out Pointer to store the their entry
|
279
452
|
* @param index an existing index object
|
280
|
-
* @param
|
281
|
-
* @return a pointer to the entry; NULL if out of bounds
|
453
|
+
* @param path path to search
|
282
454
|
*/
|
283
|
-
GIT_EXTERN(git_index_entry
|
455
|
+
GIT_EXTERN(int) git_index_conflict_get(git_index_entry **ancestor_out, git_index_entry **our_out, git_index_entry **their_out, git_index *index, const char *path);
|
284
456
|
|
285
457
|
/**
|
286
|
-
*
|
458
|
+
* Removes the index entries that represent a conflict of a single file.
|
287
459
|
*
|
288
460
|
* @param index an existing index object
|
289
|
-
* @
|
461
|
+
* @param path to search
|
462
|
+
*/
|
463
|
+
GIT_EXTERN(int) git_index_conflict_remove(git_index *index, const char *path);
|
464
|
+
|
465
|
+
/**
|
466
|
+
* Remove all conflicts in the index (entries with a stage greater than 0.)
|
467
|
+
*
|
468
|
+
* @param index an existing index object
|
469
|
+
*/
|
470
|
+
GIT_EXTERN(void) git_index_conflict_cleanup(git_index *index);
|
471
|
+
|
472
|
+
/**
|
473
|
+
* Determine if the index contains entries representing file conflicts.
|
474
|
+
*
|
475
|
+
* @return 1 if at least one conflict is found, 0 otherwise.
|
476
|
+
*/
|
477
|
+
GIT_EXTERN(int) git_index_has_conflicts(const git_index *index);
|
478
|
+
|
479
|
+
/**@}*/
|
480
|
+
|
481
|
+
/** @name Resolve Undo (REUC) index entry manipulation.
|
482
|
+
*
|
483
|
+
* These functions work on the Resolve Undo index extension and contains
|
484
|
+
* data about the original files that led to a merge conflict.
|
485
|
+
*/
|
486
|
+
/**@{*/
|
487
|
+
|
488
|
+
/**
|
489
|
+
* Get the count of resolve undo entries currently in the index.
|
490
|
+
*
|
491
|
+
* @param index an existing index object
|
492
|
+
* @return integer of count of current resolve undo entries
|
290
493
|
*/
|
291
|
-
GIT_EXTERN(unsigned int)
|
494
|
+
GIT_EXTERN(unsigned int) git_index_reuc_entrycount(git_index *index);
|
292
495
|
|
293
496
|
/**
|
294
|
-
*
|
497
|
+
* Finds the resolve undo entry that points to the given path in the Git
|
498
|
+
* index.
|
295
499
|
*
|
500
|
+
* @param at_pos the address to which the position of the reuc entry is written (optional)
|
296
501
|
* @param index an existing index object
|
297
|
-
* @
|
502
|
+
* @param path path to search
|
503
|
+
* @return 0 if found, < 0 otherwise (GIT_ENOTFOUND)
|
298
504
|
*/
|
299
|
-
GIT_EXTERN(
|
505
|
+
GIT_EXTERN(int) git_index_reuc_find(size_t *at_pos, git_index *index, const char *path);
|
300
506
|
|
301
507
|
/**
|
302
|
-
* Get
|
508
|
+
* Get a resolve undo entry from the index.
|
303
509
|
*
|
304
510
|
* The returned entry is read-only and should not be modified
|
305
|
-
*
|
511
|
+
* or freed by the caller.
|
306
512
|
*
|
307
513
|
* @param index an existing index object
|
308
514
|
* @param path path to search
|
309
|
-
* @return the
|
515
|
+
* @return the resolve undo entry; NULL if not found
|
310
516
|
*/
|
311
|
-
GIT_EXTERN(const
|
517
|
+
GIT_EXTERN(const git_index_reuc_entry *) git_index_reuc_get_bypath(git_index *index, const char *path);
|
312
518
|
|
313
519
|
/**
|
314
|
-
* Get
|
520
|
+
* Get a resolve undo entry from the index.
|
315
521
|
*
|
316
522
|
* The returned entry is read-only and should not be modified
|
317
|
-
*
|
523
|
+
* or freed by the caller.
|
318
524
|
*
|
319
525
|
* @param index an existing index object
|
320
526
|
* @param n the position of the entry
|
321
|
-
* @return a pointer to the
|
527
|
+
* @return a pointer to the resolve undo entry; NULL if out of bounds
|
322
528
|
*/
|
323
|
-
GIT_EXTERN(const
|
529
|
+
GIT_EXTERN(const git_index_reuc_entry *) git_index_reuc_get_byindex(git_index *index, size_t n);
|
324
530
|
|
325
531
|
/**
|
326
|
-
*
|
532
|
+
* Adds a resolve undo entry for a file based on the given parameters.
|
327
533
|
*
|
328
|
-
*
|
329
|
-
*
|
534
|
+
* The resolve undo entry contains the OIDs of files that were involved
|
535
|
+
* in a merge conflict after the conflict has been resolved. This allows
|
536
|
+
* conflicts to be re-resolved later.
|
330
537
|
*
|
331
|
-
*
|
538
|
+
* If there exists a resolve undo entry for the given path in the index,
|
539
|
+
* it will be removed.
|
332
540
|
*
|
333
|
-
*
|
334
|
-
*
|
541
|
+
* This method will fail in bare index instances.
|
542
|
+
*
|
543
|
+
* @param index an existing index object
|
544
|
+
* @param path filename to add
|
545
|
+
* @param ancestor_mode mode of the ancestor file
|
546
|
+
* @param ancestor_id oid of the ancestor file
|
547
|
+
* @param our_mode mode of our file
|
548
|
+
* @param our_id oid of our file
|
549
|
+
* @param their_mode mode of their file
|
550
|
+
* @param their_id oid of their file
|
551
|
+
* @return 0 or an error code
|
335
552
|
*/
|
336
|
-
GIT_EXTERN(int)
|
553
|
+
GIT_EXTERN(int) git_index_reuc_add(git_index *index, const char *path,
|
554
|
+
int ancestor_mode, git_oid *ancestor_id,
|
555
|
+
int our_mode, git_oid *our_id,
|
556
|
+
int their_mode, git_oid *their_id);
|
337
557
|
|
338
558
|
/**
|
339
|
-
*
|
559
|
+
* Remove an resolve undo entry from the index
|
340
560
|
*
|
341
|
-
*
|
342
|
-
*
|
561
|
+
* @param index an existing index object
|
562
|
+
* @param n position of the resolve undo entry to remove
|
563
|
+
* @return 0 or an error code
|
564
|
+
*/
|
565
|
+
GIT_EXTERN(int) git_index_reuc_remove(git_index *index, size_t n);
|
566
|
+
|
567
|
+
/**
|
568
|
+
* Remove all resolve undo entries from the index
|
343
569
|
*
|
344
570
|
* @param index an existing index object
|
345
|
-
* @param tree tree to read
|
346
|
-
* @param stats structure that receives the total node count (may be NULL)
|
347
571
|
* @return 0 or an error code
|
348
572
|
*/
|
349
|
-
GIT_EXTERN(
|
573
|
+
GIT_EXTERN(void) git_index_reuc_clear(git_index *index);
|
574
|
+
|
575
|
+
/**@}*/
|
350
576
|
|
351
577
|
/** @} */
|
352
578
|
GIT_END_DECL
|