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.
|
@@ -89,6 +89,15 @@ typedef struct git_odb_object git_odb_object;
|
|
89
89
|
/** A stream to read/write from the ODB */
|
90
90
|
typedef struct git_odb_stream git_odb_stream;
|
91
91
|
|
92
|
+
/** A stream to write a packfile to the ODB */
|
93
|
+
typedef struct git_odb_writepack git_odb_writepack;
|
94
|
+
|
95
|
+
/** An open refs database handle. */
|
96
|
+
typedef struct git_refdb git_refdb;
|
97
|
+
|
98
|
+
/** A custom backend for refs */
|
99
|
+
typedef struct git_refdb_backend git_refdb_backend;
|
100
|
+
|
92
101
|
/**
|
93
102
|
* Representation of an existing git repository,
|
94
103
|
* including all its object contents
|
@@ -126,7 +135,7 @@ typedef struct git_index git_index;
|
|
126
135
|
typedef struct git_config git_config;
|
127
136
|
|
128
137
|
/** Interface to access a configuration file */
|
129
|
-
typedef struct
|
138
|
+
typedef struct git_config_backend git_config_backend;
|
130
139
|
|
131
140
|
/** Representation of a reference log entry */
|
132
141
|
typedef struct git_reflog_entry git_reflog_entry;
|
@@ -161,9 +170,7 @@ typedef enum {
|
|
161
170
|
GIT_REF_INVALID = 0, /** Invalid reference */
|
162
171
|
GIT_REF_OID = 1, /** A reference which points at an object id */
|
163
172
|
GIT_REF_SYMBOLIC = 2, /** A reference which points at another reference */
|
164
|
-
|
165
|
-
GIT_REF_HAS_PEEL = 8,
|
166
|
-
GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC|GIT_REF_PACKED,
|
173
|
+
GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC,
|
167
174
|
} git_ref_t;
|
168
175
|
|
169
176
|
/** Basic type of any Git branch. */
|
@@ -172,13 +179,6 @@ typedef enum {
|
|
172
179
|
GIT_BRANCH_REMOTE = 2,
|
173
180
|
} git_branch_t;
|
174
181
|
|
175
|
-
/** Kinds of reset operation. */
|
176
|
-
typedef enum {
|
177
|
-
GIT_RESET_SOFT = 1,
|
178
|
-
GIT_RESET_MIXED = 2,
|
179
|
-
GIT_RESET_HARD = 3,
|
180
|
-
} git_reset_type;
|
181
|
-
|
182
182
|
/** Valid modes for index and tree entries. */
|
183
183
|
typedef enum {
|
184
184
|
GIT_FILEMODE_NEW = 0000000,
|
@@ -191,6 +191,7 @@ typedef enum {
|
|
191
191
|
|
192
192
|
typedef struct git_refspec git_refspec;
|
193
193
|
typedef struct git_remote git_remote;
|
194
|
+
typedef struct git_push git_push;
|
194
195
|
|
195
196
|
typedef struct git_remote_head git_remote_head;
|
196
197
|
typedef struct git_remote_callbacks git_remote_callbacks;
|
@@ -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.
|
@@ -7,9 +7,9 @@
|
|
7
7
|
#ifndef INCLUDE_git_version_h__
|
8
8
|
#define INCLUDE_git_version_h__
|
9
9
|
|
10
|
-
#define LIBGIT2_VERSION "0.
|
10
|
+
#define LIBGIT2_VERSION "0.18.0"
|
11
11
|
#define LIBGIT2_VER_MAJOR 0
|
12
|
-
#define LIBGIT2_VER_MINOR
|
12
|
+
#define LIBGIT2_VER_MINOR 18
|
13
13
|
#define LIBGIT2_VER_REVISION 0
|
14
14
|
|
15
15
|
#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.
|
@@ -27,7 +27,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
|
|
27
27
|
out->data = malloc(len);
|
28
28
|
GITERR_CHECK_ALLOC(out->data);
|
29
29
|
|
30
|
-
if (p_lseek(fd, offset, SEEK_SET) < 0 || p_read(fd, out->data, len) != len)
|
30
|
+
if ((p_lseek(fd, offset, SEEK_SET) < 0) || ((size_t)p_read(fd, out->data, len) != len)) {
|
31
31
|
giterr_set(GITERR_OS, "mmap emulation failed");
|
32
32
|
return -1;
|
33
33
|
}
|
data/vendor/libgit2/src/attr.c
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
#include "repository.h"
|
2
2
|
#include "fileops.h"
|
3
3
|
#include "config.h"
|
4
|
+
#include "attr.h"
|
5
|
+
#include "ignore.h"
|
4
6
|
#include "git2/oid.h"
|
5
7
|
#include <ctype.h>
|
6
8
|
|
@@ -61,8 +63,9 @@ int git_attr_get(
|
|
61
63
|
git_vector_foreach(&files, i, file) {
|
62
64
|
|
63
65
|
git_attr_file__foreach_matching_rule(file, &path, j, rule) {
|
64
|
-
|
65
|
-
|
66
|
+
size_t pos;
|
67
|
+
|
68
|
+
if (!git_vector_bsearch(&pos, &rule->assigns, &attr)) {
|
66
69
|
*value = ((git_attr_assignment *)git_vector_get(
|
67
70
|
&rule->assigns, pos))->value;
|
68
71
|
goto cleanup;
|
@@ -116,7 +119,7 @@ int git_attr_get_many(
|
|
116
119
|
git_attr_file__foreach_matching_rule(file, &path, j, rule) {
|
117
120
|
|
118
121
|
for (k = 0; k < num_attr; k++) {
|
119
|
-
|
122
|
+
size_t pos;
|
120
123
|
|
121
124
|
if (info[k].found != NULL) /* already found assignment */
|
122
125
|
continue;
|
@@ -126,8 +129,7 @@ int git_attr_get_many(
|
|
126
129
|
info[k].name.name_hash = git_attr_file__name_hash(names[k]);
|
127
130
|
}
|
128
131
|
|
129
|
-
|
130
|
-
if (pos >= 0) {
|
132
|
+
if (!git_vector_bsearch(&pos, &rule->assigns, &info[k].name)) {
|
131
133
|
info[k].found = (git_attr_assignment *)
|
132
134
|
git_vector_get(&rule->assigns, pos);
|
133
135
|
values[k] = info[k].found->value;
|
@@ -261,30 +263,30 @@ bool git_attr_cache__is_cached(
|
|
261
263
|
|
262
264
|
static int load_attr_file(
|
263
265
|
const char **data,
|
264
|
-
|
266
|
+
git_futils_filestamp *stamp,
|
265
267
|
const char *filename)
|
266
268
|
{
|
267
269
|
int error;
|
268
270
|
git_buf content = GIT_BUF_INIT;
|
269
|
-
struct stat st;
|
270
271
|
|
271
|
-
|
272
|
-
|
272
|
+
error = git_futils_filestamp_check(stamp, filename);
|
273
|
+
if (error < 0)
|
274
|
+
return error;
|
273
275
|
|
274
|
-
if
|
275
|
-
|
276
|
-
|
277
|
-
|
276
|
+
/* if error == 0, then file is up to date. By returning GIT_ENOTFOUND,
|
277
|
+
* we tell the caller not to reparse this file...
|
278
|
+
*/
|
279
|
+
if (!error)
|
278
280
|
return GIT_ENOTFOUND;
|
279
281
|
|
280
|
-
error =
|
281
|
-
if (error < 0)
|
282
|
-
|
282
|
+
error = git_futils_readbuffer(&content, filename);
|
283
|
+
if (error < 0) {
|
284
|
+
/* convert error into ENOTFOUND so failed permissions / invalid
|
285
|
+
* file type don't actually stop the operation in progress.
|
286
|
+
*/
|
287
|
+
return GIT_ENOTFOUND;
|
283
288
|
|
284
|
-
|
285
|
-
sig->seconds = (git_time_t)st.st_mtime;
|
286
|
-
sig->size = (git_off_t)st.st_size;
|
287
|
-
sig->ino = (unsigned int)st.st_ino;
|
289
|
+
/* TODO: once warnings are available, issue a warning callback */
|
288
290
|
}
|
289
291
|
|
290
292
|
*data = git_buf_detach(&content);
|
@@ -300,14 +302,15 @@ static int load_attr_blob_from_index(
|
|
300
302
|
const char *relfile)
|
301
303
|
{
|
302
304
|
int error;
|
305
|
+
size_t pos;
|
303
306
|
git_index *index;
|
304
|
-
git_index_entry *entry;
|
307
|
+
const git_index_entry *entry;
|
305
308
|
|
306
309
|
if ((error = git_repository_index__weakptr(&index, repo)) < 0 ||
|
307
|
-
(error = git_index_find(index, relfile)) < 0)
|
310
|
+
(error = git_index_find(&pos, index, relfile)) < 0)
|
308
311
|
return error;
|
309
312
|
|
310
|
-
entry =
|
313
|
+
entry = git_index_get_byindex(index, pos);
|
311
314
|
|
312
315
|
if (old_oid && git_oid_cmp(old_oid, &entry->oid) == 0)
|
313
316
|
return GIT_ENOTFOUND;
|
@@ -386,7 +389,7 @@ int git_attr_cache__push_file(
|
|
386
389
|
git_attr_cache *cache = git_repository_attr_cache(repo);
|
387
390
|
git_attr_file *file = NULL;
|
388
391
|
git_blob *blob = NULL;
|
389
|
-
|
392
|
+
git_futils_filestamp stamp;
|
390
393
|
|
391
394
|
assert(filename && stack);
|
392
395
|
|
@@ -408,12 +411,10 @@ int git_attr_cache__push_file(
|
|
408
411
|
/* if not in cache, load data, parse, and cache */
|
409
412
|
|
410
413
|
if (source == GIT_ATTR_FILE_FROM_FILE) {
|
411
|
-
|
412
|
-
|
413
|
-
else
|
414
|
-
memset(&st, 0, sizeof(st));
|
414
|
+
git_futils_filestamp_set(
|
415
|
+
&stamp, file ? &file->cache_data.stamp : NULL);
|
415
416
|
|
416
|
-
error = load_attr_file(&content, &
|
417
|
+
error = load_attr_file(&content, &stamp, filename);
|
417
418
|
} else {
|
418
419
|
error = load_attr_blob_from_index(&content, &blob,
|
419
420
|
repo, file ? &file->cache_data.oid : NULL, relfile);
|
@@ -448,7 +449,7 @@ int git_attr_cache__push_file(
|
|
448
449
|
if (blob)
|
449
450
|
git_oid_cpy(&file->cache_data.oid, git_object_id((git_object *)blob));
|
450
451
|
else
|
451
|
-
|
452
|
+
git_futils_filestamp_set(&file->cache_data.stamp, &stamp);
|
452
453
|
|
453
454
|
finish:
|
454
455
|
/* push file onto vector if we found one*/
|
@@ -580,8 +581,10 @@ static int collect_attr_files(
|
|
580
581
|
error = git_futils_find_system_file(&dir, GIT_ATTR_FILE_SYSTEM);
|
581
582
|
if (!error)
|
582
583
|
error = push_attr_file(repo, files, NULL, dir.ptr);
|
583
|
-
else if (error == GIT_ENOTFOUND)
|
584
|
+
else if (error == GIT_ENOTFOUND) {
|
585
|
+
giterr_clear();
|
584
586
|
error = 0;
|
587
|
+
}
|
585
588
|
}
|
586
589
|
|
587
590
|
cleanup:
|
@@ -592,17 +595,28 @@ static int collect_attr_files(
|
|
592
595
|
return error;
|
593
596
|
}
|
594
597
|
|
595
|
-
static
|
598
|
+
static int attr_cache__lookup_path(
|
599
|
+
const char **out, git_config *cfg, const char *key, const char *fallback)
|
596
600
|
{
|
597
|
-
git_buf
|
598
|
-
|
601
|
+
git_buf buf = GIT_BUF_INIT;
|
602
|
+
int error;
|
599
603
|
|
600
|
-
if (!
|
601
|
-
|
604
|
+
if (!(error = git_config_get_string(out, cfg, key)))
|
605
|
+
return 0;
|
602
606
|
|
603
|
-
|
607
|
+
if (error == GIT_ENOTFOUND) {
|
608
|
+
giterr_clear();
|
609
|
+
error = 0;
|
604
610
|
|
605
|
-
|
611
|
+
if (!git_futils_find_xdg_file(&buf, fallback))
|
612
|
+
*out = git_buf_detach(&buf);
|
613
|
+
else
|
614
|
+
*out = NULL;
|
615
|
+
|
616
|
+
git_buf_free(&buf);
|
617
|
+
}
|
618
|
+
|
619
|
+
return error;
|
606
620
|
}
|
607
621
|
|
608
622
|
int git_attr_cache__init(git_repository *repo)
|
@@ -618,19 +632,15 @@ int git_attr_cache__init(git_repository *repo)
|
|
618
632
|
if (git_repository_config__weakptr(&cfg, repo) < 0)
|
619
633
|
return -1;
|
620
634
|
|
621
|
-
ret =
|
622
|
-
|
635
|
+
ret = attr_cache__lookup_path(
|
636
|
+
&cache->cfg_attr_file, cfg, GIT_ATTR_CONFIG, GIT_ATTR_FILE_XDG);
|
637
|
+
if (ret < 0)
|
623
638
|
return ret;
|
624
|
-
if (ret == GIT_ENOTFOUND)
|
625
|
-
cache->cfg_attr_file = try_global_default(GIT_ATTR_CONFIG_DEFAULT);
|
626
639
|
|
627
|
-
ret =
|
628
|
-
|
640
|
+
ret = attr_cache__lookup_path(
|
641
|
+
&cache->cfg_excl_file, cfg, GIT_IGNORE_CONFIG, GIT_IGNORE_FILE_XDG);
|
642
|
+
if (ret < 0)
|
629
643
|
return ret;
|
630
|
-
if (ret == GIT_ENOTFOUND)
|
631
|
-
cache->cfg_excl_file = try_global_default(GIT_IGNORE_CONFIG_DEFAULT);
|
632
|
-
|
633
|
-
giterr_clear();
|
634
644
|
|
635
645
|
/* allocate hashtable for attribute and ignore file contents */
|
636
646
|
if (cache->files == NULL) {
|
data/vendor/libgit2/src/attr.h
CHANGED
@@ -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.
|
@@ -8,27 +8,13 @@
|
|
8
8
|
#define INCLUDE_attr_h__
|
9
9
|
|
10
10
|
#include "attr_file.h"
|
11
|
-
|
12
|
-
|
13
|
-
#define
|
14
|
-
#define GIT_ATTR_CONFIG_DEFAULT ".config/git/attributes"
|
15
|
-
#define GIT_IGNORE_CONFIG "core.excludesfile"
|
16
|
-
#define GIT_IGNORE_CONFIG_DEFAULT ".config/git/ignore"
|
17
|
-
|
18
|
-
typedef struct {
|
19
|
-
int initialized;
|
20
|
-
git_pool pool;
|
21
|
-
git_strmap *files; /* hash path to git_attr_file of rules */
|
22
|
-
git_strmap *macros; /* hash name to vector<git_attr_assignment> */
|
23
|
-
const char *cfg_attr_file; /* cached value of core.attributesfile */
|
24
|
-
const char *cfg_excl_file; /* cached value of core.excludesfile */
|
25
|
-
} git_attr_cache;
|
11
|
+
|
12
|
+
#define GIT_ATTR_CONFIG "core.attributesfile"
|
13
|
+
#define GIT_IGNORE_CONFIG "core.excludesfile"
|
26
14
|
|
27
15
|
typedef int (*git_attr_file_parser)(
|
28
16
|
git_repository *, void *, const char *, git_attr_file *);
|
29
17
|
|
30
|
-
extern int git_attr_cache__init(git_repository *repo);
|
31
|
-
|
32
18
|
extern int git_attr_cache__insert_macro(
|
33
19
|
git_repository *repo, git_attr_rule *macro);
|
34
20
|
|
@@ -1,12 +1,17 @@
|
|
1
1
|
#include "common.h"
|
2
2
|
#include "repository.h"
|
3
3
|
#include "filebuf.h"
|
4
|
+
#include "attr.h"
|
4
5
|
#include "git2/blob.h"
|
5
6
|
#include "git2/tree.h"
|
6
7
|
#include <ctype.h>
|
7
8
|
|
8
9
|
static int sort_by_hash_and_name(const void *a_raw, const void *b_raw);
|
9
10
|
static void git_attr_rule__clear(git_attr_rule *rule);
|
11
|
+
static bool parse_optimized_patterns(
|
12
|
+
git_attr_fnmatch *spec,
|
13
|
+
git_pool *pool,
|
14
|
+
const char *pattern);
|
10
15
|
|
11
16
|
int git_attr_file__new(
|
12
17
|
git_attr_file **attrs_ptr,
|
@@ -191,9 +196,9 @@ int git_attr_file__lookup_one(
|
|
191
196
|
name.name_hash = git_attr_file__name_hash(attr);
|
192
197
|
|
193
198
|
git_attr_file__foreach_matching_rule(file, path, i, rule) {
|
194
|
-
|
199
|
+
size_t pos;
|
195
200
|
|
196
|
-
if (pos
|
201
|
+
if (!git_vector_bsearch(&pos, &rule->assigns, &name)) {
|
197
202
|
*value = ((git_attr_assignment *)
|
198
203
|
git_vector_get(&rule->assigns, pos))->value;
|
199
204
|
break;
|
@@ -240,14 +245,15 @@ bool git_attr_rule__match(
|
|
240
245
|
git_attr_assignment *git_attr_rule__lookup_assignment(
|
241
246
|
git_attr_rule *rule, const char *name)
|
242
247
|
{
|
243
|
-
|
248
|
+
size_t pos;
|
244
249
|
git_attr_name key;
|
245
250
|
key.name = name;
|
246
251
|
key.name_hash = git_attr_file__name_hash(name);
|
247
252
|
|
248
|
-
|
253
|
+
if (git_vector_bsearch(&pos, &rule->assigns, &key))
|
254
|
+
return NULL;
|
249
255
|
|
250
|
-
return
|
256
|
+
return git_vector_get(&rule->assigns, pos);
|
251
257
|
}
|
252
258
|
|
253
259
|
int git_attr_path__init(
|
@@ -294,7 +300,6 @@ void git_attr_path__free(git_attr_path *info)
|
|
294
300
|
info->basename = NULL;
|
295
301
|
}
|
296
302
|
|
297
|
-
|
298
303
|
/*
|
299
304
|
* From gitattributes(5):
|
300
305
|
*
|
@@ -343,6 +348,9 @@ int git_attr_fnmatch__parse(
|
|
343
348
|
|
344
349
|
assert(spec && base && *base);
|
345
350
|
|
351
|
+
if (parse_optimized_patterns(spec, pool, *base))
|
352
|
+
return 0;
|
353
|
+
|
346
354
|
spec->flags = (spec->flags & GIT_ATTR_FNMATCH_ALLOWSPACE);
|
347
355
|
allow_space = (spec->flags != 0);
|
348
356
|
|
@@ -428,6 +436,22 @@ int git_attr_fnmatch__parse(
|
|
428
436
|
return 0;
|
429
437
|
}
|
430
438
|
|
439
|
+
static bool parse_optimized_patterns(
|
440
|
+
git_attr_fnmatch *spec,
|
441
|
+
git_pool *pool,
|
442
|
+
const char *pattern)
|
443
|
+
{
|
444
|
+
if (!pattern[1] && (pattern[0] == '*' || pattern[0] == '.')) {
|
445
|
+
spec->flags = GIT_ATTR_FNMATCH_MATCH_ALL;
|
446
|
+
spec->pattern = git_pool_strndup(pool, pattern, 1);
|
447
|
+
spec->length = 1;
|
448
|
+
|
449
|
+
return true;
|
450
|
+
}
|
451
|
+
|
452
|
+
return false;
|
453
|
+
}
|
454
|
+
|
431
455
|
static int sort_by_hash_and_name(const void *a_raw, const void *b_raw)
|
432
456
|
{
|
433
457
|
const git_attr_name *a = a_raw;
|
@@ -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.
|
@@ -7,14 +7,17 @@
|
|
7
7
|
#ifndef INCLUDE_attr_file_h__
|
8
8
|
#define INCLUDE_attr_file_h__
|
9
9
|
|
10
|
+
#include "git2/oid.h"
|
10
11
|
#include "git2/attr.h"
|
11
12
|
#include "vector.h"
|
12
13
|
#include "pool.h"
|
13
14
|
#include "buffer.h"
|
15
|
+
#include "fileops.h"
|
14
16
|
|
15
17
|
#define GIT_ATTR_FILE ".gitattributes"
|
16
18
|
#define GIT_ATTR_FILE_INREPO "info/attributes"
|
17
19
|
#define GIT_ATTR_FILE_SYSTEM "gitattributes"
|
20
|
+
#define GIT_ATTR_FILE_XDG "attributes"
|
18
21
|
|
19
22
|
#define GIT_ATTR_FNMATCH_NEGATIVE (1U << 0)
|
20
23
|
#define GIT_ATTR_FNMATCH_DIRECTORY (1U << 1)
|
@@ -24,6 +27,7 @@
|
|
24
27
|
#define GIT_ATTR_FNMATCH_HASWILD (1U << 5)
|
25
28
|
#define GIT_ATTR_FNMATCH_ALLOWSPACE (1U << 6)
|
26
29
|
#define GIT_ATTR_FNMATCH_ICASE (1U << 7)
|
30
|
+
#define GIT_ATTR_FNMATCH_MATCH_ALL (1U << 8)
|
27
31
|
|
28
32
|
extern const char *git_attr__true;
|
29
33
|
extern const char *git_attr__false;
|
@@ -53,12 +57,6 @@ typedef struct {
|
|
53
57
|
const char *value;
|
54
58
|
} git_attr_assignment;
|
55
59
|
|
56
|
-
typedef struct {
|
57
|
-
git_time_t seconds;
|
58
|
-
git_off_t size;
|
59
|
-
unsigned int ino;
|
60
|
-
} git_attr_file_stat_sig;
|
61
|
-
|
62
60
|
typedef struct {
|
63
61
|
char *key; /* cache "source#path" this was loaded from */
|
64
62
|
git_vector rules; /* vector of <rule*> or <fnmatch*> */
|
@@ -66,7 +64,7 @@ typedef struct {
|
|
66
64
|
bool pool_is_allocated;
|
67
65
|
union {
|
68
66
|
git_oid oid;
|
69
|
-
|
67
|
+
git_futils_filestamp stamp;
|
70
68
|
} cache_data;
|
71
69
|
} git_attr_file;
|
72
70
|
|