rugged 0.17.0.b7 → 0.18.0.b1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* Read whole files into an in-memory buffer for processing
|
|
19
19
|
*/
|
|
20
20
|
extern int git_futils_readbuffer(git_buf *obj, const char *path);
|
|
21
|
-
extern int git_futils_readbuffer_updated(
|
|
21
|
+
extern int git_futils_readbuffer_updated(
|
|
22
|
+
git_buf *obj, const char *path, time_t *mtime, size_t *size, int *updated);
|
|
22
23
|
extern int git_futils_readbuffer_fd(git_buf *obj, git_file fd, size_t len);
|
|
23
24
|
|
|
24
25
|
/**
|
|
@@ -64,6 +65,8 @@ extern int git_futils_mkdir_r(const char *path, const char *base, const mode_t m
|
|
|
64
65
|
* * GIT_MKDIR_CHMOD says to chmod the final directory entry after creation
|
|
65
66
|
* * GIT_MKDIR_CHMOD_PATH says to chmod each directory component in the path
|
|
66
67
|
* * GIT_MKDIR_SKIP_LAST says to leave off the last element of the path
|
|
68
|
+
* * GIT_MKDIR_SKIP_LAST2 says to leave off the last 2 elements of the path
|
|
69
|
+
* * GIT_MKDIR_VERIFY_DIR says confirm final item is a dir, not just EEXIST
|
|
67
70
|
*
|
|
68
71
|
* Note that the chmod options will be executed even if the directory already
|
|
69
72
|
* exists, unless GIT_MKDIR_EXCL is given.
|
|
@@ -73,7 +76,9 @@ typedef enum {
|
|
|
73
76
|
GIT_MKDIR_PATH = 2,
|
|
74
77
|
GIT_MKDIR_CHMOD = 4,
|
|
75
78
|
GIT_MKDIR_CHMOD_PATH = 8,
|
|
76
|
-
GIT_MKDIR_SKIP_LAST = 16
|
|
79
|
+
GIT_MKDIR_SKIP_LAST = 16,
|
|
80
|
+
GIT_MKDIR_SKIP_LAST2 = 32,
|
|
81
|
+
GIT_MKDIR_VERIFY_DIR = 64,
|
|
77
82
|
} git_futils_mkdir_flags;
|
|
78
83
|
|
|
79
84
|
/**
|
|
@@ -97,27 +102,48 @@ extern int git_futils_mkdir(const char *path, const char *base, mode_t mode, uin
|
|
|
97
102
|
*/
|
|
98
103
|
extern int git_futils_mkpath2file(const char *path, const mode_t mode);
|
|
99
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Flags to pass to `git_futils_rmdir_r`.
|
|
107
|
+
*
|
|
108
|
+
* * GIT_RMDIR_EMPTY_HIERARCHY - the default; remove hierarchy of empty
|
|
109
|
+
* dirs and generate error if any files are found.
|
|
110
|
+
* * GIT_RMDIR_REMOVE_FILES - attempt to remove files in the hierarchy.
|
|
111
|
+
* * GIT_RMDIR_SKIP_NONEMPTY - skip non-empty directories with no error.
|
|
112
|
+
* * GIT_RMDIR_EMPTY_PARENTS - remove containing directories up to base
|
|
113
|
+
* if removing this item leaves them empty
|
|
114
|
+
* * GIT_RMDIR_REMOVE_BLOCKERS - remove blocking file that causes ENOTDIR
|
|
115
|
+
*
|
|
116
|
+
* The old values translate into the new as follows:
|
|
117
|
+
*
|
|
118
|
+
* * GIT_DIRREMOVAL_EMPTY_HIERARCHY == GIT_RMDIR_EMPTY_HIERARCHY
|
|
119
|
+
* * GIT_DIRREMOVAL_FILES_AND_DIRS ~= GIT_RMDIR_REMOVE_FILES
|
|
120
|
+
* * GIT_DIRREMOVAL_ONLY_EMPTY_DIRS == GIT_RMDIR_SKIP_NONEMPTY
|
|
121
|
+
*/
|
|
100
122
|
typedef enum {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
123
|
+
GIT_RMDIR_EMPTY_HIERARCHY = 0,
|
|
124
|
+
GIT_RMDIR_REMOVE_FILES = (1 << 0),
|
|
125
|
+
GIT_RMDIR_SKIP_NONEMPTY = (1 << 1),
|
|
126
|
+
GIT_RMDIR_EMPTY_PARENTS = (1 << 2),
|
|
127
|
+
GIT_RMDIR_REMOVE_BLOCKERS = (1 << 3),
|
|
128
|
+
} git_futils_rmdir_flags;
|
|
105
129
|
|
|
106
130
|
/**
|
|
107
131
|
* Remove path and any files and directories beneath it.
|
|
108
132
|
*
|
|
109
|
-
* @param path Path to
|
|
133
|
+
* @param path Path to the top level directory to process.
|
|
110
134
|
* @param base Root for relative path.
|
|
111
|
-
* @param
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
135
|
+
* @param flags Combination of git_futils_rmdir_flags values
|
|
136
|
+
* @return 0 on success; -1 on error.
|
|
137
|
+
*/
|
|
138
|
+
extern int git_futils_rmdir_r(const char *path, const char *base, uint32_t flags);
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Remove all files and directories beneath the specified path.
|
|
117
142
|
*
|
|
143
|
+
* @param path Path to the top level directory to process.
|
|
118
144
|
* @return 0 on success; -1 on error.
|
|
119
145
|
*/
|
|
120
|
-
extern int
|
|
146
|
+
extern int git_futils_cleanupdir_r(const char *path);
|
|
121
147
|
|
|
122
148
|
/**
|
|
123
149
|
* Create and open a temporary file with a `_git2_` suffix.
|
|
@@ -144,13 +170,26 @@ extern int git_futils_cp(
|
|
|
144
170
|
|
|
145
171
|
/**
|
|
146
172
|
* Flags that can be passed to `git_futils_cp_r`.
|
|
173
|
+
*
|
|
174
|
+
* - GIT_CPDIR_CREATE_EMPTY_DIRS: create directories even if there are no
|
|
175
|
+
* files under them (otherwise directories will only be created lazily
|
|
176
|
+
* when a file inside them is copied).
|
|
177
|
+
* - GIT_CPDIR_COPY_SYMLINKS: copy symlinks, otherwise they are ignored.
|
|
178
|
+
* - GIT_CPDIR_COPY_DOTFILES: copy files with leading '.', otherwise ignored.
|
|
179
|
+
* - GIT_CPDIR_OVERWRITE: overwrite pre-existing files with source content,
|
|
180
|
+
* otherwise they are silently skipped.
|
|
181
|
+
* - GIT_CPDIR_CHMOD_DIRS: explicitly chmod directories to `dirmode`
|
|
182
|
+
* - GIT_CPDIR_SIMPLE_TO_MODE: default tries to replicate the mode of the
|
|
183
|
+
* source file to the target; with this flag, always use 0666 (or 0777 if
|
|
184
|
+
* source has exec bits set) for target.
|
|
147
185
|
*/
|
|
148
186
|
typedef enum {
|
|
149
|
-
GIT_CPDIR_CREATE_EMPTY_DIRS =
|
|
150
|
-
GIT_CPDIR_COPY_SYMLINKS
|
|
151
|
-
GIT_CPDIR_COPY_DOTFILES
|
|
152
|
-
GIT_CPDIR_OVERWRITE
|
|
153
|
-
|
|
187
|
+
GIT_CPDIR_CREATE_EMPTY_DIRS = (1u << 0),
|
|
188
|
+
GIT_CPDIR_COPY_SYMLINKS = (1u << 1),
|
|
189
|
+
GIT_CPDIR_COPY_DOTFILES = (1u << 2),
|
|
190
|
+
GIT_CPDIR_OVERWRITE = (1u << 3),
|
|
191
|
+
GIT_CPDIR_CHMOD_DIRS = (1u << 4),
|
|
192
|
+
GIT_CPDIR_SIMPLE_TO_MODE = (1u << 5),
|
|
154
193
|
} git_futils_cpdir_flags;
|
|
155
194
|
|
|
156
195
|
/**
|
|
@@ -237,25 +276,72 @@ extern void git_futils_mmap_free(git_map *map);
|
|
|
237
276
|
*
|
|
238
277
|
* @param pathbuf buffer to write the full path into
|
|
239
278
|
* @param filename name of file to find in the home directory
|
|
240
|
-
* @return
|
|
241
|
-
* - 0 if found;
|
|
242
|
-
* - GIT_ENOTFOUND if not found;
|
|
243
|
-
* - -1 on an unspecified OS related error.
|
|
279
|
+
* @return 0 if found, GIT_ENOTFOUND if not found, or -1 on other OS error
|
|
244
280
|
*/
|
|
245
281
|
extern int git_futils_find_global_file(git_buf *path, const char *filename);
|
|
246
282
|
|
|
283
|
+
/**
|
|
284
|
+
* Find an "XDG" file (i.e. one in user's XDG config path).
|
|
285
|
+
*
|
|
286
|
+
* @param pathbuf buffer to write the full path into
|
|
287
|
+
* @param filename name of file to find in the home directory
|
|
288
|
+
* @return 0 if found, GIT_ENOTFOUND if not found, or -1 on other OS error
|
|
289
|
+
*/
|
|
290
|
+
extern int git_futils_find_xdg_file(git_buf *path, const char *filename);
|
|
291
|
+
|
|
247
292
|
/**
|
|
248
293
|
* Find a "system" file (i.e. one shared for all users of the system).
|
|
249
294
|
*
|
|
250
295
|
* @param pathbuf buffer to write the full path into
|
|
251
296
|
* @param filename name of file to find in the home directory
|
|
252
|
-
* @return
|
|
253
|
-
* - 0 if found;
|
|
254
|
-
* - GIT_ENOTFOUND if not found;
|
|
255
|
-
* - -1 on an unspecified OS related error.
|
|
297
|
+
* @return 0 if found, GIT_ENOTFOUND if not found, or -1 on other OS error
|
|
256
298
|
*/
|
|
257
299
|
extern int git_futils_find_system_file(git_buf *path, const char *filename);
|
|
258
300
|
|
|
301
|
+
typedef enum {
|
|
302
|
+
GIT_FUTILS_DIR_SYSTEM = 0,
|
|
303
|
+
GIT_FUTILS_DIR_GLOBAL = 1,
|
|
304
|
+
GIT_FUTILS_DIR_XDG = 2,
|
|
305
|
+
GIT_FUTILS_DIR__MAX = 3,
|
|
306
|
+
} git_futils_dir_t;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Get the search path for global/system/xdg files
|
|
310
|
+
*
|
|
311
|
+
* @param out pointer to git_buf containing search path
|
|
312
|
+
* @param which which list of paths to return
|
|
313
|
+
* @return 0 on success, <0 on failure
|
|
314
|
+
*/
|
|
315
|
+
extern int git_futils_dirs_get(const git_buf **out, git_futils_dir_t which);
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Get search path into a preallocated buffer
|
|
319
|
+
*
|
|
320
|
+
* @param out String buffer to write into
|
|
321
|
+
* @param outlen Size of string buffer
|
|
322
|
+
* @param which Which search path to return
|
|
323
|
+
* @return 0 on success, GIT_EBUFS if out is too small, <0 on other failure
|
|
324
|
+
*/
|
|
325
|
+
|
|
326
|
+
extern int git_futils_dirs_get_str(
|
|
327
|
+
char *out, size_t outlen, git_futils_dir_t which);
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Set search paths for global/system/xdg files
|
|
331
|
+
*
|
|
332
|
+
* The first occurrence of the magic string "$PATH" in the new value will
|
|
333
|
+
* be replaced with the old value of the search path.
|
|
334
|
+
*
|
|
335
|
+
* @param which Which search path to modify
|
|
336
|
+
* @param paths New search path (separated by GIT_PATH_LIST_SEPARATOR)
|
|
337
|
+
* @return 0 on success, <0 on failure (allocation error)
|
|
338
|
+
*/
|
|
339
|
+
extern int git_futils_dirs_set(git_futils_dir_t which, const char *paths);
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Release / reset all search paths
|
|
343
|
+
*/
|
|
344
|
+
extern void git_futils_dirs_free(void);
|
|
259
345
|
|
|
260
346
|
/**
|
|
261
347
|
* Create a "fake" symlink (text file containing the target path).
|
|
@@ -266,4 +352,44 @@ extern int git_futils_find_system_file(git_buf *path, const char *filename);
|
|
|
266
352
|
*/
|
|
267
353
|
extern int git_futils_fake_symlink(const char *new, const char *old);
|
|
268
354
|
|
|
355
|
+
/**
|
|
356
|
+
* A file stamp represents a snapshot of information about a file that can
|
|
357
|
+
* be used to test if the file changes. This portable implementation is
|
|
358
|
+
* based on stat data about that file, but it is possible that OS specific
|
|
359
|
+
* versions could be implemented in the future.
|
|
360
|
+
*/
|
|
361
|
+
typedef struct {
|
|
362
|
+
git_time_t mtime;
|
|
363
|
+
git_off_t size;
|
|
364
|
+
unsigned int ino;
|
|
365
|
+
} git_futils_filestamp;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Compare stat information for file with reference info.
|
|
369
|
+
*
|
|
370
|
+
* This function updates the file stamp to current data for the given path
|
|
371
|
+
* and returns 0 if the file is up-to-date relative to the prior setting or
|
|
372
|
+
* 1 if the file has been changed. (This also may return GIT_ENOTFOUND if
|
|
373
|
+
* the file doesn't exist.)
|
|
374
|
+
*
|
|
375
|
+
* @param stamp File stamp to be checked
|
|
376
|
+
* @param path Path to stat and check if changed
|
|
377
|
+
* @return 0 if up-to-date, 1 if out-of-date, <0 on error
|
|
378
|
+
*/
|
|
379
|
+
extern int git_futils_filestamp_check(
|
|
380
|
+
git_futils_filestamp *stamp, const char *path);
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Set or reset file stamp data
|
|
384
|
+
*
|
|
385
|
+
* This writes the target file stamp. If the source is NULL, this will set
|
|
386
|
+
* the target stamp to values that will definitely be out of date. If the
|
|
387
|
+
* source is not NULL, this copies the source values to the target.
|
|
388
|
+
*
|
|
389
|
+
* @param tgt File stamp to write to
|
|
390
|
+
* @param src File stamp to copy from or NULL to clear the target
|
|
391
|
+
*/
|
|
392
|
+
extern void git_futils_filestamp_set(
|
|
393
|
+
git_futils_filestamp *tgt, const git_futils_filestamp *src);
|
|
394
|
+
|
|
269
395
|
#endif /* INCLUDE_fileops_h__ */
|
data/vendor/libgit2/src/filter.c
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.
|
|
@@ -13,79 +13,6 @@
|
|
|
13
13
|
#include "git2/config.h"
|
|
14
14
|
#include "blob.h"
|
|
15
15
|
|
|
16
|
-
/* Tweaked from Core Git. I wonder what we could use this for... */
|
|
17
|
-
void git_text_gather_stats(git_text_stats *stats, const git_buf *text)
|
|
18
|
-
{
|
|
19
|
-
size_t i;
|
|
20
|
-
|
|
21
|
-
memset(stats, 0, sizeof(*stats));
|
|
22
|
-
|
|
23
|
-
for (i = 0; i < git_buf_len(text); i++) {
|
|
24
|
-
unsigned char c = text->ptr[i];
|
|
25
|
-
|
|
26
|
-
if (c == '\r') {
|
|
27
|
-
stats->cr++;
|
|
28
|
-
|
|
29
|
-
if (i + 1 < git_buf_len(text) && text->ptr[i + 1] == '\n')
|
|
30
|
-
stats->crlf++;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
else if (c == '\n')
|
|
34
|
-
stats->lf++;
|
|
35
|
-
|
|
36
|
-
else if (c == 0x85)
|
|
37
|
-
/* Unicode CR+LF */
|
|
38
|
-
stats->crlf++;
|
|
39
|
-
|
|
40
|
-
else if (c == 127)
|
|
41
|
-
/* DEL */
|
|
42
|
-
stats->nonprintable++;
|
|
43
|
-
|
|
44
|
-
else if (c <= 0x1F || (c >= 0x80 && c <= 0x9F)) {
|
|
45
|
-
switch (c) {
|
|
46
|
-
/* BS, HT, ESC and FF */
|
|
47
|
-
case '\b': case '\t': case '\033': case '\014':
|
|
48
|
-
stats->printable++;
|
|
49
|
-
break;
|
|
50
|
-
case 0:
|
|
51
|
-
stats->nul++;
|
|
52
|
-
/* fall through */
|
|
53
|
-
default:
|
|
54
|
-
stats->nonprintable++;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
else
|
|
59
|
-
stats->printable++;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/* If file ends with EOF then don't count this EOF as non-printable. */
|
|
63
|
-
if (git_buf_len(text) >= 1 && text->ptr[text->size - 1] == '\032')
|
|
64
|
-
stats->nonprintable--;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/*
|
|
68
|
-
* Fresh from Core Git
|
|
69
|
-
*/
|
|
70
|
-
int git_text_is_binary(git_text_stats *stats)
|
|
71
|
-
{
|
|
72
|
-
if (stats->nul)
|
|
73
|
-
return 1;
|
|
74
|
-
|
|
75
|
-
if ((stats->printable >> 7) < stats->nonprintable)
|
|
76
|
-
return 1;
|
|
77
|
-
/*
|
|
78
|
-
* Other heuristics? Average line length might be relevant,
|
|
79
|
-
* as might LF vs CR vs CRLF counts..
|
|
80
|
-
*
|
|
81
|
-
* NOTE! It might be normal to have a low ratio of CRLF to LF
|
|
82
|
-
* (somebody starts with a LF-only file and edits it with an editor
|
|
83
|
-
* that adds CRLF only to lines that are added..). But do we
|
|
84
|
-
* want to support CR-only? Probably not.
|
|
85
|
-
*/
|
|
86
|
-
return 0;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
16
|
int git_filters_load(git_vector *filters, git_repository *repo, const char *path, int mode)
|
|
90
17
|
{
|
|
91
18
|
int error;
|
|
@@ -121,7 +48,8 @@ void git_filters_free(git_vector *filters)
|
|
|
121
48
|
|
|
122
49
|
int git_filters_apply(git_buf *dest, git_buf *source, git_vector *filters)
|
|
123
50
|
{
|
|
124
|
-
|
|
51
|
+
size_t i;
|
|
52
|
+
unsigned int src;
|
|
125
53
|
git_buf *dbuffer[2];
|
|
126
54
|
|
|
127
55
|
dbuffer[0] = source;
|
data/vendor/libgit2/src/filter.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.
|
|
@@ -31,14 +31,6 @@ typedef enum {
|
|
|
31
31
|
GIT_CRLF_AUTO,
|
|
32
32
|
} git_crlf_t;
|
|
33
33
|
|
|
34
|
-
typedef struct {
|
|
35
|
-
/* NUL, CR, LF and CRLF counts */
|
|
36
|
-
unsigned int nul, cr, lf, crlf;
|
|
37
|
-
|
|
38
|
-
/* These are just approximations! */
|
|
39
|
-
unsigned int printable, nonprintable;
|
|
40
|
-
} git_text_stats;
|
|
41
|
-
|
|
42
34
|
/*
|
|
43
35
|
* FILTER API
|
|
44
36
|
*/
|
|
@@ -99,24 +91,4 @@ extern int git_filter_add__crlf_to_odb(git_vector *filters, git_repository *repo
|
|
|
99
91
|
/* Add CRLF, from ODB to worktree */
|
|
100
92
|
extern int git_filter_add__crlf_to_workdir(git_vector *filters, git_repository *repo, const char *path);
|
|
101
93
|
|
|
102
|
-
|
|
103
|
-
/*
|
|
104
|
-
* PLAINTEXT API
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
/*
|
|
108
|
-
* Gather stats for a piece of text
|
|
109
|
-
*
|
|
110
|
-
* Fill the `stats` structure with information on the number of
|
|
111
|
-
* unreadable characters, carriage returns, etc, so it can be
|
|
112
|
-
* used in heuristics.
|
|
113
|
-
*/
|
|
114
|
-
extern void git_text_gather_stats(git_text_stats *stats, const git_buf *text);
|
|
115
|
-
|
|
116
|
-
/*
|
|
117
|
-
* Process `git_text_stats` data generated by `git_text_stat` to see
|
|
118
|
-
* if it qualifies as a binary file
|
|
119
|
-
*/
|
|
120
|
-
extern int git_text_is_binary(git_text_stats *stats);
|
|
121
|
-
|
|
122
94
|
#endif
|
data/vendor/libgit2/src/global.c
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
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.
|
|
6
6
|
*/
|
|
7
7
|
#include "common.h"
|
|
8
8
|
#include "global.h"
|
|
9
|
-
#include "
|
|
9
|
+
#include "hash.h"
|
|
10
|
+
#include "fileops.h"
|
|
11
|
+
#include "git2/threads.h"
|
|
10
12
|
#include "thread-utils.h"
|
|
11
13
|
|
|
12
14
|
|
|
@@ -38,19 +40,39 @@ git_mutex git__mwindow_mutex;
|
|
|
38
40
|
* functions are not available in that case.
|
|
39
41
|
*/
|
|
40
42
|
|
|
43
|
+
/*
|
|
44
|
+
* `git_threads_init()` allows subsystems to perform global setup,
|
|
45
|
+
* which may take place in the global scope. An explicit memory
|
|
46
|
+
* fence exists at the exit of `git_threads_init()`. Without this,
|
|
47
|
+
* CPU cores are free to reorder cache invalidation of `_tls_init`
|
|
48
|
+
* before cache invalidation of the subsystems' newly written global
|
|
49
|
+
* state.
|
|
50
|
+
*/
|
|
41
51
|
#if defined(GIT_THREADS) && defined(GIT_WIN32)
|
|
42
52
|
|
|
43
53
|
static DWORD _tls_index;
|
|
44
54
|
static int _tls_init = 0;
|
|
45
55
|
|
|
46
|
-
|
|
56
|
+
int git_threads_init(void)
|
|
47
57
|
{
|
|
58
|
+
int error;
|
|
59
|
+
|
|
48
60
|
if (_tls_init)
|
|
49
|
-
return;
|
|
61
|
+
return 0;
|
|
50
62
|
|
|
51
63
|
_tls_index = TlsAlloc();
|
|
52
|
-
_tls_init = 1;
|
|
53
64
|
git_mutex_init(&git__mwindow_mutex);
|
|
65
|
+
|
|
66
|
+
/* Initialize any other subsystems that have global state */
|
|
67
|
+
if ((error = git_hash_global_init()) >= 0)
|
|
68
|
+
_tls_init = 1;
|
|
69
|
+
|
|
70
|
+
if (error == 0)
|
|
71
|
+
_tls_init = 1;
|
|
72
|
+
|
|
73
|
+
GIT_MEMORY_BARRIER;
|
|
74
|
+
|
|
75
|
+
return error;
|
|
54
76
|
}
|
|
55
77
|
|
|
56
78
|
void git_threads_shutdown(void)
|
|
@@ -58,6 +80,10 @@ void git_threads_shutdown(void)
|
|
|
58
80
|
TlsFree(_tls_index);
|
|
59
81
|
_tls_init = 0;
|
|
60
82
|
git_mutex_free(&git__mwindow_mutex);
|
|
83
|
+
|
|
84
|
+
/* Shut down any subsystems that have global state */
|
|
85
|
+
git_hash_global_shutdown();
|
|
86
|
+
git_futils_dirs_free();
|
|
61
87
|
}
|
|
62
88
|
|
|
63
89
|
git_global_st *git__global_state(void)
|
|
@@ -88,19 +114,34 @@ static void cb__free_status(void *st)
|
|
|
88
114
|
git__free(st);
|
|
89
115
|
}
|
|
90
116
|
|
|
91
|
-
|
|
117
|
+
int git_threads_init(void)
|
|
92
118
|
{
|
|
119
|
+
int error = 0;
|
|
120
|
+
|
|
93
121
|
if (_tls_init)
|
|
94
|
-
return;
|
|
122
|
+
return 0;
|
|
95
123
|
|
|
124
|
+
git_mutex_init(&git__mwindow_mutex);
|
|
96
125
|
pthread_key_create(&_tls_key, &cb__free_status);
|
|
97
|
-
|
|
126
|
+
|
|
127
|
+
/* Initialize any other subsystems that have global state */
|
|
128
|
+
if ((error = git_hash_global_init()) >= 0)
|
|
129
|
+
_tls_init = 1;
|
|
130
|
+
|
|
131
|
+
GIT_MEMORY_BARRIER;
|
|
132
|
+
|
|
133
|
+
return error;
|
|
98
134
|
}
|
|
99
135
|
|
|
100
136
|
void git_threads_shutdown(void)
|
|
101
137
|
{
|
|
102
138
|
pthread_key_delete(_tls_key);
|
|
103
139
|
_tls_init = 0;
|
|
140
|
+
git_mutex_free(&git__mwindow_mutex);
|
|
141
|
+
|
|
142
|
+
/* Shut down any subsystems that have global state */
|
|
143
|
+
git_hash_global_shutdown();
|
|
144
|
+
git_futils_dirs_free();
|
|
104
145
|
}
|
|
105
146
|
|
|
106
147
|
git_global_st *git__global_state(void)
|
|
@@ -125,14 +166,17 @@ git_global_st *git__global_state(void)
|
|
|
125
166
|
|
|
126
167
|
static git_global_st __state;
|
|
127
168
|
|
|
128
|
-
|
|
169
|
+
int git_threads_init(void)
|
|
129
170
|
{
|
|
130
171
|
/* noop */
|
|
172
|
+
return 0;
|
|
131
173
|
}
|
|
132
174
|
|
|
133
175
|
void git_threads_shutdown(void)
|
|
134
176
|
{
|
|
135
|
-
/*
|
|
177
|
+
/* Shut down any subsystems that have global state */
|
|
178
|
+
git_hash_global_shutdown();
|
|
179
|
+
git_futils_dirs_free();
|
|
136
180
|
}
|
|
137
181
|
|
|
138
182
|
git_global_st *git__global_state(void)
|