rugged 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +1 -1
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +11 -6
- data/vendor/libgit2/COPYING +109 -1
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +4 -0
- data/vendor/libgit2/cmake/SelectHashes.cmake +1 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +18 -5
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -34
- data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +156 -124
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
- data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
- data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
- data/vendor/libgit2/include/git2/apply.h +2 -0
- data/vendor/libgit2/include/git2/attr.h +89 -0
- data/vendor/libgit2/include/git2/blame.h +93 -42
- data/vendor/libgit2/include/git2/blob.h +31 -3
- data/vendor/libgit2/include/git2/branch.h +25 -0
- data/vendor/libgit2/include/git2/cert.h +42 -5
- data/vendor/libgit2/include/git2/checkout.h +28 -12
- data/vendor/libgit2/include/git2/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +19 -4
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/deprecated.h +206 -6
- data/vendor/libgit2/include/git2/diff.h +35 -20
- data/vendor/libgit2/include/git2/errors.h +6 -6
- data/vendor/libgit2/include/git2/filter.h +57 -17
- data/vendor/libgit2/include/git2/graph.h +20 -2
- data/vendor/libgit2/include/git2/index.h +3 -3
- data/vendor/libgit2/include/git2/indexer.h +2 -1
- data/vendor/libgit2/include/git2/odb.h +44 -20
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/rebase.h +25 -1
- data/vendor/libgit2/include/git2/refs.h +9 -5
- data/vendor/libgit2/include/git2/remote.h +59 -6
- data/vendor/libgit2/include/git2/repository.h +95 -52
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/status.h +115 -59
- data/vendor/libgit2/include/git2/submodule.h +9 -0
- data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
- data/vendor/libgit2/include/git2/sys/filter.h +49 -28
- data/vendor/libgit2/include/git2/sys/midx.h +74 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/include/git2/tag.h +12 -0
- data/vendor/libgit2/include/git2/transport.h +1 -1
- data/vendor/libgit2/include/git2/tree.h +2 -14
- data/vendor/libgit2/include/git2/types.h +9 -0
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +25 -4
- data/vendor/libgit2/src/alloc.c +21 -8
- data/vendor/libgit2/src/allocators/failalloc.c +92 -0
- data/vendor/libgit2/src/allocators/failalloc.h +23 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
- data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
- data/vendor/libgit2/src/annotated_commit.c +21 -9
- data/vendor/libgit2/src/apply.c +16 -7
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/attr.c +181 -74
- data/vendor/libgit2/src/attr_file.c +84 -39
- data/vendor/libgit2/src/attr_file.h +32 -11
- data/vendor/libgit2/src/attrcache.c +42 -37
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +26 -15
- data/vendor/libgit2/src/blob.c +44 -24
- data/vendor/libgit2/src/branch.c +69 -17
- data/vendor/libgit2/src/buffer.c +334 -25
- data/vendor/libgit2/src/buffer.h +153 -2
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +10 -2
- data/vendor/libgit2/src/checkout.c +48 -26
- data/vendor/libgit2/src/cherrypick.c +6 -2
- data/vendor/libgit2/src/clone.c +26 -11
- data/vendor/libgit2/src/commit.c +41 -28
- data/vendor/libgit2/src/commit_graph.c +1209 -0
- data/vendor/libgit2/src/commit_graph.h +162 -0
- data/vendor/libgit2/src/commit_list.c +46 -0
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +25 -2
- data/vendor/libgit2/src/config.c +37 -15
- data/vendor/libgit2/src/config_cache.c +9 -4
- data/vendor/libgit2/src/config_file.c +16 -8
- data/vendor/libgit2/src/config_parse.c +4 -6
- data/vendor/libgit2/src/crlf.c +16 -6
- data/vendor/libgit2/src/date.c +4 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +6 -3
- data/vendor/libgit2/src/diff.c +11 -8
- data/vendor/libgit2/src/diff_driver.c +21 -17
- data/vendor/libgit2/src/diff_file.c +2 -6
- data/vendor/libgit2/src/diff_generate.c +46 -17
- data/vendor/libgit2/src/diff_print.c +19 -6
- data/vendor/libgit2/src/diff_stats.c +7 -5
- data/vendor/libgit2/src/diff_tform.c +11 -10
- data/vendor/libgit2/src/diff_xdiff.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/errors.c +24 -19
- data/vendor/libgit2/src/features.h.in +5 -1
- data/vendor/libgit2/src/fetch.c +5 -2
- data/vendor/libgit2/src/fetchhead.c +8 -4
- data/vendor/libgit2/src/filebuf.c +9 -7
- data/vendor/libgit2/src/filter.c +206 -110
- data/vendor/libgit2/src/filter.h +24 -5
- data/vendor/libgit2/src/futils.c +5 -5
- data/vendor/libgit2/src/futils.h +1 -1
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
- data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +0 -2
- data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
- data/vendor/libgit2/src/hash.c +16 -13
- data/vendor/libgit2/src/hash.h +1 -1
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +13 -3
- data/vendor/libgit2/src/ignore.c +35 -19
- data/vendor/libgit2/src/index.c +112 -75
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +50 -32
- data/vendor/libgit2/src/integer.h +79 -2
- data/vendor/libgit2/src/iterator.c +36 -24
- data/vendor/libgit2/src/iterator.h +1 -1
- data/vendor/libgit2/src/khash.h +2 -11
- data/vendor/libgit2/src/{settings.c → libgit2.c} +117 -50
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +23 -10
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +75 -32
- data/vendor/libgit2/src/merge.h +2 -1
- data/vendor/libgit2/src/merge_driver.c +19 -13
- data/vendor/libgit2/src/merge_file.c +11 -3
- data/vendor/libgit2/src/message.c +3 -1
- data/vendor/libgit2/src/midx.c +471 -10
- data/vendor/libgit2/src/midx.h +28 -1
- data/vendor/libgit2/src/mwindow.c +106 -60
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +127 -3
- data/vendor/libgit2/src/net.h +16 -2
- data/vendor/libgit2/src/netops.c +6 -4
- data/vendor/libgit2/src/netops.h +2 -2
- data/vendor/libgit2/src/notes.c +10 -10
- data/vendor/libgit2/src/object.c +22 -14
- data/vendor/libgit2/src/odb.c +289 -51
- data/vendor/libgit2/src/odb.h +16 -2
- data/vendor/libgit2/src/odb_loose.c +28 -18
- data/vendor/libgit2/src/odb_mempack.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +391 -114
- data/vendor/libgit2/src/oid.c +5 -4
- data/vendor/libgit2/src/pack-objects.c +54 -48
- data/vendor/libgit2/src/pack.c +339 -125
- data/vendor/libgit2/src/pack.h +25 -7
- data/vendor/libgit2/src/patch.c +14 -7
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +2 -1
- data/vendor/libgit2/src/path.c +98 -53
- data/vendor/libgit2/src/path.h +79 -6
- data/vendor/libgit2/src/pathspec.c +8 -8
- data/vendor/libgit2/src/pool.c +13 -7
- data/vendor/libgit2/src/posix.c +43 -12
- data/vendor/libgit2/src/posix.h +9 -0
- data/vendor/libgit2/src/reader.c +10 -6
- data/vendor/libgit2/src/rebase.c +93 -49
- data/vendor/libgit2/src/refdb.c +30 -13
- data/vendor/libgit2/src/refdb_fs.c +125 -71
- data/vendor/libgit2/src/reflog.c +19 -14
- data/vendor/libgit2/src/refs.c +91 -43
- data/vendor/libgit2/src/refs.h +1 -1
- data/vendor/libgit2/src/refspec.c +80 -44
- data/vendor/libgit2/src/remote.c +281 -105
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +191 -118
- data/vendor/libgit2/src/repository.h +13 -2
- data/vendor/libgit2/src/reset.c +7 -6
- data/vendor/libgit2/src/revert.c +6 -2
- data/vendor/libgit2/src/revparse.c +14 -9
- data/vendor/libgit2/src/revwalk.c +32 -15
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/settings.h +11 -0
- data/vendor/libgit2/src/signature.c +6 -5
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +3 -1
- data/vendor/libgit2/src/status.c +7 -4
- data/vendor/libgit2/src/strarray.c +2 -1
- data/vendor/libgit2/src/streams/mbedtls.c +14 -17
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +101 -201
- data/vendor/libgit2/src/streams/openssl.h +9 -1
- data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
- data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
- data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
- data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
- data/vendor/libgit2/src/streams/registry.c +5 -6
- data/vendor/libgit2/src/streams/socket.c +6 -2
- data/vendor/libgit2/src/streams/stransport.c +6 -3
- data/vendor/libgit2/src/streams/tls.c +5 -3
- data/vendor/libgit2/src/submodule.c +128 -62
- data/vendor/libgit2/src/submodule.h +9 -9
- data/vendor/libgit2/src/sysdir.c +4 -6
- data/vendor/libgit2/src/tag.c +47 -11
- data/vendor/libgit2/src/thread.c +140 -0
- data/vendor/libgit2/src/thread.h +479 -0
- data/vendor/libgit2/src/threadstate.c +83 -0
- data/vendor/libgit2/src/threadstate.h +24 -0
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +17 -13
- data/vendor/libgit2/src/transaction.c +19 -8
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
- data/vendor/libgit2/src/transports/credential.c +15 -7
- data/vendor/libgit2/src/transports/git.c +1 -3
- data/vendor/libgit2/src/transports/http.c +19 -17
- data/vendor/libgit2/src/transports/http.h +1 -0
- data/vendor/libgit2/src/transports/httpclient.c +62 -30
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +3 -3
- data/vendor/libgit2/src/transports/smart.c +12 -7
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
- data/vendor/libgit2/src/transports/ssh.c +51 -17
- data/vendor/libgit2/src/transports/winhttp.c +138 -81
- data/vendor/libgit2/src/tree.c +100 -77
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -1
- data/vendor/libgit2/src/unix/posix.h +3 -0
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +53 -129
- data/vendor/libgit2/src/util.h +33 -39
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +4 -2
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
- data/vendor/libgit2/src/win32/path_w32.c +22 -24
- data/vendor/libgit2/src/win32/path_w32.h +0 -1
- data/vendor/libgit2/src/win32/posix_w32.c +77 -1
- data/vendor/libgit2/src/win32/precompiled.h +0 -1
- data/vendor/libgit2/src/win32/reparse.h +4 -4
- data/vendor/libgit2/src/win32/thread.c +24 -15
- data/vendor/libgit2/src/win32/thread.h +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
- data/vendor/libgit2/src/win32/w32_common.h +18 -9
- data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
- data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -6
- data/vendor/libgit2/src/worktree.c +32 -14
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +32 -16
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/buf_text.c +0 -316
- data/vendor/libgit2/src/buf_text.h +0 -122
- data/vendor/libgit2/src/global.c +0 -363
- data/vendor/libgit2/src/global.h +0 -41
- data/vendor/libgit2/src/thread-utils.c +0 -58
- data/vendor/libgit2/src/thread-utils.h +0 -364
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
- data/vendor/libgit2/src/win32/w32_stack.c +0 -188
- data/vendor/libgit2/src/win32/w32_stack.h +0 -140
data/vendor/libgit2/src/filter.c
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
#include "futils.h"
|
12
12
|
#include "hash.h"
|
13
13
|
#include "repository.h"
|
14
|
-
#include "
|
14
|
+
#include "runtime.h"
|
15
15
|
#include "git2/sys/filter.h"
|
16
16
|
#include "git2/config.h"
|
17
17
|
#include "blob.h"
|
@@ -19,12 +19,12 @@
|
|
19
19
|
#include "array.h"
|
20
20
|
|
21
21
|
struct git_filter_source {
|
22
|
-
git_repository
|
23
|
-
const char
|
24
|
-
git_oid
|
25
|
-
uint16_t
|
26
|
-
git_filter_mode_t
|
27
|
-
|
22
|
+
git_repository *repo;
|
23
|
+
const char *path;
|
24
|
+
git_oid oid; /* zero if unknown (which is likely) */
|
25
|
+
uint16_t filemode; /* zero if unknown */
|
26
|
+
git_filter_mode_t mode;
|
27
|
+
git_filter_options options;
|
28
28
|
};
|
29
29
|
|
30
30
|
typedef struct {
|
@@ -206,7 +206,8 @@ int git_filter_global_init(void)
|
|
206
206
|
GIT_FILTER_IDENT, ident, GIT_FILTER_IDENT_PRIORITY) < 0)
|
207
207
|
error = -1;
|
208
208
|
|
209
|
-
|
209
|
+
if (!error)
|
210
|
+
error = git_runtime_shutdown_register(git_filter_global_shutdown);
|
210
211
|
|
211
212
|
done:
|
212
213
|
if (error) {
|
@@ -266,7 +267,8 @@ int git_filter_register(
|
|
266
267
|
{
|
267
268
|
int error;
|
268
269
|
|
269
|
-
|
270
|
+
GIT_ASSERT_ARG(name);
|
271
|
+
GIT_ASSERT_ARG(filter);
|
270
272
|
|
271
273
|
if (git_rwlock_wrlock(&filter_registry.lock) < 0) {
|
272
274
|
git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
|
@@ -293,7 +295,7 @@ int git_filter_unregister(const char *name)
|
|
293
295
|
git_filter_def *fdef;
|
294
296
|
int error = 0;
|
295
297
|
|
296
|
-
|
298
|
+
GIT_ASSERT_ARG(name);
|
297
299
|
|
298
300
|
/* cannot unregister default filters */
|
299
301
|
if (!strcmp(GIT_FILTER_CRLF, name) || !strcmp(GIT_FILTER_IDENT, name)) {
|
@@ -395,7 +397,7 @@ git_filter_mode_t git_filter_source_mode(const git_filter_source *src)
|
|
395
397
|
|
396
398
|
uint32_t git_filter_source_flags(const git_filter_source *src)
|
397
399
|
{
|
398
|
-
return src->flags;
|
400
|
+
return src->options.flags;
|
399
401
|
}
|
400
402
|
|
401
403
|
static int filter_list_new(
|
@@ -415,7 +417,8 @@ static int filter_list_new(
|
|
415
417
|
fl->source.repo = src->repo;
|
416
418
|
fl->source.path = fl->path;
|
417
419
|
fl->source.mode = src->mode;
|
418
|
-
|
420
|
+
|
421
|
+
memcpy(&fl->source.options, &src->options, sizeof(git_filter_options));
|
419
422
|
|
420
423
|
*out = fl;
|
421
424
|
return 0;
|
@@ -424,25 +427,30 @@ static int filter_list_new(
|
|
424
427
|
static int filter_list_check_attributes(
|
425
428
|
const char ***out,
|
426
429
|
git_repository *repo,
|
427
|
-
|
430
|
+
git_filter_session *filter_session,
|
428
431
|
git_filter_def *fdef,
|
429
432
|
const git_filter_source *src)
|
430
433
|
{
|
431
434
|
const char **strs = git__calloc(fdef->nattrs, sizeof(const char *));
|
432
|
-
|
435
|
+
git_attr_options attr_opts = GIT_ATTR_OPTIONS_INIT;
|
433
436
|
size_t i;
|
434
437
|
int error;
|
435
438
|
|
436
439
|
GIT_ERROR_CHECK_ALLOC(strs);
|
437
440
|
|
438
|
-
if ((src->flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
|
439
|
-
flags |= GIT_ATTR_CHECK_NO_SYSTEM;
|
441
|
+
if ((src->options.flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
|
442
|
+
attr_opts.flags |= GIT_ATTR_CHECK_NO_SYSTEM;
|
443
|
+
|
444
|
+
if ((src->options.flags & GIT_FILTER_ATTRIBUTES_FROM_HEAD) != 0)
|
445
|
+
attr_opts.flags |= GIT_ATTR_CHECK_INCLUDE_HEAD;
|
440
446
|
|
441
|
-
if ((src->flags &
|
442
|
-
flags |=
|
447
|
+
if ((src->options.flags & GIT_FILTER_ATTRIBUTES_FROM_COMMIT) != 0) {
|
448
|
+
attr_opts.flags |= GIT_ATTR_CHECK_INCLUDE_COMMIT;
|
449
|
+
attr_opts.commit_id = src->options.commit_id;
|
450
|
+
}
|
443
451
|
|
444
452
|
error = git_attr_get_many_with_session(
|
445
|
-
strs, repo, attr_session,
|
453
|
+
strs, repo, filter_session->attr_session, &attr_opts, src->path, fdef->nattrs, fdef->attrs);
|
446
454
|
|
447
455
|
/* if no values were found but no matches are needed, it's okay! */
|
448
456
|
if (error == GIT_ENOTFOUND && !fdef->nmatches) {
|
@@ -487,17 +495,17 @@ int git_filter_list_new(
|
|
487
495
|
src.repo = repo;
|
488
496
|
src.path = NULL;
|
489
497
|
src.mode = mode;
|
490
|
-
src.flags = flags;
|
498
|
+
src.options.flags = flags;
|
491
499
|
return filter_list_new(out, &src);
|
492
500
|
}
|
493
501
|
|
494
|
-
int
|
502
|
+
int git_filter_list__load(
|
495
503
|
git_filter_list **filters,
|
496
504
|
git_repository *repo,
|
497
505
|
git_blob *blob, /* can be NULL */
|
498
506
|
const char *path,
|
499
507
|
git_filter_mode_t mode,
|
500
|
-
|
508
|
+
git_filter_session *filter_session)
|
501
509
|
{
|
502
510
|
int error = 0;
|
503
511
|
git_filter_list *fl = NULL;
|
@@ -514,7 +522,8 @@ int git_filter_list__load_ext(
|
|
514
522
|
src.repo = repo;
|
515
523
|
src.path = path;
|
516
524
|
src.mode = mode;
|
517
|
-
|
525
|
+
|
526
|
+
memcpy(&src.options, &filter_session->options, sizeof(git_filter_options));
|
518
527
|
|
519
528
|
if (blob)
|
520
529
|
git_oid_cpy(&src.oid, git_blob_id(blob));
|
@@ -528,7 +537,8 @@ int git_filter_list__load_ext(
|
|
528
537
|
|
529
538
|
if (fdef->nattrs > 0) {
|
530
539
|
error = filter_list_check_attributes(
|
531
|
-
&values, repo,
|
540
|
+
&values, repo,
|
541
|
+
filter_session, fdef, &src);
|
532
542
|
|
533
543
|
if (error == GIT_ENOTFOUND) {
|
534
544
|
error = 0;
|
@@ -555,7 +565,7 @@ int git_filter_list__load_ext(
|
|
555
565
|
if ((error = filter_list_new(&fl, &src)) < 0)
|
556
566
|
break;
|
557
567
|
|
558
|
-
fl->temp_buf =
|
568
|
+
fl->temp_buf = filter_session->temp_buf;
|
559
569
|
}
|
560
570
|
|
561
571
|
fe = git_array_alloc(fl->filters);
|
@@ -579,6 +589,23 @@ int git_filter_list__load_ext(
|
|
579
589
|
return error;
|
580
590
|
}
|
581
591
|
|
592
|
+
int git_filter_list_load_ext(
|
593
|
+
git_filter_list **filters,
|
594
|
+
git_repository *repo,
|
595
|
+
git_blob *blob, /* can be NULL */
|
596
|
+
const char *path,
|
597
|
+
git_filter_mode_t mode,
|
598
|
+
git_filter_options *opts)
|
599
|
+
{
|
600
|
+
git_filter_session filter_session = GIT_FILTER_SESSION_INIT;
|
601
|
+
|
602
|
+
if (opts)
|
603
|
+
memcpy(&filter_session.options, opts, sizeof(git_filter_options));
|
604
|
+
|
605
|
+
return git_filter_list__load(
|
606
|
+
filters, repo, blob, path, mode, &filter_session);
|
607
|
+
}
|
608
|
+
|
582
609
|
int git_filter_list_load(
|
583
610
|
git_filter_list **filters,
|
584
611
|
git_repository *repo,
|
@@ -587,12 +614,12 @@ int git_filter_list_load(
|
|
587
614
|
git_filter_mode_t mode,
|
588
615
|
uint32_t flags)
|
589
616
|
{
|
590
|
-
|
617
|
+
git_filter_session filter_session = GIT_FILTER_SESSION_INIT;
|
591
618
|
|
592
|
-
|
619
|
+
filter_session.options.flags = flags;
|
593
620
|
|
594
|
-
return
|
595
|
-
filters, repo, blob, path, mode, &
|
621
|
+
return git_filter_list__load(
|
622
|
+
filters, repo, blob, path, mode, &filter_session);
|
596
623
|
}
|
597
624
|
|
598
625
|
void git_filter_list_free(git_filter_list *fl)
|
@@ -618,7 +645,7 @@ int git_filter_list_contains(
|
|
618
645
|
{
|
619
646
|
size_t i;
|
620
647
|
|
621
|
-
|
648
|
+
GIT_ASSERT_ARG(name);
|
622
649
|
|
623
650
|
if (!fl)
|
624
651
|
return 0;
|
@@ -639,7 +666,8 @@ int git_filter_list_push(
|
|
639
666
|
git_filter_def *fdef = NULL;
|
640
667
|
git_filter_entry *fe;
|
641
668
|
|
642
|
-
|
669
|
+
GIT_ASSERT_ARG(fl);
|
670
|
+
GIT_ASSERT_ARG(filter);
|
643
671
|
|
644
672
|
if (git_rwlock_rdlock(&filter_registry.lock) < 0) {
|
645
673
|
git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
|
@@ -684,9 +712,8 @@ static int buf_stream_write(
|
|
684
712
|
git_writestream *s, const char *buffer, size_t len)
|
685
713
|
{
|
686
714
|
struct buf_stream *buf_stream = (struct buf_stream *)s;
|
687
|
-
|
688
|
-
|
689
|
-
assert(buf_stream->complete == 0);
|
715
|
+
GIT_ASSERT_ARG(buf_stream);
|
716
|
+
GIT_ASSERT(buf_stream->complete == 0);
|
690
717
|
|
691
718
|
return git_buf_put(buf_stream->target, buffer, len);
|
692
719
|
}
|
@@ -694,9 +721,9 @@ static int buf_stream_write(
|
|
694
721
|
static int buf_stream_close(git_writestream *s)
|
695
722
|
{
|
696
723
|
struct buf_stream *buf_stream = (struct buf_stream *)s;
|
697
|
-
|
724
|
+
GIT_ASSERT_ARG(buf_stream);
|
698
725
|
|
699
|
-
|
726
|
+
GIT_ASSERT(buf_stream->complete == 0);
|
700
727
|
buf_stream->complete = 1;
|
701
728
|
|
702
729
|
return 0;
|
@@ -719,27 +746,47 @@ static void buf_stream_init(struct buf_stream *writer, git_buf *target)
|
|
719
746
|
git_buf_clear(target);
|
720
747
|
}
|
721
748
|
|
722
|
-
int
|
723
|
-
git_buf *
|
749
|
+
int git_filter_list_apply_to_buffer(
|
750
|
+
git_buf *out,
|
751
|
+
git_filter_list *filters,
|
752
|
+
const char *in,
|
753
|
+
size_t in_len)
|
724
754
|
{
|
725
755
|
struct buf_stream writer;
|
726
756
|
int error;
|
727
757
|
|
728
|
-
git_buf_sanitize(
|
729
|
-
|
758
|
+
if ((error = git_buf_sanitize(out)) < 0)
|
759
|
+
return error;
|
730
760
|
|
731
|
-
|
732
|
-
|
761
|
+
buf_stream_init(&writer, out);
|
762
|
+
|
763
|
+
if ((error = git_filter_list_stream_buffer(filters,
|
764
|
+
in, in_len, &writer.parent)) < 0)
|
765
|
+
return error;
|
766
|
+
|
767
|
+
GIT_ASSERT(writer.complete);
|
768
|
+
return error;
|
769
|
+
}
|
770
|
+
|
771
|
+
int git_filter_list__convert_buf(
|
772
|
+
git_buf *out,
|
773
|
+
git_filter_list *filters,
|
774
|
+
git_buf *in)
|
775
|
+
{
|
776
|
+
int error;
|
777
|
+
|
778
|
+
if (!filters || git_filter_list_length(filters) == 0) {
|
779
|
+
git_buf_swap(out, in);
|
780
|
+
git_buf_dispose(in);
|
733
781
|
return 0;
|
734
782
|
}
|
735
783
|
|
736
|
-
|
784
|
+
error = git_filter_list_apply_to_buffer(out, filters,
|
785
|
+
in->ptr, in->size);
|
737
786
|
|
738
|
-
if (
|
739
|
-
|
740
|
-
return error;
|
787
|
+
if (!error)
|
788
|
+
git_buf_dispose(in);
|
741
789
|
|
742
|
-
assert(writer.complete);
|
743
790
|
return error;
|
744
791
|
}
|
745
792
|
|
@@ -758,7 +805,7 @@ int git_filter_list_apply_to_file(
|
|
758
805
|
filters, repo, path, &writer.parent)) < 0)
|
759
806
|
return error;
|
760
807
|
|
761
|
-
|
808
|
+
GIT_ASSERT(writer.complete);
|
762
809
|
return error;
|
763
810
|
}
|
764
811
|
|
@@ -789,13 +836,14 @@ int git_filter_list_apply_to_blob(
|
|
789
836
|
filters, blob, &writer.parent)) < 0)
|
790
837
|
return error;
|
791
838
|
|
792
|
-
|
839
|
+
GIT_ASSERT(writer.complete);
|
793
840
|
return error;
|
794
841
|
}
|
795
842
|
|
796
|
-
struct
|
843
|
+
struct buffered_stream {
|
797
844
|
git_writestream parent;
|
798
845
|
git_filter *filter;
|
846
|
+
int (*write_fn)(git_filter *, void **, git_buf *, const git_buf *, const git_filter_source *);
|
799
847
|
const git_filter_source *source;
|
800
848
|
void **payload;
|
801
849
|
git_buf input;
|
@@ -804,89 +852,120 @@ struct proxy_stream {
|
|
804
852
|
git_writestream *target;
|
805
853
|
};
|
806
854
|
|
807
|
-
static int
|
855
|
+
static int buffered_stream_write(
|
808
856
|
git_writestream *s, const char *buffer, size_t len)
|
809
857
|
{
|
810
|
-
struct
|
811
|
-
|
858
|
+
struct buffered_stream *buffered_stream = (struct buffered_stream *)s;
|
859
|
+
GIT_ASSERT_ARG(buffered_stream);
|
812
860
|
|
813
|
-
return git_buf_put(&
|
861
|
+
return git_buf_put(&buffered_stream->input, buffer, len);
|
814
862
|
}
|
815
863
|
|
816
|
-
static int
|
864
|
+
static int buffered_stream_close(git_writestream *s)
|
817
865
|
{
|
818
|
-
struct
|
866
|
+
struct buffered_stream *buffered_stream = (struct buffered_stream *)s;
|
819
867
|
git_buf *writebuf;
|
820
868
|
git_error_state error_state = {0};
|
821
869
|
int error;
|
822
870
|
|
823
|
-
|
871
|
+
GIT_ASSERT_ARG(buffered_stream);
|
824
872
|
|
825
|
-
error =
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
&
|
830
|
-
|
873
|
+
error = buffered_stream->write_fn(
|
874
|
+
buffered_stream->filter,
|
875
|
+
buffered_stream->payload,
|
876
|
+
buffered_stream->output,
|
877
|
+
&buffered_stream->input,
|
878
|
+
buffered_stream->source);
|
831
879
|
|
832
880
|
if (error == GIT_PASSTHROUGH) {
|
833
|
-
writebuf = &
|
881
|
+
writebuf = &buffered_stream->input;
|
834
882
|
} else if (error == 0) {
|
835
|
-
git_buf_sanitize(
|
836
|
-
|
883
|
+
if ((error = git_buf_sanitize(buffered_stream->output)) < 0)
|
884
|
+
return error;
|
885
|
+
|
886
|
+
writebuf = buffered_stream->output;
|
837
887
|
} else {
|
838
888
|
/* close stream before erroring out taking care
|
839
889
|
* to preserve the original error */
|
840
890
|
git_error_state_capture(&error_state, error);
|
841
|
-
|
891
|
+
buffered_stream->target->close(buffered_stream->target);
|
842
892
|
git_error_state_restore(&error_state);
|
843
893
|
return error;
|
844
894
|
}
|
845
895
|
|
846
|
-
if ((error =
|
847
|
-
|
848
|
-
error =
|
896
|
+
if ((error = buffered_stream->target->write(
|
897
|
+
buffered_stream->target, writebuf->ptr, writebuf->size)) == 0)
|
898
|
+
error = buffered_stream->target->close(buffered_stream->target);
|
849
899
|
|
850
900
|
return error;
|
851
901
|
}
|
852
902
|
|
853
|
-
static void
|
903
|
+
static void buffered_stream_free(git_writestream *s)
|
854
904
|
{
|
855
|
-
struct
|
856
|
-
assert(proxy_stream);
|
905
|
+
struct buffered_stream *buffered_stream = (struct buffered_stream *)s;
|
857
906
|
|
858
|
-
|
859
|
-
|
860
|
-
|
907
|
+
if (buffered_stream) {
|
908
|
+
git_buf_dispose(&buffered_stream->input);
|
909
|
+
git_buf_dispose(&buffered_stream->temp_buf);
|
910
|
+
git__free(buffered_stream);
|
911
|
+
}
|
861
912
|
}
|
862
913
|
|
863
|
-
|
914
|
+
int git_filter_buffered_stream_new(
|
864
915
|
git_writestream **out,
|
865
916
|
git_filter *filter,
|
917
|
+
int (*write_fn)(git_filter *, void **, git_buf *, const git_buf *, const git_filter_source *),
|
866
918
|
git_buf *temp_buf,
|
867
919
|
void **payload,
|
868
920
|
const git_filter_source *source,
|
869
921
|
git_writestream *target)
|
870
922
|
{
|
871
|
-
struct
|
872
|
-
GIT_ERROR_CHECK_ALLOC(
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
923
|
+
struct buffered_stream *buffered_stream = git__calloc(1, sizeof(struct buffered_stream));
|
924
|
+
GIT_ERROR_CHECK_ALLOC(buffered_stream);
|
925
|
+
|
926
|
+
buffered_stream->parent.write = buffered_stream_write;
|
927
|
+
buffered_stream->parent.close = buffered_stream_close;
|
928
|
+
buffered_stream->parent.free = buffered_stream_free;
|
929
|
+
buffered_stream->filter = filter;
|
930
|
+
buffered_stream->write_fn = write_fn;
|
931
|
+
buffered_stream->output = temp_buf ? temp_buf : &buffered_stream->temp_buf;
|
932
|
+
buffered_stream->payload = payload;
|
933
|
+
buffered_stream->source = source;
|
934
|
+
buffered_stream->target = target;
|
882
935
|
|
883
936
|
if (temp_buf)
|
884
937
|
git_buf_clear(temp_buf);
|
885
938
|
|
886
|
-
*out = (git_writestream *)
|
939
|
+
*out = (git_writestream *)buffered_stream;
|
887
940
|
return 0;
|
888
941
|
}
|
889
942
|
|
943
|
+
static int setup_stream(
|
944
|
+
git_writestream **out,
|
945
|
+
git_filter_entry *fe,
|
946
|
+
git_filter_list *filters,
|
947
|
+
git_writestream *last_stream)
|
948
|
+
{
|
949
|
+
#ifndef GIT_DEPRECATE_HARD
|
950
|
+
GIT_ASSERT(fe->filter->stream || fe->filter->apply);
|
951
|
+
|
952
|
+
/*
|
953
|
+
* If necessary, create a stream that proxies the traditional
|
954
|
+
* application.
|
955
|
+
*/
|
956
|
+
if (!fe->filter->stream) {
|
957
|
+
/* Create a stream that proxies the one-shot apply */
|
958
|
+
return git_filter_buffered_stream_new(out,
|
959
|
+
fe->filter, fe->filter->apply, filters->temp_buf,
|
960
|
+
&fe->payload, &filters->source, last_stream);
|
961
|
+
}
|
962
|
+
#endif
|
963
|
+
|
964
|
+
GIT_ASSERT(fe->filter->stream);
|
965
|
+
return fe->filter->stream(out, fe->filter,
|
966
|
+
&fe->payload, &filters->source, last_stream);
|
967
|
+
}
|
968
|
+
|
890
969
|
static int stream_list_init(
|
891
970
|
git_writestream **out,
|
892
971
|
git_vector *streams,
|
@@ -908,22 +987,11 @@ static int stream_list_init(
|
|
908
987
|
for (i = 0; i < git_array_size(filters->filters); ++i) {
|
909
988
|
size_t filter_idx = (filters->source.mode == GIT_FILTER_TO_WORKTREE) ?
|
910
989
|
git_array_size(filters->filters) - 1 - i : i;
|
990
|
+
|
911
991
|
git_filter_entry *fe = git_array_get(filters->filters, filter_idx);
|
912
992
|
git_writestream *filter_stream;
|
913
993
|
|
914
|
-
|
915
|
-
|
916
|
-
/* If necessary, create a stream that proxies the traditional
|
917
|
-
* application.
|
918
|
-
*/
|
919
|
-
if (fe->filter->stream)
|
920
|
-
error = fe->filter->stream(&filter_stream, fe->filter,
|
921
|
-
&fe->payload, &filters->source, last_stream);
|
922
|
-
else
|
923
|
-
/* Create a stream that proxies the one-shot apply */
|
924
|
-
error = proxy_stream_init(&filter_stream, fe->filter,
|
925
|
-
filters->temp_buf, &fe->payload, &filters->source,
|
926
|
-
last_stream);
|
994
|
+
error = setup_stream(&filter_stream, fe, filters, last_stream);
|
927
995
|
|
928
996
|
if (error < 0)
|
929
997
|
goto out;
|
@@ -967,8 +1035,10 @@ int git_filter_list_stream_file(
|
|
967
1035
|
|
968
1036
|
if ((error = stream_list_init(
|
969
1037
|
&stream_start, &filter_streams, filters, target)) < 0 ||
|
970
|
-
|
1038
|
+
(error = git_path_join_unrooted(&abspath, path, base, NULL)) < 0 ||
|
1039
|
+
(error = git_path_validate_workdir_buf(repo, &abspath)) < 0)
|
971
1040
|
goto done;
|
1041
|
+
|
972
1042
|
initialized = 1;
|
973
1043
|
|
974
1044
|
if ((fd = git_futils_open_ro(abspath.ptr)) < 0) {
|
@@ -995,23 +1065,21 @@ done:
|
|
995
1065
|
return error;
|
996
1066
|
}
|
997
1067
|
|
998
|
-
int
|
1068
|
+
int git_filter_list_stream_buffer(
|
999
1069
|
git_filter_list *filters,
|
1000
|
-
|
1070
|
+
const char *buffer,
|
1071
|
+
size_t len,
|
1001
1072
|
git_writestream *target)
|
1002
1073
|
{
|
1003
1074
|
git_vector filter_streams = GIT_VECTOR_INIT;
|
1004
1075
|
git_writestream *stream_start;
|
1005
1076
|
int error, initialized = 0;
|
1006
1077
|
|
1007
|
-
git_buf_sanitize(data);
|
1008
|
-
|
1009
1078
|
if ((error = stream_list_init(&stream_start, &filter_streams, filters, target)) < 0)
|
1010
1079
|
goto out;
|
1011
1080
|
initialized = 1;
|
1012
1081
|
|
1013
|
-
if ((error = stream_start->write(
|
1014
|
-
stream_start, data->ptr, data->size)) < 0)
|
1082
|
+
if ((error = stream_start->write(stream_start, buffer, len)) < 0)
|
1015
1083
|
goto out;
|
1016
1084
|
|
1017
1085
|
out:
|
@@ -1035,7 +1103,7 @@ int git_filter_list_stream_blob(
|
|
1035
1103
|
if (filters)
|
1036
1104
|
git_oid_cpy(&filters->source.oid, git_blob_id(blob));
|
1037
1105
|
|
1038
|
-
return
|
1106
|
+
return git_filter_list_stream_buffer(filters, in.ptr, in.size, target);
|
1039
1107
|
}
|
1040
1108
|
|
1041
1109
|
int git_filter_init(git_filter *filter, unsigned int version)
|
@@ -1043,3 +1111,31 @@ int git_filter_init(git_filter *filter, unsigned int version)
|
|
1043
1111
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(filter, version, git_filter, GIT_FILTER_INIT);
|
1044
1112
|
return 0;
|
1045
1113
|
}
|
1114
|
+
|
1115
|
+
#ifndef GIT_DEPRECATE_HARD
|
1116
|
+
|
1117
|
+
int git_filter_list_stream_data(
|
1118
|
+
git_filter_list *filters,
|
1119
|
+
git_buf *data,
|
1120
|
+
git_writestream *target)
|
1121
|
+
{
|
1122
|
+
int error;
|
1123
|
+
|
1124
|
+
if ((error = git_buf_sanitize(data)) < 0)
|
1125
|
+
return error;
|
1126
|
+
|
1127
|
+
return git_filter_list_stream_buffer(filters, data->ptr, data->size, target);
|
1128
|
+
}
|
1129
|
+
|
1130
|
+
int git_filter_list_apply_to_data(
|
1131
|
+
git_buf *tgt, git_filter_list *filters, git_buf *src)
|
1132
|
+
{
|
1133
|
+
int error;
|
1134
|
+
|
1135
|
+
if ((error = git_buf_sanitize(src)) < 0)
|
1136
|
+
return error;
|
1137
|
+
|
1138
|
+
return git_filter_list_apply_to_buffer(tgt, filters, src->ptr, src->size);
|
1139
|
+
}
|
1140
|
+
|
1141
|
+
#endif
|
data/vendor/libgit2/src/filter.h
CHANGED
@@ -11,29 +11,39 @@
|
|
11
11
|
|
12
12
|
#include "attr_file.h"
|
13
13
|
#include "git2/filter.h"
|
14
|
+
#include "git2/sys/filter.h"
|
14
15
|
|
15
16
|
/* Amount of file to examine for NUL byte when checking binary-ness */
|
16
17
|
#define GIT_FILTER_BYTES_TO_CHECK_NUL 8000
|
17
18
|
|
18
19
|
typedef struct {
|
20
|
+
git_filter_options options;
|
19
21
|
git_attr_session *attr_session;
|
20
22
|
git_buf *temp_buf;
|
21
|
-
|
22
|
-
} git_filter_options;
|
23
|
+
} git_filter_session;
|
23
24
|
|
24
|
-
#define GIT_FILTER_OPTIONS_INIT
|
25
|
+
#define GIT_FILTER_SESSION_INIT {GIT_FILTER_OPTIONS_INIT, 0}
|
25
26
|
|
26
27
|
extern int git_filter_global_init(void);
|
27
28
|
|
28
29
|
extern void git_filter_free(git_filter *filter);
|
29
30
|
|
30
|
-
extern int
|
31
|
+
extern int git_filter_list__load(
|
31
32
|
git_filter_list **filters,
|
32
33
|
git_repository *repo,
|
33
34
|
git_blob *blob, /* can be NULL */
|
34
35
|
const char *path,
|
35
36
|
git_filter_mode_t mode,
|
36
|
-
|
37
|
+
git_filter_session *filter_session);
|
38
|
+
|
39
|
+
/*
|
40
|
+
* The given input buffer will be converted to the given output buffer.
|
41
|
+
* The input buffer will be freed (_if_ it was allocated).
|
42
|
+
*/
|
43
|
+
extern int git_filter_list__convert_buf(
|
44
|
+
git_buf *out,
|
45
|
+
git_filter_list *filters,
|
46
|
+
git_buf *in);
|
37
47
|
|
38
48
|
/*
|
39
49
|
* Available filters
|
@@ -42,4 +52,13 @@ extern int git_filter_list__load_ext(
|
|
42
52
|
extern git_filter *git_crlf_filter_new(void);
|
43
53
|
extern git_filter *git_ident_filter_new(void);
|
44
54
|
|
55
|
+
extern int git_filter_buffered_stream_new(
|
56
|
+
git_writestream **out,
|
57
|
+
git_filter *filter,
|
58
|
+
int (*write_fn)(git_filter *, void **, git_buf *, const git_buf *, const git_filter_source *),
|
59
|
+
git_buf *temp_buf,
|
60
|
+
void **payload,
|
61
|
+
const git_filter_source *source,
|
62
|
+
git_writestream *target);
|
63
|
+
|
45
64
|
#endif
|
data/vendor/libgit2/src/futils.c
CHANGED
@@ -7,8 +7,9 @@
|
|
7
7
|
|
8
8
|
#include "futils.h"
|
9
9
|
|
10
|
-
#include "
|
10
|
+
#include "runtime.h"
|
11
11
|
#include "strmap.h"
|
12
|
+
#include "hash.h"
|
12
13
|
#include <ctype.h>
|
13
14
|
#if GIT_WIN32
|
14
15
|
#include "win32/findfile.h"
|
@@ -184,7 +185,8 @@ int git_futils_readbuffer_updated(
|
|
184
185
|
git_buf buf = GIT_BUF_INIT;
|
185
186
|
git_oid checksum_new;
|
186
187
|
|
187
|
-
|
188
|
+
GIT_ASSERT_ARG(out);
|
189
|
+
GIT_ASSERT_ARG(path && *path);
|
188
190
|
|
189
191
|
if (updated != NULL)
|
190
192
|
*updated = 0;
|
@@ -492,7 +494,7 @@ int git_futils_mkdir(
|
|
492
494
|
goto done;
|
493
495
|
}
|
494
496
|
|
495
|
-
|
497
|
+
GIT_ASSERT(len);
|
496
498
|
|
497
499
|
/*
|
498
500
|
* We've walked all the given path's parents and it's either relative
|
@@ -1127,8 +1129,6 @@ int git_futils_filestamp_check(
|
|
1127
1129
|
void git_futils_filestamp_set(
|
1128
1130
|
git_futils_filestamp *target, const git_futils_filestamp *source)
|
1129
1131
|
{
|
1130
|
-
assert(target);
|
1131
|
-
|
1132
1132
|
if (source)
|
1133
1133
|
memcpy(target, source, sizeof(*target));
|
1134
1134
|
else
|
data/vendor/libgit2/src/futils.h
CHANGED
@@ -257,7 +257,7 @@ extern int git_futils_truncate(const char *path, int mode);
|
|
257
257
|
*/
|
258
258
|
extern int git_futils_filesize(uint64_t *out, git_file fd);
|
259
259
|
|
260
|
-
#define GIT_PERMS_IS_EXEC(MODE) (((MODE) &
|
260
|
+
#define GIT_PERMS_IS_EXEC(MODE) (((MODE) & 0100) != 0)
|
261
261
|
#define GIT_PERMS_CANONICAL(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0755 : 0644)
|
262
262
|
#define GIT_PERMS_FOR_WRITE(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0777 : 0666)
|
263
263
|
|