rugged 0.18.0.gh.de28323 → 0.19.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -4
- data/Rakefile +1 -1
- data/ext/rugged/extconf.rb +10 -0
- data/ext/rugged/rugged.c +153 -86
- data/ext/rugged/rugged.h +44 -33
- data/ext/rugged/rugged_blob.c +288 -60
- data/ext/rugged/rugged_branch.c +82 -57
- data/ext/rugged/rugged_commit.c +83 -86
- data/ext/rugged/rugged_config.c +68 -68
- data/ext/rugged/rugged_diff.c +509 -0
- data/ext/rugged/rugged_diff_delta.c +94 -0
- data/ext/rugged/rugged_diff_hunk.c +100 -0
- data/ext/rugged/rugged_diff_line.c +79 -0
- data/ext/rugged/rugged_diff_patch.c +169 -0
- data/ext/rugged/rugged_index.c +539 -8
- data/ext/rugged/rugged_note.c +74 -80
- data/ext/rugged/rugged_object.c +63 -8
- data/ext/rugged/rugged_reference.c +231 -145
- data/ext/rugged/rugged_remote.c +509 -53
- data/ext/rugged/rugged_repo.c +572 -236
- data/ext/rugged/rugged_revwalk.c +59 -36
- data/ext/rugged/rugged_settings.c +7 -9
- data/ext/rugged/rugged_signature.c +7 -11
- data/ext/rugged/rugged_tag.c +93 -39
- data/ext/rugged/rugged_tree.c +321 -58
- data/lib/rugged.rb +1 -0
- data/lib/rugged/commit.rb +16 -1
- data/lib/rugged/console.rb +9 -0
- data/lib/rugged/diff.rb +19 -0
- data/lib/rugged/diff/delta.rb +54 -0
- data/lib/rugged/diff/hunk.rb +23 -0
- data/lib/rugged/diff/line.rb +29 -0
- data/lib/rugged/diff/patch.rb +28 -0
- data/lib/rugged/repository.rb +36 -39
- data/lib/rugged/version.rb +1 -1
- data/test/blob_test.rb +308 -1
- data/test/branch_test.rb +7 -0
- data/test/commit_test.rb +7 -10
- data/test/coverage/cover.rb +9 -1
- data/test/diff_test.rb +777 -0
- data/test/fixtures/archive.tar.gz +0 -0
- data/test/fixtures/attr/attr0 +1 -0
- data/test/fixtures/attr/attr1 +29 -0
- data/test/fixtures/attr/attr2 +21 -0
- data/test/fixtures/attr/attr3 +4 -0
- data/test/fixtures/attr/binfile +1 -0
- data/test/fixtures/attr/dir/file +0 -0
- data/test/fixtures/attr/file +1 -0
- data/test/fixtures/attr/gitattributes +29 -0
- data/test/fixtures/attr/gitignore +2 -0
- data/test/fixtures/attr/ign +1 -0
- data/test/fixtures/attr/macro_bad +1 -0
- data/test/fixtures/attr/macro_test +1 -0
- data/test/fixtures/attr/root_test1 +1 -0
- data/test/fixtures/attr/root_test2 +6 -0
- data/test/fixtures/attr/root_test3 +19 -0
- data/test/fixtures/attr/root_test4.txt +14 -0
- data/test/fixtures/attr/sub/abc +37 -0
- data/test/fixtures/attr/sub/dir/file +0 -0
- data/test/fixtures/attr/sub/file +1 -0
- data/test/fixtures/attr/sub/ign/file +1 -0
- data/test/fixtures/attr/sub/ign/sub/file +1 -0
- data/test/fixtures/attr/sub/sub/dir +0 -0
- data/test/fixtures/attr/sub/sub/file +1 -0
- data/test/fixtures/attr/sub/sub/subsub.txt +1 -0
- data/test/fixtures/attr/sub/subdir_test1 +2 -0
- data/test/fixtures/attr/sub/subdir_test2.txt +1 -0
- data/test/fixtures/diff/another.txt +38 -0
- data/test/fixtures/diff/readme.txt +36 -0
- data/test/fixtures/mergedrepo/conflicts-one.txt +5 -0
- data/test/fixtures/mergedrepo/conflicts-two.txt +5 -0
- data/test/fixtures/mergedrepo/one.txt +10 -0
- data/test/fixtures/mergedrepo/two.txt +12 -0
- data/test/fixtures/status/current_file +1 -0
- data/test/fixtures/status/ignored_file +1 -0
- data/test/fixtures/status/modified_file +2 -0
- data/test/fixtures/status/new_file +1 -0
- data/test/fixtures/status/staged_changes +2 -0
- data/test/fixtures/status/staged_changes_modified_file +3 -0
- data/test/fixtures/status/staged_delete_modified_file +1 -0
- data/test/fixtures/status/staged_new_file +1 -0
- data/test/fixtures/status/staged_new_file_modified_file +2 -0
- data/test/fixtures/status/subdir.txt +2 -0
- data/test/fixtures/status/subdir/current_file +1 -0
- data/test/fixtures/status/subdir/modified_file +2 -0
- data/test/fixtures/status/subdir/new_file +1 -0
- data/test/fixtures/status//350/277/231 +1 -0
- data/test/fixtures/testrepo.git/config +5 -0
- data/test/fixtures/testrepo.git/objects/77/71329dfa3002caf8c61a0ceb62a31d09023f37 +0 -0
- data/test/fixtures/text_file.md +464 -0
- data/test/fixtures/unsymlinked.git/HEAD +1 -0
- data/test/fixtures/unsymlinked.git/config +6 -0
- data/test/fixtures/unsymlinked.git/description +1 -0
- data/test/fixtures/unsymlinked.git/info/exclude +2 -0
- data/test/fixtures/unsymlinked.git/objects/08/8b64704e0d6b8bd061dea879418cb5442a3fbf +0 -0
- data/test/fixtures/unsymlinked.git/objects/13/a5e939bca25940c069fd2169d993dba328e30b +0 -0
- data/test/fixtures/unsymlinked.git/objects/19/bf568e59e3a0b363cafb4106226e62d4a4c41c +0 -0
- data/test/fixtures/unsymlinked.git/objects/58/1fadd35b4cf320d102a152f918729011604773 +0 -0
- data/test/fixtures/unsymlinked.git/objects/5c/87b6791e8b13da658a14d1ef7e09b5dc3bac8c +0 -0
- data/test/fixtures/unsymlinked.git/objects/6f/e5f5398af85fb3de8a6aba0339b6d3bfa26a27 +0 -0
- data/test/fixtures/unsymlinked.git/objects/7f/ccd75616ec188b8f1b23d67506a334cc34a49d +0 -0
- data/test/fixtures/unsymlinked.git/objects/80/6999882bf91d24241e4077906b9017605eb1f3 +0 -0
- data/test/fixtures/unsymlinked.git/objects/83/7d176303c5005505ec1e4a30231c40930c0230 +0 -0
- data/test/fixtures/unsymlinked.git/objects/a8/595ccca04f40818ae0155c8f9c77a230e597b6 +2 -0
- data/test/fixtures/unsymlinked.git/objects/cf/8f1cf5cce859c438d6cc067284cb5e161206e7 +0 -0
- data/test/fixtures/unsymlinked.git/objects/d5/278d05c8607ec420bfee4cf219fbc0eeebfd6a +0 -0
- data/test/fixtures/unsymlinked.git/objects/f4/e16fb76536591a41454194058d048d8e4dd2e9 +0 -0
- data/test/fixtures/unsymlinked.git/objects/f9/e65619d93fdf2673882e0a261c5e93b1a84006 +0 -0
- data/test/fixtures/unsymlinked.git/refs/heads/exe-file +1 -0
- data/test/fixtures/unsymlinked.git/refs/heads/master +1 -0
- data/test/fixtures/unsymlinked.git/refs/heads/reg-file +1 -0
- data/test/index_test.rb +120 -0
- data/test/reference_test.rb +38 -3
- data/test/remote_test.rb +224 -3
- data/test/repo_reset_test.rb +2 -0
- data/test/repo_test.rb +147 -10
- data/test/test_helper.rb +5 -2
- data/vendor/libgit2/include/git2/attr.h +3 -3
- data/vendor/libgit2/include/git2/blob.h +11 -17
- data/vendor/libgit2/include/git2/branch.h +3 -2
- data/vendor/libgit2/include/git2/checkout.h +7 -0
- data/vendor/libgit2/include/git2/clone.h +3 -0
- data/vendor/libgit2/include/git2/commit.h +61 -66
- data/vendor/libgit2/include/git2/common.h +73 -42
- data/vendor/libgit2/include/git2/config.h +57 -71
- data/vendor/libgit2/include/git2/cred_helpers.h +2 -2
- data/vendor/libgit2/include/git2/diff.h +179 -30
- data/vendor/libgit2/include/git2/errors.h +3 -3
- data/vendor/libgit2/include/git2/index.h +225 -146
- data/vendor/libgit2/include/git2/indexer.h +2 -22
- data/vendor/libgit2/include/git2/inttypes.h +9 -9
- data/vendor/libgit2/include/git2/merge.h +123 -5
- data/vendor/libgit2/include/git2/odb.h +59 -38
- data/vendor/libgit2/include/git2/odb_backend.h +45 -104
- data/vendor/libgit2/include/git2/oid.h +30 -19
- data/vendor/libgit2/include/git2/pack.h +21 -3
- data/vendor/libgit2/include/git2/refdb.h +0 -35
- data/vendor/libgit2/include/git2/refs.h +93 -31
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +60 -20
- data/vendor/libgit2/include/git2/repository.h +48 -70
- data/vendor/libgit2/include/git2/reset.h +3 -3
- data/vendor/libgit2/include/git2/revparse.h +22 -0
- data/vendor/libgit2/include/git2/stash.h +1 -1
- data/vendor/libgit2/include/git2/status.h +131 -56
- data/vendor/libgit2/include/git2/strarray.h +2 -2
- data/vendor/libgit2/include/git2/submodule.h +16 -16
- data/vendor/libgit2/include/git2/sys/commit.h +46 -0
- data/vendor/libgit2/include/git2/sys/config.h +71 -0
- data/vendor/libgit2/include/git2/sys/index.h +179 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +86 -0
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +158 -0
- data/vendor/libgit2/include/git2/sys/refs.h +38 -0
- data/vendor/libgit2/include/git2/sys/repository.h +106 -0
- data/vendor/libgit2/include/git2/tag.h +44 -18
- data/vendor/libgit2/include/git2/trace.h +1 -2
- data/vendor/libgit2/include/git2/transport.h +74 -0
- data/vendor/libgit2/include/git2/tree.h +12 -22
- data/vendor/libgit2/include/git2/types.h +33 -0
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/array.h +66 -0
- data/vendor/libgit2/src/attr.c +26 -13
- data/vendor/libgit2/src/attr_file.c +3 -2
- data/vendor/libgit2/src/attr_file.h +3 -3
- data/vendor/libgit2/src/attrcache.h +4 -4
- data/vendor/libgit2/src/blob.c +13 -9
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +67 -49
- data/vendor/libgit2/src/cache.c +224 -54
- data/vendor/libgit2/src/cache.h +33 -20
- data/vendor/libgit2/src/checkout.c +145 -85
- data/vendor/libgit2/src/clone.c +62 -50
- data/vendor/libgit2/src/commit.c +74 -40
- data/vendor/libgit2/src/commit.h +2 -3
- data/vendor/libgit2/src/commit_list.c +14 -8
- data/vendor/libgit2/src/config.c +119 -36
- data/vendor/libgit2/src/config.h +3 -0
- data/vendor/libgit2/src/config_cache.c +24 -7
- data/vendor/libgit2/src/config_file.c +9 -6
- data/vendor/libgit2/src/crlf.c +4 -2
- data/vendor/libgit2/src/date.c +3 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/diff.c +681 -303
- data/vendor/libgit2/src/diff.h +34 -2
- data/vendor/libgit2/src/diff_driver.c +405 -0
- data/vendor/libgit2/src/diff_driver.h +49 -0
- data/vendor/libgit2/src/diff_file.c +447 -0
- data/vendor/libgit2/src/diff_file.h +58 -0
- data/vendor/libgit2/src/diff_patch.c +995 -0
- data/vendor/libgit2/src/diff_patch.h +46 -0
- data/vendor/libgit2/src/diff_print.c +430 -0
- data/vendor/libgit2/src/diff_tform.c +464 -203
- data/vendor/libgit2/src/diff_xdiff.c +166 -0
- data/vendor/libgit2/src/diff_xdiff.h +28 -0
- data/vendor/libgit2/src/fetch.c +11 -4
- data/vendor/libgit2/src/fileops.c +85 -61
- data/vendor/libgit2/src/fileops.h +4 -0
- data/vendor/libgit2/src/global.c +10 -2
- data/vendor/libgit2/src/global.h +0 -8
- data/vendor/libgit2/src/hash/hash_generic.h +3 -3
- data/vendor/libgit2/src/hash/hash_win32.h +4 -4
- data/vendor/libgit2/src/hashsig.c +0 -1
- data/vendor/libgit2/src/ignore.c +68 -28
- data/vendor/libgit2/src/ignore.h +10 -1
- data/vendor/libgit2/src/index.c +666 -84
- data/vendor/libgit2/src/index.h +6 -0
- data/vendor/libgit2/src/indexer.c +10 -28
- data/vendor/libgit2/src/iterator.c +427 -283
- data/vendor/libgit2/src/iterator.h +58 -4
- data/vendor/libgit2/src/merge.c +1892 -32
- data/vendor/libgit2/src/merge.h +132 -5
- data/vendor/libgit2/src/merge_file.c +174 -0
- data/vendor/libgit2/src/merge_file.h +71 -0
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/notes.c +45 -48
- data/vendor/libgit2/src/object.c +89 -127
- data/vendor/libgit2/src/object.h +0 -1
- data/vendor/libgit2/src/object_api.c +129 -0
- data/vendor/libgit2/src/odb.c +156 -59
- data/vendor/libgit2/src/odb.h +5 -2
- data/vendor/libgit2/src/odb_loose.c +31 -17
- data/vendor/libgit2/src/odb_pack.c +39 -43
- data/vendor/libgit2/src/oid.c +62 -27
- data/vendor/libgit2/src/oid.h +33 -0
- data/vendor/libgit2/src/oidmap.h +4 -6
- data/vendor/libgit2/src/pack-objects.c +54 -22
- data/vendor/libgit2/src/pack.c +98 -56
- data/vendor/libgit2/src/pack.h +3 -1
- data/vendor/libgit2/src/pathspec.c +26 -1
- data/vendor/libgit2/src/pathspec.h +14 -0
- data/vendor/libgit2/src/pool.c +5 -0
- data/vendor/libgit2/src/posix.c +2 -2
- data/vendor/libgit2/src/posix.h +3 -0
- data/vendor/libgit2/src/push.c +13 -10
- data/vendor/libgit2/src/refdb.c +82 -62
- data/vendor/libgit2/src/refdb.h +16 -16
- data/vendor/libgit2/src/refdb_fs.c +386 -133
- data/vendor/libgit2/src/reflog.c +3 -1
- data/vendor/libgit2/src/refs.c +247 -221
- data/vendor/libgit2/src/refs.h +2 -1
- data/vendor/libgit2/src/refspec.c +18 -1
- data/vendor/libgit2/src/refspec.h +3 -1
- data/vendor/libgit2/src/remote.c +434 -253
- data/vendor/libgit2/src/remote.h +5 -3
- data/vendor/libgit2/src/repository.c +197 -111
- data/vendor/libgit2/src/repository.h +26 -5
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revparse.c +84 -79
- data/vendor/libgit2/src/revwalk.c +1 -1
- data/vendor/libgit2/src/signature.c +22 -10
- data/vendor/libgit2/src/stash.c +5 -2
- data/vendor/libgit2/src/status.c +311 -107
- data/vendor/libgit2/src/status.h +23 -0
- data/vendor/libgit2/src/submodule.c +21 -13
- data/vendor/libgit2/src/tag.c +42 -31
- data/vendor/libgit2/src/tag.h +2 -3
- data/vendor/libgit2/src/thread-utils.h +105 -3
- data/vendor/libgit2/src/trace.c +1 -2
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/transport.c +18 -6
- data/vendor/libgit2/src/transports/cred.c +103 -1
- data/vendor/libgit2/src/transports/local.c +19 -9
- data/vendor/libgit2/src/transports/smart_protocol.c +32 -12
- data/vendor/libgit2/src/transports/ssh.c +519 -0
- data/vendor/libgit2/src/transports/winhttp.c +3 -1
- data/vendor/libgit2/src/tree.c +26 -28
- data/vendor/libgit2/src/tree.h +3 -3
- data/vendor/libgit2/src/unix/posix.h +2 -0
- data/vendor/libgit2/src/util.c +43 -6
- data/vendor/libgit2/src/util.h +40 -12
- data/vendor/libgit2/src/vector.c +3 -5
- data/vendor/libgit2/src/vector.h +9 -0
- data/vendor/libgit2/src/win32/dir.c +1 -1
- data/vendor/libgit2/src/win32/error.c +2 -0
- data/vendor/libgit2/src/win32/findfile.c +3 -6
- data/vendor/libgit2/src/win32/posix_w32.c +85 -59
- data/vendor/libgit2/src/win32/pthread.c +16 -8
- data/vendor/libgit2/src/win32/pthread.h +7 -4
- metadata +407 -306
- data/test/coverage/HEAD.json +0 -1
- data/vendor/libgit2/include/git2/refdb_backend.h +0 -109
- data/vendor/libgit2/src/diff_output.c +0 -1819
- data/vendor/libgit2/src/diff_output.h +0 -93
@@ -103,20 +103,20 @@ typedef enum {
|
|
103
103
|
* * WD_UNTRACKED - wd contains untracked files
|
104
104
|
*/
|
105
105
|
typedef enum {
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
106
|
+
GIT_SUBMODULE_STATUS_IN_HEAD = (1u << 0),
|
107
|
+
GIT_SUBMODULE_STATUS_IN_INDEX = (1u << 1),
|
108
|
+
GIT_SUBMODULE_STATUS_IN_CONFIG = (1u << 2),
|
109
|
+
GIT_SUBMODULE_STATUS_IN_WD = (1u << 3),
|
110
|
+
GIT_SUBMODULE_STATUS_INDEX_ADDED = (1u << 4),
|
111
|
+
GIT_SUBMODULE_STATUS_INDEX_DELETED = (1u << 5),
|
112
|
+
GIT_SUBMODULE_STATUS_INDEX_MODIFIED = (1u << 6),
|
113
|
+
GIT_SUBMODULE_STATUS_WD_UNINITIALIZED = (1u << 7),
|
114
|
+
GIT_SUBMODULE_STATUS_WD_ADDED = (1u << 8),
|
115
|
+
GIT_SUBMODULE_STATUS_WD_DELETED = (1u << 9),
|
116
|
+
GIT_SUBMODULE_STATUS_WD_MODIFIED = (1u << 10),
|
117
|
+
GIT_SUBMODULE_STATUS_WD_INDEX_MODIFIED = (1u << 11),
|
118
|
+
GIT_SUBMODULE_STATUS_WD_WD_MODIFIED = (1u << 12),
|
119
|
+
GIT_SUBMODULE_STATUS_WD_UNTRACKED = (1u << 13),
|
120
120
|
} git_submodule_status_t;
|
121
121
|
|
122
122
|
#define GIT_SUBMODULE_STATUS__IN_FLAGS \
|
@@ -481,7 +481,7 @@ GIT_EXTERN(int) git_submodule_sync(git_submodule *submodule);
|
|
481
481
|
* function will return distinct `git_repository` objects. This will only
|
482
482
|
* work if the submodule is checked out into the working directory.
|
483
483
|
*
|
484
|
-
* @param
|
484
|
+
* @param repo Pointer to the submodule repo which was opened
|
485
485
|
* @param submodule Submodule to be opened
|
486
486
|
* @return 0 on success, <0 if submodule repo could not be opened.
|
487
487
|
*/
|
@@ -531,7 +531,7 @@ GIT_EXTERN(int) git_submodule_status(
|
|
531
531
|
* This can be useful if you want to know if the submodule is present in the
|
532
532
|
* working directory at this point in time, etc.
|
533
533
|
*
|
534
|
-
* @param
|
534
|
+
* @param location_status Combination of first four `GIT_SUBMODULE_STATUS` flags
|
535
535
|
* @param submodule Submodule for which to get status
|
536
536
|
* @return 0 on success, <0 on error
|
537
537
|
*/
|
@@ -0,0 +1,46 @@
|
|
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_commit_h__
|
8
|
+
#define INCLUDE_sys_git_commit_h__
|
9
|
+
|
10
|
+
#include "git2/common.h"
|
11
|
+
#include "git2/types.h"
|
12
|
+
#include "git2/oid.h"
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @file git2/sys/commit.h
|
16
|
+
* @brief Low-level Git commit creation
|
17
|
+
* @defgroup git_backend Git custom backend APIs
|
18
|
+
* @ingroup Git
|
19
|
+
* @{
|
20
|
+
*/
|
21
|
+
GIT_BEGIN_DECL
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Create new commit in the repository from a list of `git_oid` values
|
25
|
+
*
|
26
|
+
* See documentation for `git_commit_create()` for information about the
|
27
|
+
* parameters, as the meaning is identical excepting that `tree` and
|
28
|
+
* `parents` now take `git_oid`. This is a dangerous API in that nor
|
29
|
+
* the `tree`, neither the `parents` list of `git_oid`s are checked for
|
30
|
+
* validity.
|
31
|
+
*/
|
32
|
+
GIT_EXTERN(int) git_commit_create_from_oids(
|
33
|
+
git_oid *oid,
|
34
|
+
git_repository *repo,
|
35
|
+
const char *update_ref,
|
36
|
+
const git_signature *author,
|
37
|
+
const git_signature *committer,
|
38
|
+
const char *message_encoding,
|
39
|
+
const char *message,
|
40
|
+
const git_oid *tree,
|
41
|
+
int parent_count,
|
42
|
+
const git_oid *parents[]);
|
43
|
+
|
44
|
+
/** @} */
|
45
|
+
GIT_END_DECL
|
46
|
+
#endif
|
@@ -0,0 +1,71 @@
|
|
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_config_backend_h__
|
8
|
+
#define INCLUDE_sys_git_config_backend_h__
|
9
|
+
|
10
|
+
#include "git2/common.h"
|
11
|
+
#include "git2/types.h"
|
12
|
+
#include "git2/config.h"
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @file git2/sys/config.h
|
16
|
+
* @brief Git config backend routines
|
17
|
+
* @defgroup git_backend Git custom backend APIs
|
18
|
+
* @ingroup Git
|
19
|
+
* @{
|
20
|
+
*/
|
21
|
+
GIT_BEGIN_DECL
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Generic backend that implements the interface to
|
25
|
+
* access a configuration file
|
26
|
+
*/
|
27
|
+
struct git_config_backend {
|
28
|
+
unsigned int version;
|
29
|
+
struct git_config *cfg;
|
30
|
+
|
31
|
+
/* Open means open the file/database and parse if necessary */
|
32
|
+
int (*open)(struct git_config_backend *, git_config_level_t level);
|
33
|
+
int (*get)(const struct git_config_backend *, const char *key, const git_config_entry **entry);
|
34
|
+
int (*get_multivar)(struct git_config_backend *, const char *key, const char *regexp, git_config_foreach_cb callback, void *payload);
|
35
|
+
int (*set)(struct git_config_backend *, const char *key, const char *value);
|
36
|
+
int (*set_multivar)(git_config_backend *cfg, const char *name, const char *regexp, const char *value);
|
37
|
+
int (*del)(struct git_config_backend *, const char *key);
|
38
|
+
int (*foreach)(struct git_config_backend *, const char *, git_config_foreach_cb callback, void *payload);
|
39
|
+
int (*refresh)(struct git_config_backend *);
|
40
|
+
void (*free)(struct git_config_backend *);
|
41
|
+
};
|
42
|
+
#define GIT_CONFIG_BACKEND_VERSION 1
|
43
|
+
#define GIT_CONFIG_BACKEND_INIT {GIT_CONFIG_BACKEND_VERSION}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Add a generic config file instance to an existing config
|
47
|
+
*
|
48
|
+
* Note that the configuration object will free the file
|
49
|
+
* automatically.
|
50
|
+
*
|
51
|
+
* Further queries on this config object will access each
|
52
|
+
* of the config file instances in order (instances with
|
53
|
+
* a higher priority level will be accessed first).
|
54
|
+
*
|
55
|
+
* @param cfg the configuration to add the file to
|
56
|
+
* @param file the configuration file (backend) to add
|
57
|
+
* @param level the priority level of the backend
|
58
|
+
* @param force if a config file already exists for the given
|
59
|
+
* priority level, replace it
|
60
|
+
* @return 0 on success, GIT_EEXISTS when adding more than one file
|
61
|
+
* for a given priority level (and force_replace set to 0), or error code
|
62
|
+
*/
|
63
|
+
GIT_EXTERN(int) git_config_add_backend(
|
64
|
+
git_config *cfg,
|
65
|
+
git_config_backend *file,
|
66
|
+
git_config_level_t level,
|
67
|
+
int force);
|
68
|
+
|
69
|
+
/** @} */
|
70
|
+
GIT_END_DECL
|
71
|
+
#endif
|
@@ -0,0 +1,179 @@
|
|
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_index_h__
|
8
|
+
#define INCLUDE_sys_git_index_h__
|
9
|
+
|
10
|
+
/**
|
11
|
+
* @file git2/sys/index.h
|
12
|
+
* @brief Low-level Git index manipulation routines
|
13
|
+
* @defgroup git_backend Git custom backend APIs
|
14
|
+
* @ingroup Git
|
15
|
+
* @{
|
16
|
+
*/
|
17
|
+
GIT_BEGIN_DECL
|
18
|
+
|
19
|
+
/** Representation of a rename conflict entry in the index. */
|
20
|
+
typedef struct git_index_name_entry {
|
21
|
+
char *ancestor;
|
22
|
+
char *ours;
|
23
|
+
char *theirs;
|
24
|
+
} git_index_name_entry;
|
25
|
+
|
26
|
+
/** Representation of a resolve undo entry in the index. */
|
27
|
+
typedef struct git_index_reuc_entry {
|
28
|
+
unsigned int mode[3];
|
29
|
+
git_oid oid[3];
|
30
|
+
char *path;
|
31
|
+
} git_index_reuc_entry;
|
32
|
+
|
33
|
+
/** @name Conflict Name entry functions
|
34
|
+
*
|
35
|
+
* These functions work on rename conflict entries.
|
36
|
+
*/
|
37
|
+
/**@{*/
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Get the count of filename conflict entries currently in the index.
|
41
|
+
*
|
42
|
+
* @param index an existing index object
|
43
|
+
* @return integer of count of current filename conflict entries
|
44
|
+
*/
|
45
|
+
GIT_EXTERN(unsigned int) git_index_name_entrycount(git_index *index);
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Get a filename conflict entry from the index.
|
49
|
+
*
|
50
|
+
* The returned entry is read-only and should not be modified
|
51
|
+
* or freed by the caller.
|
52
|
+
*
|
53
|
+
* @param index an existing index object
|
54
|
+
* @param n the position of the entry
|
55
|
+
* @return a pointer to the filename conflict entry; NULL if out of bounds
|
56
|
+
*/
|
57
|
+
GIT_EXTERN(const git_index_name_entry *) git_index_name_get_byindex(
|
58
|
+
git_index *index, size_t n);
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Record the filenames involved in a rename conflict.
|
62
|
+
*
|
63
|
+
* @param index an existing index object
|
64
|
+
* @param ancestor the path of the file as it existed in the ancestor
|
65
|
+
* @param ours the path of the file as it existed in our tree
|
66
|
+
* @param theirs the path of the file as it existed in their tree
|
67
|
+
*/
|
68
|
+
GIT_EXTERN(int) git_index_name_add(git_index *index,
|
69
|
+
const char *ancestor, const char *ours, const char *theirs);
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Remove all filename conflict entries.
|
73
|
+
*
|
74
|
+
* @param index an existing index object
|
75
|
+
* @return 0 or an error code
|
76
|
+
*/
|
77
|
+
GIT_EXTERN(void) git_index_name_clear(git_index *index);
|
78
|
+
|
79
|
+
/**@}*/
|
80
|
+
|
81
|
+
/** @name Resolve Undo (REUC) index entry manipulation.
|
82
|
+
*
|
83
|
+
* These functions work on the Resolve Undo index extension and contains
|
84
|
+
* data about the original files that led to a merge conflict.
|
85
|
+
*/
|
86
|
+
/**@{*/
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Get the count of resolve undo entries currently in the index.
|
90
|
+
*
|
91
|
+
* @param index an existing index object
|
92
|
+
* @return integer of count of current resolve undo entries
|
93
|
+
*/
|
94
|
+
GIT_EXTERN(unsigned int) git_index_reuc_entrycount(git_index *index);
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Finds the resolve undo entry that points to the given path in the Git
|
98
|
+
* index.
|
99
|
+
*
|
100
|
+
* @param at_pos the address to which the position of the reuc entry is written (optional)
|
101
|
+
* @param index an existing index object
|
102
|
+
* @param path path to search
|
103
|
+
* @return 0 if found, < 0 otherwise (GIT_ENOTFOUND)
|
104
|
+
*/
|
105
|
+
GIT_EXTERN(int) git_index_reuc_find(size_t *at_pos, git_index *index, const char *path);
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Get a resolve undo entry from the index.
|
109
|
+
*
|
110
|
+
* The returned entry is read-only and should not be modified
|
111
|
+
* or freed by the caller.
|
112
|
+
*
|
113
|
+
* @param index an existing index object
|
114
|
+
* @param path path to search
|
115
|
+
* @return the resolve undo entry; NULL if not found
|
116
|
+
*/
|
117
|
+
GIT_EXTERN(const git_index_reuc_entry *) git_index_reuc_get_bypath(git_index *index, const char *path);
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Get a resolve undo entry from the index.
|
121
|
+
*
|
122
|
+
* The returned entry is read-only and should not be modified
|
123
|
+
* or freed by the caller.
|
124
|
+
*
|
125
|
+
* @param index an existing index object
|
126
|
+
* @param n the position of the entry
|
127
|
+
* @return a pointer to the resolve undo entry; NULL if out of bounds
|
128
|
+
*/
|
129
|
+
GIT_EXTERN(const git_index_reuc_entry *) git_index_reuc_get_byindex(git_index *index, size_t n);
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Adds a resolve undo entry for a file based on the given parameters.
|
133
|
+
*
|
134
|
+
* The resolve undo entry contains the OIDs of files that were involved
|
135
|
+
* in a merge conflict after the conflict has been resolved. This allows
|
136
|
+
* conflicts to be re-resolved later.
|
137
|
+
*
|
138
|
+
* If there exists a resolve undo entry for the given path in the index,
|
139
|
+
* it will be removed.
|
140
|
+
*
|
141
|
+
* This method will fail in bare index instances.
|
142
|
+
*
|
143
|
+
* @param index an existing index object
|
144
|
+
* @param path filename to add
|
145
|
+
* @param ancestor_mode mode of the ancestor file
|
146
|
+
* @param ancestor_id oid of the ancestor file
|
147
|
+
* @param our_mode mode of our file
|
148
|
+
* @param our_id oid of our file
|
149
|
+
* @param their_mode mode of their file
|
150
|
+
* @param their_id oid of their file
|
151
|
+
* @return 0 or an error code
|
152
|
+
*/
|
153
|
+
GIT_EXTERN(int) git_index_reuc_add(git_index *index, const char *path,
|
154
|
+
int ancestor_mode, const git_oid *ancestor_id,
|
155
|
+
int our_mode, const git_oid *our_id,
|
156
|
+
int their_mode, const git_oid *their_id);
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Remove an resolve undo entry from the index
|
160
|
+
*
|
161
|
+
* @param index an existing index object
|
162
|
+
* @param n position of the resolve undo entry to remove
|
163
|
+
* @return 0 or an error code
|
164
|
+
*/
|
165
|
+
GIT_EXTERN(int) git_index_reuc_remove(git_index *index, size_t n);
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Remove all resolve undo entries from the index
|
169
|
+
*
|
170
|
+
* @param index an existing index object
|
171
|
+
* @return 0 or an error code
|
172
|
+
*/
|
173
|
+
GIT_EXTERN(void) git_index_reuc_clear(git_index *index);
|
174
|
+
|
175
|
+
/**@}*/
|
176
|
+
|
177
|
+
/** @} */
|
178
|
+
GIT_END_DECL
|
179
|
+
#endif
|
@@ -0,0 +1,86 @@
|
|
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_odb_backend_h__
|
8
|
+
#define INCLUDE_sys_git_odb_backend_h__
|
9
|
+
|
10
|
+
#include "git2/common.h"
|
11
|
+
#include "git2/types.h"
|
12
|
+
#include "git2/oid.h"
|
13
|
+
#include "git2/odb.h"
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @file git2/sys/backend.h
|
17
|
+
* @brief Git custom backend implementors functions
|
18
|
+
* @defgroup git_backend Git custom backend APIs
|
19
|
+
* @ingroup Git
|
20
|
+
* @{
|
21
|
+
*/
|
22
|
+
GIT_BEGIN_DECL
|
23
|
+
|
24
|
+
/**
|
25
|
+
* An instance for a custom backend
|
26
|
+
*/
|
27
|
+
struct git_odb_backend {
|
28
|
+
unsigned int version;
|
29
|
+
git_odb *odb;
|
30
|
+
|
31
|
+
/* read and read_prefix each return to libgit2 a buffer which
|
32
|
+
* will be freed later. The buffer should be allocated using
|
33
|
+
* the function git_odb_backend_malloc to ensure that it can
|
34
|
+
* be safely freed later. */
|
35
|
+
int (* read)(
|
36
|
+
void **, size_t *, git_otype *, git_odb_backend *, const git_oid *);
|
37
|
+
|
38
|
+
/* To find a unique object given a prefix
|
39
|
+
* of its oid.
|
40
|
+
* The oid given must be so that the
|
41
|
+
* remaining (GIT_OID_HEXSZ - len)*4 bits
|
42
|
+
* are 0s.
|
43
|
+
*/
|
44
|
+
int (* read_prefix)(
|
45
|
+
git_oid *, void **, size_t *, git_otype *,
|
46
|
+
git_odb_backend *, const git_oid *, size_t);
|
47
|
+
|
48
|
+
int (* read_header)(
|
49
|
+
size_t *, git_otype *, git_odb_backend *, const git_oid *);
|
50
|
+
|
51
|
+
/* The writer may assume that the object
|
52
|
+
* has already been hashed and is passed
|
53
|
+
* in the first parameter.
|
54
|
+
*/
|
55
|
+
int (* write)(
|
56
|
+
git_oid *, git_odb_backend *, const void *, size_t, git_otype);
|
57
|
+
|
58
|
+
int (* writestream)(
|
59
|
+
git_odb_stream **, git_odb_backend *, size_t, git_otype);
|
60
|
+
|
61
|
+
int (* readstream)(
|
62
|
+
git_odb_stream **, git_odb_backend *, const git_oid *);
|
63
|
+
|
64
|
+
int (* exists)(
|
65
|
+
git_odb_backend *, const git_oid *);
|
66
|
+
|
67
|
+
int (* refresh)(git_odb_backend *);
|
68
|
+
|
69
|
+
int (* foreach)(
|
70
|
+
git_odb_backend *, git_odb_foreach_cb cb, void *payload);
|
71
|
+
|
72
|
+
int (* writepack)(
|
73
|
+
git_odb_writepack **, git_odb_backend *,
|
74
|
+
git_transfer_progress_callback progress_cb, void *progress_payload);
|
75
|
+
|
76
|
+
void (* free)(git_odb_backend *);
|
77
|
+
};
|
78
|
+
|
79
|
+
#define GIT_ODB_BACKEND_VERSION 1
|
80
|
+
#define GIT_ODB_BACKEND_INIT {GIT_ODB_BACKEND_VERSION}
|
81
|
+
|
82
|
+
GIT_EXTERN(void *) git_odb_backend_malloc(git_odb_backend *backend, size_t len);
|
83
|
+
|
84
|
+
GIT_END_DECL
|
85
|
+
|
86
|
+
#endif
|