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.
|
@@ -15,32 +15,66 @@
|
|
15
15
|
*/
|
16
16
|
GIT_BEGIN_DECL
|
17
17
|
|
18
|
+
/**
|
19
|
+
* Kinds of reset operation
|
20
|
+
*/
|
21
|
+
typedef enum {
|
22
|
+
GIT_RESET_SOFT = 1, /** Move the head to the given commit */
|
23
|
+
GIT_RESET_MIXED = 2, /** SOFT plus reset index to the commit */
|
24
|
+
GIT_RESET_HARD = 3, /** MIXED plus changes in working tree discarded */
|
25
|
+
} git_reset_t;
|
26
|
+
|
18
27
|
/**
|
19
28
|
* Sets the current head to the specified commit oid and optionally
|
20
29
|
* resets the index and working tree to match.
|
21
30
|
*
|
22
|
-
*
|
31
|
+
* SOFT reset means the Head will be moved to the commit.
|
23
32
|
*
|
24
|
-
*
|
25
|
-
*
|
33
|
+
* MIXED reset will trigger a SOFT reset, plus the index will be replaced
|
34
|
+
* with the content of the commit tree.
|
26
35
|
*
|
27
|
-
*
|
28
|
-
*
|
36
|
+
* HARD reset will trigger a MIXED reset and the working directory will be
|
37
|
+
* replaced with the content of the index. (Untracked and ignored files
|
38
|
+
* will be left alone, however.)
|
29
39
|
*
|
30
40
|
* TODO: Implement remaining kinds of resets.
|
31
41
|
*
|
32
42
|
* @param repo Repository where to perform the reset operation.
|
33
43
|
*
|
34
|
-
* @param target
|
44
|
+
* @param target Committish to which the Head should be moved to. This object
|
35
45
|
* must belong to the given `repo` and can either be a git_commit or a
|
36
46
|
* git_tag. When a git_tag is being passed, it should be dereferencable
|
37
47
|
* to a git_commit which oid will be used as the target of the branch.
|
38
48
|
*
|
39
49
|
* @param reset_type Kind of reset operation to perform.
|
40
50
|
*
|
41
|
-
* @return
|
51
|
+
* @return 0 on success or an error code
|
52
|
+
*/
|
53
|
+
GIT_EXTERN(int) git_reset(
|
54
|
+
git_repository *repo, git_object *target, git_reset_t reset_type);
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Updates some entries in the index from the target commit tree.
|
58
|
+
*
|
59
|
+
* The scope of the updated entries is determined by the paths
|
60
|
+
* being passed in the `pathspec` parameters.
|
61
|
+
*
|
62
|
+
* Passing a NULL `target` will result in removing
|
63
|
+
* entries in the index matching the provided pathspecs.
|
64
|
+
*
|
65
|
+
* @param repo Repository where to perform the reset operation.
|
66
|
+
*
|
67
|
+
* @param target The committish which content will be used to reset the content
|
68
|
+
* of the index.
|
69
|
+
*
|
70
|
+
* @param pathspecs List of pathspecs to operate on.
|
71
|
+
*
|
72
|
+
* @return 0 on success or an error code < 0
|
42
73
|
*/
|
43
|
-
GIT_EXTERN(int)
|
74
|
+
GIT_EXTERN(int) git_reset_default(
|
75
|
+
git_repository *repo,
|
76
|
+
git_object *target,
|
77
|
+
git_strarray* pathspecs);
|
44
78
|
|
45
79
|
/** @} */
|
46
80
|
GIT_END_DECL
|
@@ -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,16 +21,60 @@
|
|
21
21
|
GIT_BEGIN_DECL
|
22
22
|
|
23
23
|
/**
|
24
|
-
* Find
|
25
|
-
*
|
24
|
+
* Find a single object, as specified by a revision string. See `man gitrevisions`,
|
25
|
+
* or http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for
|
26
|
+
* information on the syntax accepted.
|
26
27
|
*
|
27
28
|
* @param out pointer to output object
|
28
29
|
* @param repo the repository to search in
|
29
30
|
* @param spec the textual specification for an object
|
30
|
-
* @return
|
31
|
+
* @return 0 on success, GIT_ENOTFOUND, GIT_EAMBIGUOUS, GIT_EINVALIDSPEC or an error code
|
31
32
|
*/
|
32
33
|
GIT_EXTERN(int) git_revparse_single(git_object **out, git_repository *repo, const char *spec);
|
33
34
|
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Revparse flags. These indicate the intended behavior of the spec passed to
|
38
|
+
* git_revparse.
|
39
|
+
*/
|
40
|
+
typedef enum {
|
41
|
+
/** The spec targeted a single object. */
|
42
|
+
GIT_REVPARSE_SINGLE = 1 << 0,
|
43
|
+
/** The spec targeted a range of commits. */
|
44
|
+
GIT_REVPARSE_RANGE = 1 << 1,
|
45
|
+
/** The spec used the '...' operator, which invokes special semantics. */
|
46
|
+
GIT_REVPARSE_MERGE_BASE = 1 << 2,
|
47
|
+
} git_revparse_mode_t;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Git Revision Spec: output of a `git_revparse` operation
|
51
|
+
*/
|
52
|
+
typedef struct {
|
53
|
+
/** The left element of the revspec; must be freed by the user */
|
54
|
+
git_object *from;
|
55
|
+
/** The right element of the revspec; must be freed by the user */
|
56
|
+
git_object *to;
|
57
|
+
/** The intent of the revspec */
|
58
|
+
unsigned int flags;
|
59
|
+
} git_revspec;
|
60
|
+
|
61
|
+
/**
|
62
|
+
* Parse a revision string for `from`, `to`, and intent. See `man gitrevisions` or
|
63
|
+
* http://git-scm.com/docs/git-rev-parse.html#_specifying_revisions for information
|
64
|
+
* on the syntax accepted.
|
65
|
+
*
|
66
|
+
* @param revspec Pointer to an user-allocated git_revspec struct where the result
|
67
|
+
* of the rev-parse will be stored
|
68
|
+
* @param repo the repository to search in
|
69
|
+
* @param spec the rev-parse spec to parse
|
70
|
+
* @return 0 on success, GIT_INVALIDSPEC, GIT_ENOTFOUND, GIT_EAMBIGUOUS or an error code
|
71
|
+
*/
|
72
|
+
GIT_EXTERN(int) git_revparse(
|
73
|
+
git_revspec *revspec,
|
74
|
+
git_repository *repo,
|
75
|
+
const char *spec);
|
76
|
+
|
77
|
+
|
34
78
|
/** @} */
|
35
79
|
GIT_END_DECL
|
36
80
|
#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.
|
@@ -63,11 +63,11 @@ GIT_BEGIN_DECL
|
|
63
63
|
* it is possible to have several revision walkers in
|
64
64
|
* several different threads walking the same repository.
|
65
65
|
*
|
66
|
-
* @param
|
66
|
+
* @param out pointer to the new revision walker
|
67
67
|
* @param repo the repo to walk through
|
68
68
|
* @return 0 or an error code
|
69
69
|
*/
|
70
|
-
GIT_EXTERN(int) git_revwalk_new(git_revwalk **
|
70
|
+
GIT_EXTERN(int) git_revwalk_new(git_revwalk **out, git_repository *repo);
|
71
71
|
|
72
72
|
/**
|
73
73
|
* Reset the revision walker for reuse.
|
@@ -92,14 +92,14 @@ GIT_EXTERN(void) git_revwalk_reset(git_revwalk *walker);
|
|
92
92
|
*
|
93
93
|
* The given commit will be used as one of the roots
|
94
94
|
* when starting the revision walk. At least one commit
|
95
|
-
* must be pushed the
|
95
|
+
* must be pushed onto the walker before a walk can
|
96
96
|
* be started.
|
97
97
|
*
|
98
98
|
* @param walk the walker being used for the traversal.
|
99
|
-
* @param
|
99
|
+
* @param id the oid of the commit to start from.
|
100
100
|
* @return 0 or an error code
|
101
101
|
*/
|
102
|
-
GIT_EXTERN(int) git_revwalk_push(git_revwalk *walk, const git_oid *
|
102
|
+
GIT_EXTERN(int) git_revwalk_push(git_revwalk *walk, const git_oid *id);
|
103
103
|
|
104
104
|
/**
|
105
105
|
* Push matching references
|
@@ -134,10 +134,10 @@ GIT_EXTERN(int) git_revwalk_push_head(git_revwalk *walk);
|
|
134
134
|
* output on the revision walk.
|
135
135
|
*
|
136
136
|
* @param walk the walker being used for the traversal.
|
137
|
-
* @param
|
137
|
+
* @param commit_id the oid of commit that will be ignored during the traversal
|
138
138
|
* @return 0 or an error code
|
139
139
|
*/
|
140
|
-
GIT_EXTERN(int) git_revwalk_hide(git_revwalk *walk, const git_oid *
|
140
|
+
GIT_EXTERN(int) git_revwalk_hide(git_revwalk *walk, const git_oid *commit_id);
|
141
141
|
|
142
142
|
/**
|
143
143
|
* Hide matching references.
|
@@ -198,12 +198,12 @@ GIT_EXTERN(int) git_revwalk_hide_ref(git_revwalk *walk, const char *refname);
|
|
198
198
|
*
|
199
199
|
* The revision walker is reset when the walk is over.
|
200
200
|
*
|
201
|
-
* @param
|
201
|
+
* @param out Pointer where to store the oid of the next commit
|
202
202
|
* @param walk the walker to pop the commit from.
|
203
203
|
* @return 0 if the next commit was found;
|
204
204
|
* GIT_ITEROVER if there are no commits left to iterate
|
205
205
|
*/
|
206
|
-
GIT_EXTERN(int) git_revwalk_next(git_oid *
|
206
|
+
GIT_EXTERN(int) git_revwalk_next(git_oid *out, git_revwalk *walk);
|
207
207
|
|
208
208
|
/**
|
209
209
|
* Change the sorting mode when iterating through the
|
@@ -216,6 +216,21 @@ GIT_EXTERN(int) git_revwalk_next(git_oid *oid, git_revwalk *walk);
|
|
216
216
|
*/
|
217
217
|
GIT_EXTERN(void) git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode);
|
218
218
|
|
219
|
+
/**
|
220
|
+
* Push and hide the respective endpoints of the given range.
|
221
|
+
*
|
222
|
+
* The range should be of the form
|
223
|
+
* <commit>..<commit>
|
224
|
+
* where each <commit> is in the form accepted by 'git_revparse_single'.
|
225
|
+
* The left-hand commit will be hidden and the right-hand commit pushed.
|
226
|
+
*
|
227
|
+
* @param walk the walker being used for the traversal
|
228
|
+
* @param range the range
|
229
|
+
* @return 0 or an error code
|
230
|
+
*
|
231
|
+
*/
|
232
|
+
GIT_EXTERN(int) git_revwalk_push_range(git_revwalk *walk, const char *range);
|
233
|
+
|
219
234
|
/**
|
220
235
|
* Free a revision walker previously allocated.
|
221
236
|
*
|
@@ -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.
|
@@ -20,44 +20,52 @@
|
|
20
20
|
GIT_BEGIN_DECL
|
21
21
|
|
22
22
|
/**
|
23
|
-
* Create a new action signature.
|
24
|
-
*
|
23
|
+
* Create a new action signature.
|
24
|
+
*
|
25
|
+
* Call `git_signature_free()` to free the data.
|
25
26
|
*
|
26
27
|
* Note: angle brackets ('<' and '>') characters are not allowed
|
27
28
|
* to be used in either the `name` or the `email` parameter.
|
28
29
|
*
|
29
|
-
* @param
|
30
|
+
* @param out new signature, in case of error NULL
|
30
31
|
* @param name name of the person
|
31
32
|
* @param email email of the person
|
32
33
|
* @param time time when the action happened
|
33
34
|
* @param offset timezone offset in minutes for the time
|
34
35
|
* @return 0 or an error code
|
35
36
|
*/
|
36
|
-
GIT_EXTERN(int) git_signature_new(git_signature **
|
37
|
+
GIT_EXTERN(int) git_signature_new(git_signature **out, const char *name, const char *email, git_time_t time, int offset);
|
37
38
|
|
38
39
|
/**
|
39
|
-
* Create a new action signature with a timestamp of 'now'.
|
40
|
-
*
|
40
|
+
* Create a new action signature with a timestamp of 'now'.
|
41
|
+
*
|
42
|
+
* Call `git_signature_free()` to free the data.
|
41
43
|
*
|
42
|
-
* @param
|
44
|
+
* @param out new signature, in case of error NULL
|
43
45
|
* @param name name of the person
|
44
46
|
* @param email email of the person
|
45
47
|
* @return 0 or an error code
|
46
48
|
*/
|
47
|
-
GIT_EXTERN(int) git_signature_now(git_signature **
|
49
|
+
GIT_EXTERN(int) git_signature_now(git_signature **out, const char *name, const char *email);
|
48
50
|
|
49
51
|
|
50
52
|
/**
|
51
|
-
* Create a copy of an existing signature.
|
53
|
+
* Create a copy of an existing signature. All internal strings are also
|
54
|
+
* duplicated.
|
55
|
+
*
|
56
|
+
* Call `git_signature_free()` to free the data.
|
52
57
|
*
|
53
|
-
* All internal strings are also duplicated.
|
54
58
|
* @param sig signature to duplicated
|
55
59
|
* @return a copy of sig, NULL on out of memory
|
56
60
|
*/
|
57
61
|
GIT_EXTERN(git_signature *) git_signature_dup(const git_signature *sig);
|
58
62
|
|
59
63
|
/**
|
60
|
-
* Free an existing signature
|
64
|
+
* Free an existing signature.
|
65
|
+
*
|
66
|
+
* Because the signature is not an opaque structure, it is legal to free it
|
67
|
+
* manually, but be sure to free the "name" and "email" strings in addition
|
68
|
+
* to the structure itself.
|
61
69
|
*
|
62
70
|
* @param sig signature to free
|
63
71
|
*/
|
@@ -0,0 +1,121 @@
|
|
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_stash_h__
|
8
|
+
#define INCLUDE_git_stash_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "types.h"
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @file git2/stash.h
|
15
|
+
* @brief Git stash management routines
|
16
|
+
* @ingroup Git
|
17
|
+
* @{
|
18
|
+
*/
|
19
|
+
GIT_BEGIN_DECL
|
20
|
+
|
21
|
+
typedef enum {
|
22
|
+
GIT_STASH_DEFAULT = 0,
|
23
|
+
|
24
|
+
/* All changes already added to the index
|
25
|
+
* are left intact in the working directory
|
26
|
+
*/
|
27
|
+
GIT_STASH_KEEP_INDEX = (1 << 0),
|
28
|
+
|
29
|
+
/* All untracked files are also stashed and then
|
30
|
+
* cleaned up from the working directory
|
31
|
+
*/
|
32
|
+
GIT_STASH_INCLUDE_UNTRACKED = (1 << 1),
|
33
|
+
|
34
|
+
/* All ignored files are also stashed and then
|
35
|
+
* cleaned up from the working directory
|
36
|
+
*/
|
37
|
+
GIT_STASH_INCLUDE_IGNORED = (1 << 2),
|
38
|
+
} git_stash_flags;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Save the local modifications to a new stash.
|
42
|
+
*
|
43
|
+
* @param out Object id of the commit containing the stashed state.
|
44
|
+
* This commit is also the target of the direct reference refs/stash.
|
45
|
+
*
|
46
|
+
* @param repo The owning repository.
|
47
|
+
*
|
48
|
+
* @param stasher The identity of the person performing the stashing.
|
49
|
+
*
|
50
|
+
* @param message Optional description along with the stashed state.
|
51
|
+
*
|
52
|
+
* @param flags Flags to control the stashing process. (see GIT_STASH_* above)
|
53
|
+
*
|
54
|
+
* @return 0 on success, GIT_ENOTFOUND where there's nothing to stash,
|
55
|
+
* or error code.
|
56
|
+
*/
|
57
|
+
GIT_EXTERN(int) git_stash_save(
|
58
|
+
git_oid *out,
|
59
|
+
git_repository *repo,
|
60
|
+
git_signature *stasher,
|
61
|
+
const char *message,
|
62
|
+
unsigned int flags);
|
63
|
+
|
64
|
+
/**
|
65
|
+
* When iterating over all the stashed states, callback that will be
|
66
|
+
* issued per entry.
|
67
|
+
*
|
68
|
+
* @param index The position within the stash list. 0 points to the
|
69
|
+
* most recent stashed state.
|
70
|
+
*
|
71
|
+
* @param message The stash message.
|
72
|
+
*
|
73
|
+
* @param stash_id The commit oid of the stashed state.
|
74
|
+
*
|
75
|
+
* @param payload Extra parameter to callback function.
|
76
|
+
*
|
77
|
+
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
78
|
+
*/
|
79
|
+
typedef int (*git_stash_cb)(
|
80
|
+
size_t index,
|
81
|
+
const char* message,
|
82
|
+
const git_oid *stash_id,
|
83
|
+
void *payload);
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Loop over all the stashed states and issue a callback for each one.
|
87
|
+
*
|
88
|
+
* If the callback returns a non-zero value, this will stop looping.
|
89
|
+
*
|
90
|
+
* @param repo Repository where to find the stash.
|
91
|
+
*
|
92
|
+
* @param callabck Callback to invoke per found stashed state. The most recent
|
93
|
+
* stash state will be enumerated first.
|
94
|
+
*
|
95
|
+
* @param payload Extra parameter to callback function.
|
96
|
+
*
|
97
|
+
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
98
|
+
*/
|
99
|
+
GIT_EXTERN(int) git_stash_foreach(
|
100
|
+
git_repository *repo,
|
101
|
+
git_stash_cb callback,
|
102
|
+
void *payload);
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Remove a single stashed state from the stash list.
|
106
|
+
*
|
107
|
+
* @param repo The owning repository.
|
108
|
+
*
|
109
|
+
* @param index The position within the stash list. 0 points to the
|
110
|
+
* most recent stashed state.
|
111
|
+
*
|
112
|
+
* @return 0 on success, or error code
|
113
|
+
*/
|
114
|
+
|
115
|
+
GIT_EXTERN(int) git_stash_drop(
|
116
|
+
git_repository *repo,
|
117
|
+
size_t index);
|
118
|
+
|
119
|
+
/** @} */
|
120
|
+
GIT_END_DECL
|
121
|
+
#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.
|
@@ -19,6 +19,16 @@
|
|
19
19
|
*/
|
20
20
|
GIT_BEGIN_DECL
|
21
21
|
|
22
|
+
/**
|
23
|
+
* Status flags for a single file.
|
24
|
+
*
|
25
|
+
* A combination of these values will be returned to indicate the status of
|
26
|
+
* a file. Status compares the working directory, the index, and the
|
27
|
+
* current HEAD of the repository. The `GIT_STATUS_INDEX` set of flags
|
28
|
+
* represents the status of file in the index relative to the HEAD, and the
|
29
|
+
* `GIT_STATUS_WT` set of flags represent the status of the file in the
|
30
|
+
* working directory relative to the index.
|
31
|
+
*/
|
22
32
|
typedef enum {
|
23
33
|
GIT_STATUS_CURRENT = 0,
|
24
34
|
|
@@ -36,24 +46,40 @@ typedef enum {
|
|
36
46
|
GIT_STATUS_IGNORED = (1u << 14),
|
37
47
|
} git_status_t;
|
38
48
|
|
49
|
+
/**
|
50
|
+
* Function pointer to receive status on individual files
|
51
|
+
*
|
52
|
+
* `path` is the relative path to the file from the root of the repository.
|
53
|
+
*
|
54
|
+
* `status_flags` is a combination of `git_status_t` values that apply.
|
55
|
+
*
|
56
|
+
* `payload` is the value you passed to the foreach function as payload.
|
57
|
+
*/
|
58
|
+
typedef int (*git_status_cb)(
|
59
|
+
const char *path, unsigned int status_flags, void *payload);
|
60
|
+
|
39
61
|
/**
|
40
62
|
* Gather file statuses and run a callback for each one.
|
41
63
|
*
|
42
|
-
* The callback is passed the path of the file, the status
|
43
|
-
*
|
44
|
-
*
|
64
|
+
* The callback is passed the path of the file, the status (a combination of
|
65
|
+
* the `git_status_t` values above) and the `payload` data pointer passed
|
66
|
+
* into this function.
|
45
67
|
*
|
46
|
-
*
|
47
|
-
*
|
68
|
+
* If the callback returns a non-zero value, this function will stop looping
|
69
|
+
* and return GIT_EUSER.
|
70
|
+
*
|
71
|
+
* @param repo A repository object
|
72
|
+
* @param callback The function to call on each file
|
73
|
+
* @param payload Pointer to pass through to callback function
|
48
74
|
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
49
75
|
*/
|
50
76
|
GIT_EXTERN(int) git_status_foreach(
|
51
77
|
git_repository *repo,
|
52
|
-
|
78
|
+
git_status_cb callback,
|
53
79
|
void *payload);
|
54
80
|
|
55
81
|
/**
|
56
|
-
*
|
82
|
+
* For extended status, select the files on which to report status.
|
57
83
|
*
|
58
84
|
* - GIT_STATUS_SHOW_INDEX_AND_WORKDIR is the default. This is the
|
59
85
|
* rough equivalent of `git status --porcelain` where each file
|
@@ -81,65 +107,108 @@ typedef enum {
|
|
81
107
|
/**
|
82
108
|
* Flags to control status callbacks
|
83
109
|
*
|
84
|
-
* - GIT_STATUS_OPT_INCLUDE_UNTRACKED says that callbacks should
|
85
|
-
*
|
86
|
-
*
|
87
|
-
* - GIT_STATUS_OPT_INCLUDE_IGNORED says that ignored files should
|
88
|
-
*
|
89
|
-
*
|
90
|
-
*
|
91
|
-
*
|
92
|
-
* - GIT_STATUS_OPT_INCLUDE_UNMODIFIED indicates that callback
|
93
|
-
*
|
94
|
-
* - GIT_STATUS_OPT_EXCLUDE_SUBMODULES indicates that directories
|
95
|
-
*
|
96
|
-
* - GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS indicates that the
|
97
|
-
*
|
98
|
-
*
|
99
|
-
*
|
100
|
-
*
|
101
|
-
*
|
102
|
-
* - GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH indicates that the given
|
103
|
-
*
|
110
|
+
* - GIT_STATUS_OPT_INCLUDE_UNTRACKED says that callbacks should be made
|
111
|
+
* on untracked files. These will only be made if the workdir files are
|
112
|
+
* included in the status "show" option.
|
113
|
+
* - GIT_STATUS_OPT_INCLUDE_IGNORED says that ignored files should get
|
114
|
+
* callbacks. Again, these callbacks will only be made if the workdir
|
115
|
+
* files are included in the status "show" option. Right now, there is
|
116
|
+
* no option to include all files in directories that are ignored
|
117
|
+
* completely.
|
118
|
+
* - GIT_STATUS_OPT_INCLUDE_UNMODIFIED indicates that callback should be
|
119
|
+
* made even on unmodified files.
|
120
|
+
* - GIT_STATUS_OPT_EXCLUDE_SUBMODULES indicates that directories which
|
121
|
+
* appear to be submodules should just be skipped over.
|
122
|
+
* - GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS indicates that the contents of
|
123
|
+
* untracked directories should be included in the status. Normally if
|
124
|
+
* an entire directory is new, then just the top-level directory will be
|
125
|
+
* included (with a trailing slash on the entry name). Given this flag,
|
126
|
+
* the directory itself will not be included, but all the files in it
|
127
|
+
* will.
|
128
|
+
* - GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH indicates that the given path
|
129
|
+
* will be treated as a literal path, and not as a pathspec.
|
130
|
+
* - GIT_STATUS_OPT_RECURSE_IGNORED_DIRS indicates that the contents of
|
131
|
+
* ignored directories should be included in the status. This is like
|
132
|
+
* doing `git ls-files -o -i --exclude-standard` with core git.
|
133
|
+
*
|
134
|
+
* Calling `git_status_foreach()` is like calling the extended version
|
135
|
+
* with: GIT_STATUS_OPT_INCLUDE_IGNORED, GIT_STATUS_OPT_INCLUDE_UNTRACKED,
|
136
|
+
* and GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS. Those options are bundled
|
137
|
+
* together as `GIT_STATUS_OPT_DEFAULTS` if you want them as a baseline.
|
104
138
|
*/
|
139
|
+
typedef enum {
|
140
|
+
GIT_STATUS_OPT_INCLUDE_UNTRACKED = (1u << 0),
|
141
|
+
GIT_STATUS_OPT_INCLUDE_IGNORED = (1u << 1),
|
142
|
+
GIT_STATUS_OPT_INCLUDE_UNMODIFIED = (1u << 2),
|
143
|
+
GIT_STATUS_OPT_EXCLUDE_SUBMODULES = (1u << 3),
|
144
|
+
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = (1u << 4),
|
145
|
+
GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH = (1u << 5),
|
146
|
+
GIT_STATUS_OPT_RECURSE_IGNORED_DIRS = (1u << 6),
|
147
|
+
} git_status_opt_t;
|
105
148
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
GIT_STATUS_OPT_EXCLUDE_SUBMODULES = (1 << 3),
|
111
|
-
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = (1 << 4),
|
112
|
-
GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH = (1 << 5),
|
113
|
-
};
|
149
|
+
#define GIT_STATUS_OPT_DEFAULTS \
|
150
|
+
(GIT_STATUS_OPT_INCLUDE_IGNORED | \
|
151
|
+
GIT_STATUS_OPT_INCLUDE_UNTRACKED | \
|
152
|
+
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS)
|
114
153
|
|
115
154
|
/**
|
116
|
-
* Options to control how
|
117
|
-
*
|
155
|
+
* Options to control how `git_status_foreach_ext()` will issue callbacks.
|
156
|
+
*
|
157
|
+
* This structure is set so that zeroing it out will give you relatively
|
158
|
+
* sane defaults.
|
159
|
+
*
|
160
|
+
* The `show` value is one of the `git_status_show_t` constants that
|
161
|
+
* control which files to scan and in what order.
|
162
|
+
*
|
163
|
+
* The `flags` value is an OR'ed combination of the `git_status_opt_t`
|
164
|
+
* values above.
|
165
|
+
*
|
166
|
+
* The `pathspec` is an array of path patterns to match (using
|
167
|
+
* fnmatch-style matching), or just an array of paths to match exactly if
|
168
|
+
* `GIT_STATUS_OPT_DISABLE_PATHSPEC_MATCH` is specified in the flags.
|
118
169
|
*/
|
119
170
|
typedef struct {
|
171
|
+
unsigned int version;
|
120
172
|
git_status_show_t show;
|
121
|
-
unsigned int
|
122
|
-
git_strarray
|
173
|
+
unsigned int flags;
|
174
|
+
git_strarray pathspec;
|
123
175
|
} git_status_options;
|
124
176
|
|
177
|
+
#define GIT_STATUS_OPTIONS_VERSION 1
|
178
|
+
#define GIT_STATUS_OPTIONS_INIT {GIT_STATUS_OPTIONS_VERSION}
|
179
|
+
|
125
180
|
/**
|
126
181
|
* Gather file status information and run callbacks as requested.
|
182
|
+
*
|
183
|
+
* This is an extended version of the `git_status_foreach()` API that
|
184
|
+
* allows for more granular control over which paths will be processed and
|
185
|
+
* in what order. See the `git_status_options` structure for details
|
186
|
+
* about the additional controls that this makes available.
|
187
|
+
*
|
188
|
+
* @param repo Repository object
|
189
|
+
* @param opts Status options structure
|
190
|
+
* @param callback The function to call on each file
|
191
|
+
* @param payload Pointer to pass through to callback function
|
192
|
+
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
127
193
|
*/
|
128
194
|
GIT_EXTERN(int) git_status_foreach_ext(
|
129
195
|
git_repository *repo,
|
130
196
|
const git_status_options *opts,
|
131
|
-
|
197
|
+
git_status_cb callback,
|
132
198
|
void *payload);
|
133
199
|
|
134
200
|
/**
|
135
|
-
* Get file status for a single file
|
136
|
-
*
|
137
|
-
*
|
138
|
-
*
|
139
|
-
*
|
140
|
-
* @
|
141
|
-
*
|
142
|
-
*
|
201
|
+
* Get file status for a single file.
|
202
|
+
*
|
203
|
+
* This is not quite the same as calling `git_status_foreach_ext()` with
|
204
|
+
* the pathspec set to the specified path.
|
205
|
+
*
|
206
|
+
* @param status_flags The status value for the file
|
207
|
+
* @param repo A repository object
|
208
|
+
* @param path The file to retrieve status for, rooted at the repo's workdir
|
209
|
+
* @return 0 on success, GIT_ENOTFOUND if the file is not found in the HEAD,
|
210
|
+
* index, and work tree, GIT_EINVALIDPATH if `path` points at a folder,
|
211
|
+
* GIT_EAMBIGUOUS if "path" matches multiple files, -1 on other error.
|
143
212
|
*/
|
144
213
|
GIT_EXTERN(int) git_status_file(
|
145
214
|
unsigned int *status_flags,
|
@@ -151,14 +220,14 @@ GIT_EXTERN(int) git_status_file(
|
|
151
220
|
*
|
152
221
|
* This function checks the ignore rules to see if they would apply to the
|
153
222
|
* given file. This indicates if the file would be ignored regardless of
|
154
|
-
* whether the file is already in the index or
|
223
|
+
* whether the file is already in the index or committed to the repository.
|
155
224
|
*
|
156
225
|
* One way to think of this is if you were to do "git add ." on the
|
157
226
|
* directory containing the file, would it be added or not?
|
158
227
|
*
|
159
|
-
* @param ignored
|
160
|
-
* @param repo
|
161
|
-
* @param path
|
228
|
+
* @param ignored Boolean returning 0 if the file is not ignored, 1 if it is
|
229
|
+
* @param repo A repository object
|
230
|
+
* @param path The file to check ignores for, rooted at the repo's workdir.
|
162
231
|
* @return 0 if ignore rules could be processed for the file (regardless
|
163
232
|
* of whether it exists or not), or an error < 0 if they could not.
|
164
233
|
*/
|