rugged 0.24.6.1 → 0.25.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 -1
- data/ext/rugged/extconf.rb +9 -2
- data/ext/rugged/rugged.c +85 -21
- data/ext/rugged/rugged.h +7 -21
- data/ext/rugged/rugged_backend.c +3 -20
- data/ext/rugged/rugged_blame.c +7 -24
- data/ext/rugged/rugged_blob.c +136 -59
- data/ext/rugged/rugged_branch.c +3 -20
- data/ext/rugged/rugged_branch_collection.c +3 -20
- data/ext/rugged/rugged_commit.c +251 -101
- data/ext/rugged/rugged_config.c +3 -20
- data/ext/rugged/rugged_cred.c +3 -20
- data/ext/rugged/rugged_diff.c +3 -20
- data/ext/rugged/rugged_diff_delta.c +3 -20
- data/ext/rugged/rugged_diff_hunk.c +3 -20
- data/ext/rugged/rugged_diff_line.c +3 -20
- data/ext/rugged/rugged_index.c +46 -229
- data/ext/rugged/rugged_note.c +3 -20
- data/ext/rugged/rugged_object.c +3 -20
- data/ext/rugged/rugged_patch.c +192 -34
- data/ext/rugged/rugged_rebase.c +90 -48
- data/ext/rugged/rugged_reference.c +4 -21
- data/ext/rugged/rugged_reference_collection.c +3 -20
- data/ext/rugged/rugged_remote.c +70 -42
- data/ext/rugged/rugged_remote_collection.c +3 -20
- data/ext/rugged/rugged_repo.c +50 -59
- data/ext/rugged/rugged_revwalk.c +4 -21
- data/ext/rugged/rugged_settings.c +3 -20
- data/ext/rugged/rugged_signature.c +3 -20
- data/ext/rugged/rugged_submodule.c +4 -21
- data/ext/rugged/rugged_submodule_collection.c +3 -20
- data/ext/rugged/rugged_tag.c +3 -20
- data/ext/rugged/rugged_tag_collection.c +3 -20
- data/ext/rugged/rugged_tree.c +189 -184
- data/lib/rugged/attributes.rb +5 -0
- data/lib/rugged/blob.rb +5 -0
- data/lib/rugged/branch.rb +6 -1
- data/lib/rugged/commit.rb +5 -0
- data/lib/rugged/console.rb +5 -0
- data/lib/rugged/credentials.rb +5 -0
- data/lib/rugged/diff/delta.rb +5 -0
- data/lib/rugged/diff/hunk.rb +5 -0
- data/lib/rugged/diff/line.rb +5 -0
- data/lib/rugged/diff.rb +5 -0
- data/lib/rugged/index.rb +120 -0
- data/lib/rugged/object.rb +5 -0
- data/lib/rugged/patch.rb +5 -0
- data/lib/rugged/reference.rb +5 -0
- data/lib/rugged/remote.rb +5 -0
- data/lib/rugged/repository.rb +9 -4
- data/lib/rugged/submodule_collection.rb +5 -0
- data/lib/rugged/tag.rb +5 -0
- data/lib/rugged/tree.rb +156 -1
- data/lib/rugged/version.rb +6 -1
- data/lib/rugged/walker.rb +5 -0
- data/lib/rugged.rb +5 -0
- data/vendor/libgit2/CMakeLists.txt +12 -2
- data/vendor/libgit2/include/git2/blob.h +39 -28
- data/vendor/libgit2/include/git2/commit.h +76 -0
- data/vendor/libgit2/include/git2/common.h +21 -1
- data/vendor/libgit2/include/git2/describe.h +5 -2
- data/vendor/libgit2/include/git2/diff.h +62 -7
- data/vendor/libgit2/include/git2/errors.h +2 -1
- data/vendor/libgit2/include/git2/index.h +25 -0
- data/vendor/libgit2/include/git2/merge.h +10 -1
- data/vendor/libgit2/include/git2/odb.h +47 -1
- data/vendor/libgit2/include/git2/pack.h +4 -4
- data/vendor/libgit2/include/git2/patch.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +92 -0
- data/vendor/libgit2/include/git2/refs.h +11 -0
- data/vendor/libgit2/include/git2/remote.h +21 -8
- data/vendor/libgit2/include/git2/repository.h +20 -1
- data/vendor/libgit2/include/git2/revwalk.h +4 -6
- data/vendor/libgit2/include/git2/signature.h +13 -0
- data/vendor/libgit2/include/git2/submodule.h +11 -3
- data/vendor/libgit2/include/git2/sys/merge.h +177 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +11 -0
- data/vendor/libgit2/include/git2/sys/remote.h +16 -0
- data/vendor/libgit2/include/git2/sys/stream.h +2 -1
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +3 -1
- data/vendor/libgit2/include/git2/tag.h +9 -0
- data/vendor/libgit2/include/git2/transaction.h +9 -0
- data/vendor/libgit2/include/git2/tree.h +55 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/annotated_commit.c +99 -80
- data/vendor/libgit2/src/annotated_commit.h +5 -2
- data/vendor/libgit2/src/apply.c +377 -0
- data/vendor/libgit2/src/apply.h +21 -0
- data/vendor/libgit2/src/array.h +0 -1
- data/vendor/libgit2/src/blob.c +71 -39
- data/vendor/libgit2/src/branch.c +7 -5
- data/vendor/libgit2/src/buffer.c +252 -20
- data/vendor/libgit2/src/buffer.h +8 -0
- data/vendor/libgit2/src/checkout.c +69 -42
- data/vendor/libgit2/src/clone.c +0 -8
- data/vendor/libgit2/src/commit.c +193 -49
- data/vendor/libgit2/src/commit_list.c +8 -3
- data/vendor/libgit2/src/commit_list.h +1 -0
- data/vendor/libgit2/src/common.h +2 -1
- data/vendor/libgit2/src/config.c +3 -3
- data/vendor/libgit2/src/config_file.c +20 -10
- data/vendor/libgit2/src/crlf.c +1 -0
- data/vendor/libgit2/src/curl_stream.c +106 -6
- data/vendor/libgit2/src/delta.c +238 -62
- data/vendor/libgit2/src/delta.h +79 -58
- data/vendor/libgit2/src/describe.c +1 -1
- data/vendor/libgit2/src/diff.c +32 -1554
- data/vendor/libgit2/src/diff.h +14 -122
- data/vendor/libgit2/src/diff_driver.c +4 -6
- data/vendor/libgit2/src/diff_file.c +3 -0
- data/vendor/libgit2/src/diff_generate.c +1613 -0
- data/vendor/libgit2/src/diff_generate.h +123 -0
- data/vendor/libgit2/src/diff_parse.c +101 -0
- data/vendor/libgit2/src/diff_parse.h +18 -0
- data/vendor/libgit2/src/diff_print.c +263 -144
- data/vendor/libgit2/src/diff_stats.c +21 -12
- data/vendor/libgit2/src/diff_tform.c +1 -0
- data/vendor/libgit2/src/diff_tform.h +22 -0
- data/vendor/libgit2/src/diff_xdiff.c +9 -9
- data/vendor/libgit2/src/diff_xdiff.h +5 -5
- data/vendor/libgit2/src/fetchhead.c +8 -8
- data/vendor/libgit2/src/filebuf.c +6 -1
- data/vendor/libgit2/src/filebuf.h +1 -0
- data/vendor/libgit2/src/fileops.c +22 -1
- data/vendor/libgit2/src/fileops.h +8 -2
- data/vendor/libgit2/src/fnmatch.c +18 -5
- data/vendor/libgit2/src/global.c +21 -4
- data/vendor/libgit2/src/global.h +6 -0
- data/vendor/libgit2/src/graph.c +1 -1
- data/vendor/libgit2/src/index.c +159 -46
- data/vendor/libgit2/src/index.h +2 -0
- data/vendor/libgit2/src/iterator.c +1573 -1468
- data/vendor/libgit2/src/iterator.h +52 -69
- data/vendor/libgit2/src/merge.c +163 -64
- data/vendor/libgit2/src/merge.h +61 -2
- data/vendor/libgit2/src/merge_driver.c +397 -0
- data/vendor/libgit2/src/merge_driver.h +60 -0
- data/vendor/libgit2/src/merge_file.c +11 -49
- data/vendor/libgit2/src/netops.c +12 -10
- data/vendor/libgit2/src/object_api.c +19 -1
- data/vendor/libgit2/src/odb.c +228 -52
- data/vendor/libgit2/src/odb_loose.c +19 -1
- data/vendor/libgit2/src/odb_mempack.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +27 -1
- data/vendor/libgit2/src/openssl_stream.c +4 -5
- data/vendor/libgit2/src/pack-objects.c +105 -76
- data/vendor/libgit2/src/pack-objects.h +13 -12
- data/vendor/libgit2/src/pack.c +16 -10
- data/vendor/libgit2/src/pack.h +2 -0
- data/vendor/libgit2/src/patch.c +216 -0
- data/vendor/libgit2/src/patch.h +66 -0
- data/vendor/libgit2/src/{diff_patch.c → patch_generate.c} +203 -376
- data/vendor/libgit2/src/patch_generate.h +68 -0
- data/vendor/libgit2/src/patch_parse.c +1159 -0
- data/vendor/libgit2/src/patch_parse.h +56 -0
- data/vendor/libgit2/src/path.c +38 -2
- data/vendor/libgit2/src/path.h +18 -0
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/pool.h +5 -0
- data/vendor/libgit2/src/pqueue.c +12 -5
- data/vendor/libgit2/src/pqueue.h +1 -0
- data/vendor/libgit2/src/proxy.c +32 -0
- data/vendor/libgit2/src/proxy.h +14 -0
- data/vendor/libgit2/src/push.c +1 -1
- data/vendor/libgit2/src/rebase.c +63 -36
- data/vendor/libgit2/src/refdb.c +4 -2
- data/vendor/libgit2/src/refdb_fs.c +82 -54
- data/vendor/libgit2/src/refs.c +13 -1
- data/vendor/libgit2/src/remote.c +20 -81
- data/vendor/libgit2/src/repository.c +212 -29
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revparse.c +1 -1
- data/vendor/libgit2/src/revwalk.c +260 -184
- data/vendor/libgit2/src/settings.c +11 -3
- data/vendor/libgit2/src/signature.c +27 -2
- data/vendor/libgit2/src/sortedcache.c +14 -5
- data/vendor/libgit2/src/stash.c +1 -0
- data/vendor/libgit2/src/status.c +1 -0
- data/vendor/libgit2/src/stransport_stream.c +4 -2
- data/vendor/libgit2/src/stream.h +2 -2
- data/vendor/libgit2/src/submodule.c +16 -4
- data/vendor/libgit2/src/sysdir.c +1 -1
- data/vendor/libgit2/src/transport.c +3 -5
- data/vendor/libgit2/src/transports/http.c +38 -13
- data/vendor/libgit2/src/transports/local.c +4 -1
- data/vendor/libgit2/src/transports/smart.c +6 -0
- data/vendor/libgit2/src/transports/smart.h +1 -0
- data/vendor/libgit2/src/transports/smart_pkt.c +5 -13
- data/vendor/libgit2/src/transports/smart_protocol.c +22 -7
- data/vendor/libgit2/src/transports/winhttp.c +144 -11
- data/vendor/libgit2/src/tree.c +267 -2
- data/vendor/libgit2/src/unix/posix.h +10 -0
- data/vendor/libgit2/src/unix/pthread.h +2 -0
- data/vendor/libgit2/src/util.c +25 -2
- data/vendor/libgit2/src/util.h +10 -0
- data/vendor/libgit2/src/varint.c +44 -0
- data/vendor/libgit2/src/varint.h +15 -0
- data/vendor/libgit2/src/vector.c +58 -0
- data/vendor/libgit2/src/vector.h +8 -0
- data/vendor/libgit2/src/win32/posix.h +3 -0
- data/vendor/libgit2/src/win32/thread.c +18 -0
- data/vendor/libgit2/src/win32/thread.h +2 -0
- data/vendor/libgit2/src/win32/w32_util.h +1 -1
- data/vendor/libgit2/src/zstream.c +37 -8
- data/vendor/libgit2/src/zstream.h +8 -1
- metadata +100 -82
- data/vendor/libgit2/Makefile.embed +0 -60
- data/vendor/libgit2/src/delta-apply.c +0 -166
- data/vendor/libgit2/src/delta-apply.h +0 -62
- data/vendor/libgit2/src/diff_patch.h +0 -83
@@ -8,8 +8,8 @@
|
|
8
8
|
#include "common.h"
|
9
9
|
#include "diff.h"
|
10
10
|
#include "diff_driver.h"
|
11
|
-
#include "diff_patch.h"
|
12
11
|
#include "diff_xdiff.h"
|
12
|
+
#include "patch_generate.h"
|
13
13
|
|
14
14
|
static int git_xdiff_scan_int(const char **str, int *value)
|
15
15
|
{
|
@@ -56,7 +56,7 @@ fail:
|
|
56
56
|
|
57
57
|
typedef struct {
|
58
58
|
git_xdiff_output *xo;
|
59
|
-
|
59
|
+
git_patch_generated *patch;
|
60
60
|
git_diff_hunk hunk;
|
61
61
|
int old_lineno, new_lineno;
|
62
62
|
mmfile_t xd_old_data, xd_new_data;
|
@@ -110,9 +110,9 @@ static int diff_update_lines(
|
|
110
110
|
static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
|
111
111
|
{
|
112
112
|
git_xdiff_info *info = priv;
|
113
|
-
|
114
|
-
const git_diff_delta *delta =
|
115
|
-
|
113
|
+
git_patch_generated *patch = info->patch;
|
114
|
+
const git_diff_delta *delta = patch->base.delta;
|
115
|
+
git_patch_generated_output *output = &info->xo->output;
|
116
116
|
git_diff_line line;
|
117
117
|
|
118
118
|
if (len == 1) {
|
@@ -181,7 +181,7 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
|
|
181
181
|
return output->error;
|
182
182
|
}
|
183
183
|
|
184
|
-
static int git_xdiff(
|
184
|
+
static int git_xdiff(git_patch_generated_output *output, git_patch_generated *patch)
|
185
185
|
{
|
186
186
|
git_xdiff_output *xo = (git_xdiff_output *)output;
|
187
187
|
git_xdiff_info info;
|
@@ -194,7 +194,7 @@ static int git_xdiff(git_diff_output *output, git_patch *patch)
|
|
194
194
|
xo->callback.priv = &info;
|
195
195
|
|
196
196
|
git_diff_find_context_init(
|
197
|
-
&xo->config.find_func, &findctxt,
|
197
|
+
&xo->config.find_func, &findctxt, git_patch_generated_driver(patch));
|
198
198
|
xo->config.find_func_priv = &findctxt;
|
199
199
|
|
200
200
|
if (xo->config.find_func != NULL)
|
@@ -206,8 +206,8 @@ static int git_xdiff(git_diff_output *output, git_patch *patch)
|
|
206
206
|
* updates are needed to xo->params.flags
|
207
207
|
*/
|
208
208
|
|
209
|
-
|
210
|
-
|
209
|
+
git_patch_generated_old_data(&info.xd_old_data.ptr, &info.xd_old_data.size, patch);
|
210
|
+
git_patch_generated_new_data(&info.xd_new_data.ptr, &info.xd_new_data.size, patch);
|
211
211
|
|
212
212
|
if (info.xd_old_data.size > GIT_XDIFF_MAX_SIZE ||
|
213
213
|
info.xd_new_data.size > GIT_XDIFF_MAX_SIZE) {
|
@@ -8,20 +8,20 @@
|
|
8
8
|
#define INCLUDE_diff_xdiff_h__
|
9
9
|
|
10
10
|
#include "diff.h"
|
11
|
-
#include "diff_patch.h"
|
12
11
|
#include "xdiff/xdiff.h"
|
12
|
+
#include "patch_generate.h"
|
13
13
|
|
14
14
|
/* xdiff cannot cope with large files. these files should not be passed to
|
15
15
|
* xdiff. callers should treat these large files as binary.
|
16
16
|
*/
|
17
17
|
#define GIT_XDIFF_MAX_SIZE (1024LL * 1024 * 1023)
|
18
18
|
|
19
|
-
/* A git_xdiff_output is a
|
20
|
-
* to use libxdiff. Calling git_xdiff_init() will set the diff_cb
|
21
|
-
* of the output to use xdiff to generate the diffs.
|
19
|
+
/* A git_xdiff_output is a git_patch_generate_output with extra fields
|
20
|
+
* necessary to use libxdiff. Calling git_xdiff_init() will set the diff_cb
|
21
|
+
* field of the output to use xdiff to generate the diffs.
|
22
22
|
*/
|
23
23
|
typedef struct {
|
24
|
-
|
24
|
+
git_patch_generated_output output;
|
25
25
|
|
26
26
|
xdemitconf_t config;
|
27
27
|
xpparam_t params;
|
@@ -149,7 +149,7 @@ static int fetchhead_ref_parse(
|
|
149
149
|
|
150
150
|
if (!*line) {
|
151
151
|
giterr_set(GITERR_FETCHHEAD,
|
152
|
-
"Empty line in FETCH_HEAD line %
|
152
|
+
"Empty line in FETCH_HEAD line %"PRIuZ, line_num);
|
153
153
|
return -1;
|
154
154
|
}
|
155
155
|
|
@@ -163,7 +163,7 @@ static int fetchhead_ref_parse(
|
|
163
163
|
|
164
164
|
if (strlen(oid_str) != GIT_OID_HEXSZ) {
|
165
165
|
giterr_set(GITERR_FETCHHEAD,
|
166
|
-
"Invalid object ID in FETCH_HEAD line %
|
166
|
+
"Invalid object ID in FETCH_HEAD line %"PRIuZ, line_num);
|
167
167
|
return -1;
|
168
168
|
}
|
169
169
|
|
@@ -171,7 +171,7 @@ static int fetchhead_ref_parse(
|
|
171
171
|
const git_error *oid_err = giterr_last();
|
172
172
|
const char *err_msg = oid_err ? oid_err->message : "Invalid object ID";
|
173
173
|
|
174
|
-
giterr_set(GITERR_FETCHHEAD, "%s in FETCH_HEAD line %
|
174
|
+
giterr_set(GITERR_FETCHHEAD, "%s in FETCH_HEAD line %"PRIuZ,
|
175
175
|
err_msg, line_num);
|
176
176
|
return -1;
|
177
177
|
}
|
@@ -180,7 +180,7 @@ static int fetchhead_ref_parse(
|
|
180
180
|
if (*line) {
|
181
181
|
if ((is_merge_str = git__strsep(&line, "\t")) == NULL) {
|
182
182
|
giterr_set(GITERR_FETCHHEAD,
|
183
|
-
"Invalid description data in FETCH_HEAD line %
|
183
|
+
"Invalid description data in FETCH_HEAD line %"PRIuZ, line_num);
|
184
184
|
return -1;
|
185
185
|
}
|
186
186
|
|
@@ -190,13 +190,13 @@ static int fetchhead_ref_parse(
|
|
190
190
|
*is_merge = 0;
|
191
191
|
else {
|
192
192
|
giterr_set(GITERR_FETCHHEAD,
|
193
|
-
"Invalid for-merge entry in FETCH_HEAD line %
|
193
|
+
"Invalid for-merge entry in FETCH_HEAD line %"PRIuZ, line_num);
|
194
194
|
return -1;
|
195
195
|
}
|
196
196
|
|
197
197
|
if ((desc = line) == NULL) {
|
198
198
|
giterr_set(GITERR_FETCHHEAD,
|
199
|
-
"Invalid description in FETCH_HEAD line %
|
199
|
+
"Invalid description in FETCH_HEAD line %"PRIuZ, line_num);
|
200
200
|
return -1;
|
201
201
|
}
|
202
202
|
|
@@ -213,7 +213,7 @@ static int fetchhead_ref_parse(
|
|
213
213
|
if ((desc = strstr(name, "' ")) == NULL ||
|
214
214
|
git__prefixcmp(desc, "' of ") != 0) {
|
215
215
|
giterr_set(GITERR_FETCHHEAD,
|
216
|
-
"Invalid description in FETCH_HEAD line %
|
216
|
+
"Invalid description in FETCH_HEAD line %"PRIuZ, line_num);
|
217
217
|
return -1;
|
218
218
|
}
|
219
219
|
|
@@ -277,7 +277,7 @@ int git_repository_fetchhead_foreach(git_repository *repo,
|
|
277
277
|
}
|
278
278
|
|
279
279
|
if (*buffer) {
|
280
|
-
giterr_set(GITERR_FETCHHEAD, "No EOL at line %
|
280
|
+
giterr_set(GITERR_FETCHHEAD, "No EOL at line %"PRIuZ, line_num+1);
|
281
281
|
error = -1;
|
282
282
|
goto done;
|
283
283
|
}
|
@@ -272,6 +272,11 @@ cleanup:
|
|
272
272
|
}
|
273
273
|
|
274
274
|
int git_filebuf_open(git_filebuf *file, const char *path, int flags, mode_t mode)
|
275
|
+
{
|
276
|
+
return git_filebuf_open_withsize(file, path, flags, mode, WRITE_BUFFER_SIZE);
|
277
|
+
}
|
278
|
+
|
279
|
+
int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mode_t mode, size_t size)
|
275
280
|
{
|
276
281
|
int compression, error = -1;
|
277
282
|
size_t path_len, alloc_len;
|
@@ -286,7 +291,7 @@ int git_filebuf_open(git_filebuf *file, const char *path, int flags, mode_t mode
|
|
286
291
|
if (flags & GIT_FILEBUF_DO_NOT_BUFFER)
|
287
292
|
file->do_not_buffer = true;
|
288
293
|
|
289
|
-
file->buf_size =
|
294
|
+
file->buf_size = size;
|
290
295
|
file->buf_pos = 0;
|
291
296
|
file->fd = -1;
|
292
297
|
file->last_error = BUFERR_OK;
|
@@ -79,6 +79,7 @@ int git_filebuf_reserve(git_filebuf *file, void **buff, size_t len);
|
|
79
79
|
int git_filebuf_printf(git_filebuf *file, const char *format, ...) GIT_FORMAT_PRINTF(2, 3);
|
80
80
|
|
81
81
|
int git_filebuf_open(git_filebuf *lock, const char *path, int flags, mode_t mode);
|
82
|
+
int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mode_t mode, size_t size);
|
82
83
|
int git_filebuf_commit(git_filebuf *lock);
|
83
84
|
int git_filebuf_commit_at(git_filebuf *lock, const char *path);
|
84
85
|
void git_filebuf_cleanup(git_filebuf *lock);
|
@@ -72,8 +72,16 @@ int git_futils_creat_locked(const char *path, const mode_t mode)
|
|
72
72
|
O_EXCL | O_BINARY | O_CLOEXEC, mode);
|
73
73
|
|
74
74
|
if (fd < 0) {
|
75
|
+
int error = errno;
|
75
76
|
giterr_set(GITERR_OS, "Failed to create locked file '%s'", path);
|
76
|
-
|
77
|
+
switch (error) {
|
78
|
+
case EEXIST:
|
79
|
+
return GIT_ELOCKED;
|
80
|
+
case ENOENT:
|
81
|
+
return GIT_ENOTFOUND;
|
82
|
+
default:
|
83
|
+
return -1;
|
84
|
+
}
|
77
85
|
}
|
78
86
|
|
79
87
|
return fd;
|
@@ -837,6 +845,19 @@ int git_futils_cp(const char *from, const char *to, mode_t filemode)
|
|
837
845
|
return cp_by_fd(ifd, ofd, true);
|
838
846
|
}
|
839
847
|
|
848
|
+
int git_futils_touch(const char *path, time_t *when)
|
849
|
+
{
|
850
|
+
struct p_timeval times[2];
|
851
|
+
int ret;
|
852
|
+
|
853
|
+
times[0].tv_sec = times[1].tv_sec = when ? *when : time(NULL);
|
854
|
+
times[0].tv_usec = times[1].tv_usec = 0;
|
855
|
+
|
856
|
+
ret = p_utimes(path, times);
|
857
|
+
|
858
|
+
return (ret < 0) ? git_path_set_error(errno, path, "touch") : 0;
|
859
|
+
}
|
860
|
+
|
840
861
|
static int cp_link(const char *from, const char *to, size_t link_size)
|
841
862
|
{
|
842
863
|
int error = 0;
|
@@ -45,12 +45,12 @@ extern int git_futils_writebuffer(
|
|
45
45
|
extern int git_futils_creat_withpath(const char *path, const mode_t dirmode, const mode_t mode);
|
46
46
|
|
47
47
|
/**
|
48
|
-
* Create
|
48
|
+
* Create and open a process-locked file
|
49
49
|
*/
|
50
50
|
extern int git_futils_creat_locked(const char *path, const mode_t mode);
|
51
51
|
|
52
52
|
/**
|
53
|
-
* Create
|
53
|
+
* Create and open a process-locked file, while
|
54
54
|
* also creating all the folders in its path
|
55
55
|
*/
|
56
56
|
extern int git_futils_creat_locked_withpath(const char *path, const mode_t dirmode, const mode_t mode);
|
@@ -184,6 +184,12 @@ extern int git_futils_cp(
|
|
184
184
|
const char *to,
|
185
185
|
mode_t filemode);
|
186
186
|
|
187
|
+
/**
|
188
|
+
* Set the files atime and mtime to the given time, or the current time
|
189
|
+
* if `ts` is NULL.
|
190
|
+
*/
|
191
|
+
extern int git_futils_touch(const char *path, time_t *when);
|
192
|
+
|
187
193
|
/**
|
188
194
|
* Flags that can be passed to `git_futils_cp_r`.
|
189
195
|
*
|
@@ -93,11 +93,24 @@ p_fnmatchx(const char *pattern, const char *string, int flags, size_t recurs)
|
|
93
93
|
* It will be restored if/when we recurse below.
|
94
94
|
*/
|
95
95
|
if (c == '*') {
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
96
|
+
c = *++pattern;
|
97
|
+
/* star-star-slash is at the end, match by default */
|
98
|
+
if (c == EOS)
|
99
|
+
return 0;
|
100
|
+
/* Double-star must be at end or between slashes */
|
101
|
+
if (c != '/')
|
102
|
+
return (FNM_NOMATCH);
|
103
|
+
|
104
|
+
c = *++pattern;
|
105
|
+
do {
|
106
|
+
int e = p_fnmatchx(pattern, string, recurs_flags, recurs);
|
107
|
+
if (e != FNM_NOMATCH)
|
108
|
+
return e;
|
109
|
+
string = strchr(string, '/');
|
110
|
+
} while (string++);
|
111
|
+
|
112
|
+
/* If we get here, we didn't find a match */
|
113
|
+
return FNM_NOMATCH;
|
101
114
|
}
|
102
115
|
|
103
116
|
if (*string == '.' && (flags & FNM_PERIOD) &&
|
data/vendor/libgit2/src/global.c
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
#include "hash.h"
|
10
10
|
#include "sysdir.h"
|
11
11
|
#include "filter.h"
|
12
|
+
#include "merge_driver.h"
|
12
13
|
#include "openssl_stream.h"
|
13
14
|
#include "thread-utils.h"
|
14
15
|
#include "git2/global.h"
|
@@ -59,6 +60,7 @@ static int init_common(void)
|
|
59
60
|
if ((ret = git_hash_global_init()) == 0 &&
|
60
61
|
(ret = git_sysdir_global_init()) == 0 &&
|
61
62
|
(ret = git_filter_global_init()) == 0 &&
|
63
|
+
(ret = git_merge_driver_global_init()) == 0 &&
|
62
64
|
(ret = git_transport_ssh_global_init()) == 0 &&
|
63
65
|
(ret = git_openssl_stream_global_init()) == 0)
|
64
66
|
ret = git_mwindow_global_init();
|
@@ -245,6 +247,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
|
|
245
247
|
#elif defined(GIT_THREADS) && defined(_POSIX_THREADS)
|
246
248
|
|
247
249
|
static pthread_key_t _tls_key;
|
250
|
+
static pthread_mutex_t _init_mutex = PTHREAD_MUTEX_INITIALIZER;
|
248
251
|
static pthread_once_t _once_init = PTHREAD_ONCE_INIT;
|
249
252
|
int init_error = 0;
|
250
253
|
|
@@ -266,12 +269,19 @@ static void init_once(void)
|
|
266
269
|
|
267
270
|
int git_libgit2_init(void)
|
268
271
|
{
|
269
|
-
int ret;
|
272
|
+
int ret, err;
|
270
273
|
|
271
274
|
ret = git_atomic_inc(&git__n_inits);
|
272
|
-
pthread_once(&_once_init, init_once);
|
273
275
|
|
274
|
-
|
276
|
+
if ((err = pthread_mutex_lock(&_init_mutex)) != 0)
|
277
|
+
return err;
|
278
|
+
err = pthread_once(&_once_init, init_once);
|
279
|
+
err |= pthread_mutex_unlock(&_init_mutex);
|
280
|
+
|
281
|
+
if (err || init_error)
|
282
|
+
return err | init_error;
|
283
|
+
|
284
|
+
return ret;
|
275
285
|
}
|
276
286
|
|
277
287
|
int git_libgit2_shutdown(void)
|
@@ -283,6 +293,9 @@ int git_libgit2_shutdown(void)
|
|
283
293
|
if ((ret = git_atomic_dec(&git__n_inits)) != 0)
|
284
294
|
return ret;
|
285
295
|
|
296
|
+
if ((ret = pthread_mutex_lock(&_init_mutex)) != 0)
|
297
|
+
return ret;
|
298
|
+
|
286
299
|
/* Shut down any subsystems that have global state */
|
287
300
|
shutdown_common();
|
288
301
|
|
@@ -296,6 +309,9 @@ int git_libgit2_shutdown(void)
|
|
296
309
|
git_mutex_free(&git__mwindow_mutex);
|
297
310
|
_once_init = new_once;
|
298
311
|
|
312
|
+
if ((ret = pthread_mutex_unlock(&_init_mutex)) != 0)
|
313
|
+
return ret;
|
314
|
+
|
299
315
|
return 0;
|
300
316
|
}
|
301
317
|
|
@@ -325,7 +341,7 @@ int git_libgit2_init(void)
|
|
325
341
|
{
|
326
342
|
int ret;
|
327
343
|
|
328
|
-
/* Only init
|
344
|
+
/* Only init subsystems the first time */
|
329
345
|
if ((ret = git_atomic_inc(&git__n_inits)) != 1)
|
330
346
|
return ret;
|
331
347
|
|
@@ -343,6 +359,7 @@ int git_libgit2_shutdown(void)
|
|
343
359
|
if ((ret = git_atomic_dec(&git__n_inits)) == 0) {
|
344
360
|
shutdown_common();
|
345
361
|
git__global_state_cleanup(&__state);
|
362
|
+
memset(&__state, 0, sizeof(__state));
|
346
363
|
}
|
347
364
|
|
348
365
|
return ret;
|
data/vendor/libgit2/src/global.h
CHANGED
@@ -16,6 +16,12 @@ typedef struct {
|
|
16
16
|
git_error error_t;
|
17
17
|
git_buf error_buf;
|
18
18
|
char oid_fmt[GIT_OID_HEXSZ+1];
|
19
|
+
|
20
|
+
/* On Windows, this is the current child thread that was started by
|
21
|
+
* `git_thread_create`. This is used to set the thread's exit code
|
22
|
+
* when terminated by `git_thread_exit`. It is unused on POSIX.
|
23
|
+
*/
|
24
|
+
git_thread *current_thread;
|
19
25
|
} git_global_st;
|
20
26
|
|
21
27
|
#ifdef GIT_OPENSSL
|
data/vendor/libgit2/src/graph.c
CHANGED
@@ -59,7 +59,7 @@ static int mark_parents(git_revwalk *walk, git_commit_list_node *one,
|
|
59
59
|
/* as long as there are non-STALE commits */
|
60
60
|
while (interesting(&list, roots)) {
|
61
61
|
git_commit_list_node *commit = git_pqueue_pop(&list);
|
62
|
-
int flags;
|
62
|
+
unsigned int flags;
|
63
63
|
|
64
64
|
if (commit == NULL)
|
65
65
|
break;
|