rugged 0.25.0b5 → 0.25.0b6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/rugged_patch.c +77 -17
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +8 -6
- data/vendor/libgit2/include/git2/checkout.h +7 -0
- data/vendor/libgit2/include/git2/common.h +1 -0
- data/vendor/libgit2/include/git2/diff.h +54 -7
- data/vendor/libgit2/include/git2/errors.h +2 -1
- data/vendor/libgit2/include/git2/index.h +25 -0
- data/vendor/libgit2/include/git2/pack.h +4 -4
- data/vendor/libgit2/include/git2/repository.h +20 -1
- data/vendor/libgit2/include/git2/submodule.h +11 -3
- data/vendor/libgit2/include/git2/sys/odb_backend.h +11 -0
- data/vendor/libgit2/src/apply.c +369 -0
- data/vendor/libgit2/src/apply.h +21 -0
- data/vendor/libgit2/src/array.h +0 -1
- data/vendor/libgit2/src/blame_git.c +18 -8
- data/vendor/libgit2/src/buffer.c +252 -20
- data/vendor/libgit2/src/buffer.h +8 -0
- data/vendor/libgit2/src/checkout.c +7 -1
- data/vendor/libgit2/src/clone.c +0 -8
- data/vendor/libgit2/src/common.h +1 -1
- data/vendor/libgit2/src/crlf.c +1 -0
- data/vendor/libgit2/src/delta.c +238 -62
- data/vendor/libgit2/src/delta.h +79 -58
- data/vendor/libgit2/src/diff.c +32 -1547
- data/vendor/libgit2/src/diff.h +12 -122
- data/vendor/libgit2/src/diff_driver.c +1 -2
- data/vendor/libgit2/src/diff_file.c +3 -0
- data/vendor/libgit2/src/diff_generate.c +1611 -0
- data/vendor/libgit2/src/diff_generate.h +123 -0
- data/vendor/libgit2/src/diff_parse.c +105 -0
- data/vendor/libgit2/src/diff_print.c +259 -142
- data/vendor/libgit2/src/diff_stats.c +3 -2
- 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/fileops.c +13 -0
- data/vendor/libgit2/src/fileops.h +6 -0
- data/vendor/libgit2/src/global.c +9 -8
- data/vendor/libgit2/src/ignore.c +45 -16
- data/vendor/libgit2/src/index.c +161 -47
- data/vendor/libgit2/src/index.h +2 -0
- data/vendor/libgit2/src/merge.c +2 -0
- data/vendor/libgit2/src/mwindow.c +8 -19
- data/vendor/libgit2/src/mwindow.h +1 -2
- data/vendor/libgit2/src/odb.c +46 -10
- data/vendor/libgit2/src/odb_loose.c +19 -1
- data/vendor/libgit2/src/odb_pack.c +27 -4
- data/vendor/libgit2/src/pack-objects.c +106 -77
- data/vendor/libgit2/src/pack-objects.h +13 -12
- data/vendor/libgit2/src/pack.c +4 -3
- data/vendor/libgit2/src/pack.h +2 -0
- data/vendor/libgit2/src/patch.c +207 -0
- data/vendor/libgit2/src/patch.h +66 -0
- data/vendor/libgit2/src/{diff_patch.c → patch_generate.c} +171 -359
- data/vendor/libgit2/src/patch_generate.h +66 -0
- data/vendor/libgit2/src/patch_parse.c +1121 -0
- data/vendor/libgit2/src/patch_parse.h +54 -0
- data/vendor/libgit2/src/path.c +19 -0
- data/vendor/libgit2/src/path.h +6 -0
- data/vendor/libgit2/src/pool.h +5 -0
- data/vendor/libgit2/src/remote.c +15 -80
- data/vendor/libgit2/src/repository.c +227 -39
- data/vendor/libgit2/src/settings.c +11 -5
- data/vendor/libgit2/src/stash.c +1 -0
- data/vendor/libgit2/src/status.c +1 -0
- data/vendor/libgit2/src/stransport_stream.c +14 -9
- data/vendor/libgit2/src/submodule.c +16 -4
- data/vendor/libgit2/src/sysdir.c +41 -47
- data/vendor/libgit2/src/sysdir.h +0 -5
- data/vendor/libgit2/src/thread-utils.h +5 -51
- data/vendor/libgit2/src/transport.c +3 -5
- data/vendor/libgit2/src/transports/http.c +2 -3
- data/vendor/libgit2/src/transports/smart_pkt.c +1 -0
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -0
- data/vendor/libgit2/src/transports/winhttp.c +16 -2
- data/vendor/libgit2/src/unix/pthread.h +54 -0
- data/vendor/libgit2/src/util.c +23 -5
- 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 +42 -0
- data/vendor/libgit2/src/vector.h +3 -0
- data/vendor/libgit2/src/win32/precompiled.h +1 -1
- data/vendor/libgit2/src/win32/{pthread.c → thread.c} +50 -80
- data/vendor/libgit2/src/win32/thread.h +62 -0
- data/vendor/libgit2/src/zstream.c +36 -7
- data/vendor/libgit2/src/zstream.h +8 -1
- metadata +20 -9
- 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
- data/vendor/libgit2/src/win32/pthread.h +0 -92
@@ -23,15 +23,13 @@ void git_libgit2_version(int *major, int *minor, int *rev)
|
|
23
23
|
*rev = LIBGIT2_VER_REVISION;
|
24
24
|
}
|
25
25
|
|
26
|
-
int git_libgit2_features()
|
26
|
+
int git_libgit2_features(void)
|
27
27
|
{
|
28
28
|
return 0
|
29
29
|
#ifdef GIT_THREADS
|
30
30
|
| GIT_FEATURE_THREADS
|
31
31
|
#endif
|
32
|
-
#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT)
|
33
32
|
| GIT_FEATURE_HTTPS
|
34
|
-
#endif
|
35
33
|
#if defined(GIT_SSH)
|
36
34
|
| GIT_FEATURE_SSH
|
37
35
|
#endif
|
@@ -73,12 +71,12 @@ static int config_level_to_sysdir(int config_level)
|
|
73
71
|
extern char *git__user_agent;
|
74
72
|
extern char *git__ssl_ciphers;
|
75
73
|
|
76
|
-
const char *git_libgit2__user_agent()
|
74
|
+
const char *git_libgit2__user_agent(void)
|
77
75
|
{
|
78
76
|
return git__user_agent;
|
79
77
|
}
|
80
78
|
|
81
|
-
const char *git_libgit2__ssl_ciphers()
|
79
|
+
const char *git_libgit2__ssl_ciphers(void)
|
82
80
|
{
|
83
81
|
return git__ssl_ciphers;
|
84
82
|
}
|
@@ -209,6 +207,14 @@ int git_libgit2_opts(int key, ...)
|
|
209
207
|
#endif
|
210
208
|
break;
|
211
209
|
|
210
|
+
case GIT_OPT_GET_USER_AGENT:
|
211
|
+
{
|
212
|
+
git_buf *out = va_arg(ap, git_buf *);
|
213
|
+
git_buf_sanitize(out);
|
214
|
+
error = git_buf_sets(out, git__user_agent);
|
215
|
+
}
|
216
|
+
break;
|
217
|
+
|
212
218
|
default:
|
213
219
|
giterr_set(GITERR_INVALID, "invalid option key");
|
214
220
|
error = -1;
|
data/vendor/libgit2/src/stash.c
CHANGED
data/vendor/libgit2/src/status.c
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
#include "socket_stream.h"
|
17
17
|
#include "curl_stream.h"
|
18
18
|
|
19
|
-
int stransport_error(OSStatus ret)
|
19
|
+
static int stransport_error(OSStatus ret)
|
20
20
|
{
|
21
21
|
CFStringRef message;
|
22
22
|
|
@@ -47,7 +47,7 @@ typedef struct {
|
|
47
47
|
git_cert_x509 cert_info;
|
48
48
|
} stransport_stream;
|
49
49
|
|
50
|
-
int stransport_connect(git_stream *stream)
|
50
|
+
static int stransport_connect(git_stream *stream)
|
51
51
|
{
|
52
52
|
stransport_stream *st = (stransport_stream *) stream;
|
53
53
|
int error;
|
@@ -67,6 +67,9 @@ int stransport_connect(git_stream *stream)
|
|
67
67
|
if ((ret = SSLCopyPeerTrust(st->ctx, &trust)) != noErr)
|
68
68
|
goto on_error;
|
69
69
|
|
70
|
+
if (!trust)
|
71
|
+
return GIT_ECERTIFICATE;
|
72
|
+
|
70
73
|
if ((ret = SecTrustEvaluate(trust, &sec_res)) != noErr)
|
71
74
|
goto on_error;
|
72
75
|
|
@@ -90,7 +93,7 @@ on_error:
|
|
90
93
|
return stransport_error(ret);
|
91
94
|
}
|
92
95
|
|
93
|
-
int stransport_certificate(git_cert **out, git_stream *stream)
|
96
|
+
static int stransport_certificate(git_cert **out, git_stream *stream)
|
94
97
|
{
|
95
98
|
stransport_stream *st = (stransport_stream *) stream;
|
96
99
|
SecTrustRef trust = NULL;
|
@@ -117,7 +120,7 @@ int stransport_certificate(git_cert **out, git_stream *stream)
|
|
117
120
|
return 0;
|
118
121
|
}
|
119
122
|
|
120
|
-
int stransport_set_proxy(
|
123
|
+
static int stransport_set_proxy(
|
121
124
|
git_stream *stream,
|
122
125
|
const git_proxy_options *proxy_opts)
|
123
126
|
{
|
@@ -149,7 +152,7 @@ static OSStatus write_cb(SSLConnectionRef conn, const void *data, size_t *len)
|
|
149
152
|
return noErr;
|
150
153
|
}
|
151
154
|
|
152
|
-
ssize_t stransport_write(git_stream *stream, const char *data, size_t len, int flags)
|
155
|
+
static ssize_t stransport_write(git_stream *stream, const char *data, size_t len, int flags)
|
153
156
|
{
|
154
157
|
stransport_stream *st = (stransport_stream *) stream;
|
155
158
|
size_t data_len, processed;
|
@@ -198,7 +201,7 @@ static OSStatus read_cb(SSLConnectionRef conn, void *data, size_t *len)
|
|
198
201
|
return error;
|
199
202
|
}
|
200
203
|
|
201
|
-
ssize_t stransport_read(git_stream *stream, void *data, size_t len)
|
204
|
+
static ssize_t stransport_read(git_stream *stream, void *data, size_t len)
|
202
205
|
{
|
203
206
|
stransport_stream *st = (stransport_stream *) stream;
|
204
207
|
size_t processed;
|
@@ -210,7 +213,7 @@ ssize_t stransport_read(git_stream *stream, void *data, size_t len)
|
|
210
213
|
return processed;
|
211
214
|
}
|
212
215
|
|
213
|
-
int stransport_close(git_stream *stream)
|
216
|
+
static int stransport_close(git_stream *stream)
|
214
217
|
{
|
215
218
|
stransport_stream *st = (stransport_stream *) stream;
|
216
219
|
OSStatus ret;
|
@@ -222,7 +225,7 @@ int stransport_close(git_stream *stream)
|
|
222
225
|
return git_stream_close(st->io);
|
223
226
|
}
|
224
227
|
|
225
|
-
void stransport_free(git_stream *stream)
|
228
|
+
static void stransport_free(git_stream *stream)
|
226
229
|
{
|
227
230
|
stransport_stream *st = (stransport_stream *) stream;
|
228
231
|
|
@@ -258,6 +261,7 @@ int git_stransport_stream_new(git_stream **out, const char *host, const char *po
|
|
258
261
|
st->ctx = SSLCreateContext(NULL, kSSLClientSide, kSSLStreamType);
|
259
262
|
if (!st->ctx) {
|
260
263
|
giterr_set(GITERR_NET, "failed to create SSL context");
|
264
|
+
git__free(st);
|
261
265
|
return -1;
|
262
266
|
}
|
263
267
|
|
@@ -267,7 +271,8 @@ int git_stransport_stream_new(git_stream **out, const char *host, const char *po
|
|
267
271
|
(ret = SSLSetProtocolVersionMin(st->ctx, kTLSProtocol1)) != noErr ||
|
268
272
|
(ret = SSLSetProtocolVersionMax(st->ctx, kTLSProtocol12)) != noErr ||
|
269
273
|
(ret = SSLSetPeerDomainName(st->ctx, host, strlen(host))) != noErr) {
|
270
|
-
|
274
|
+
CFRelease(st->ctx);
|
275
|
+
git__free(st);
|
271
276
|
return stransport_error(ret);
|
272
277
|
}
|
273
278
|
|
@@ -93,6 +93,7 @@ static git_config_backend *open_gitmodules(git_repository *repo, int gitmod);
|
|
93
93
|
static git_config *gitmodules_snapshot(git_repository *repo);
|
94
94
|
static int get_url_base(git_buf *url, git_repository *repo);
|
95
95
|
static int lookup_head_remote_key(git_buf *remote_key, git_repository *repo);
|
96
|
+
static int lookup_default_remote(git_remote **remote, git_repository *repo);
|
96
97
|
static int submodule_load_each(const git_config_entry *entry, void *payload);
|
97
98
|
static int submodule_read_config(git_submodule *sm, git_config *cfg);
|
98
99
|
static int submodule_load_from_wd_lite(git_submodule *);
|
@@ -1131,7 +1132,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
1131
1132
|
if (error != GIT_ENOTFOUND)
|
1132
1133
|
goto done;
|
1133
1134
|
|
1134
|
-
if (
|
1135
|
+
if (!init) {
|
1135
1136
|
giterr_set(GITERR_SUBMODULE, "Submodule is not initialized.");
|
1136
1137
|
error = GIT_ERROR;
|
1137
1138
|
goto done;
|
@@ -1171,9 +1172,20 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
1171
1172
|
* update the workdir contents of the subrepository, and set the subrepository's
|
1172
1173
|
* head to the new commit.
|
1173
1174
|
*/
|
1174
|
-
if ((error = git_submodule_open(&sub_repo, sm)) < 0
|
1175
|
-
|
1176
|
-
|
1175
|
+
if ((error = git_submodule_open(&sub_repo, sm)) < 0)
|
1176
|
+
goto done;
|
1177
|
+
|
1178
|
+
/* Look up the target commit in the submodule. */
|
1179
|
+
if ((error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm), GIT_OBJ_COMMIT)) < 0) {
|
1180
|
+
/* If it isn't found then fetch and try again. */
|
1181
|
+
if (error != GIT_ENOTFOUND || !update_options.allow_fetch ||
|
1182
|
+
(error = lookup_default_remote(&remote, sub_repo)) < 0 ||
|
1183
|
+
(error = git_remote_fetch(remote, NULL, &update_options.fetch_opts, NULL)) < 0 ||
|
1184
|
+
(error = git_object_lookup(&target_commit, sub_repo, git_submodule_index_id(sm), GIT_OBJ_COMMIT)) < 0)
|
1185
|
+
goto done;
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
if ((error = git_checkout_tree(sub_repo, target_commit, &update_options.checkout_opts)) != 0 ||
|
1177
1189
|
(error = git_repository_set_head_detached(sub_repo, git_submodule_index_id(sm))) < 0)
|
1178
1190
|
goto done;
|
1179
1191
|
|
data/vendor/libgit2/src/sysdir.c
CHANGED
@@ -83,45 +83,43 @@ static int git_sysdir_guess_template_dirs(git_buf *out)
|
|
83
83
|
#endif
|
84
84
|
}
|
85
85
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
86
|
+
struct git_sysdir__dir {
|
87
|
+
git_buf buf;
|
88
|
+
int (*guess)(git_buf *out);
|
89
|
+
};
|
90
90
|
|
91
|
-
static
|
92
|
-
git_sysdir_guess_system_dirs,
|
93
|
-
git_sysdir_guess_global_dirs,
|
94
|
-
git_sysdir_guess_xdg_dirs,
|
95
|
-
git_sysdir_guess_programdata_dirs,
|
96
|
-
git_sysdir_guess_template_dirs,
|
91
|
+
static struct git_sysdir__dir git_sysdir__dirs[] = {
|
92
|
+
{ GIT_BUF_INIT, git_sysdir_guess_system_dirs },
|
93
|
+
{ GIT_BUF_INIT, git_sysdir_guess_global_dirs },
|
94
|
+
{ GIT_BUF_INIT, git_sysdir_guess_xdg_dirs },
|
95
|
+
{ GIT_BUF_INIT, git_sysdir_guess_programdata_dirs },
|
96
|
+
{ GIT_BUF_INIT, git_sysdir_guess_template_dirs },
|
97
97
|
};
|
98
98
|
|
99
|
-
static
|
99
|
+
static void git_sysdir_global_shutdown(void)
|
100
|
+
{
|
101
|
+
size_t i;
|
102
|
+
|
103
|
+
for (i = 0; i < ARRAY_SIZE(git_sysdir__dirs); ++i)
|
104
|
+
git_buf_free(&git_sysdir__dirs[i].buf);
|
105
|
+
}
|
100
106
|
|
101
107
|
int git_sysdir_global_init(void)
|
102
108
|
{
|
103
|
-
|
104
|
-
const git_buf *path;
|
109
|
+
size_t i;
|
105
110
|
int error = 0;
|
106
111
|
|
107
|
-
for (i = 0; !error && i <
|
108
|
-
error =
|
112
|
+
for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); i++)
|
113
|
+
error = git_sysdir__dirs[i].guess(&git_sysdir__dirs[i].buf);
|
109
114
|
|
110
|
-
|
111
|
-
}
|
115
|
+
git__on_shutdown(git_sysdir_global_shutdown);
|
112
116
|
|
113
|
-
|
114
|
-
{
|
115
|
-
int i;
|
116
|
-
for (i = 0; i < GIT_SYSDIR__MAX; ++i)
|
117
|
-
git_buf_free(&git_sysdir__dirs[i]);
|
118
|
-
|
119
|
-
git_sysdir__dirs_shutdown_set = 0;
|
117
|
+
return error;
|
120
118
|
}
|
121
119
|
|
122
120
|
static int git_sysdir_check_selector(git_sysdir_t which)
|
123
121
|
{
|
124
|
-
if (which <
|
122
|
+
if (which < ARRAY_SIZE(git_sysdir__dirs))
|
125
123
|
return 0;
|
126
124
|
|
127
125
|
giterr_set(GITERR_INVALID, "config directory selector out of range");
|
@@ -137,18 +135,7 @@ int git_sysdir_get(const git_buf **out, git_sysdir_t which)
|
|
137
135
|
|
138
136
|
GITERR_CHECK_ERROR(git_sysdir_check_selector(which));
|
139
137
|
|
140
|
-
|
141
|
-
/* prepare shutdown if we're going to need it */
|
142
|
-
if (!git_sysdir__dirs_shutdown_set) {
|
143
|
-
git__on_shutdown(git_sysdir_global_shutdown);
|
144
|
-
git_sysdir__dirs_shutdown_set = 1;
|
145
|
-
}
|
146
|
-
|
147
|
-
GITERR_CHECK_ERROR(
|
148
|
-
git_sysdir__dir_guess[which](&git_sysdir__dirs[which]));
|
149
|
-
}
|
150
|
-
|
151
|
-
*out = &git_sysdir__dirs[which];
|
138
|
+
*out = &git_sysdir__dirs[which].buf;
|
152
139
|
return 0;
|
153
140
|
}
|
154
141
|
|
@@ -183,31 +170,38 @@ int git_sysdir_set(git_sysdir_t which, const char *search_path)
|
|
183
170
|
if (search_path != NULL)
|
184
171
|
expand_path = strstr(search_path, PATH_MAGIC);
|
185
172
|
|
186
|
-
/*
|
187
|
-
if (
|
188
|
-
|
189
|
-
git_sysdir__dir_guess[which](&git_sysdir__dirs[which]);
|
173
|
+
/* reset the default if this path has been cleared */
|
174
|
+
if (!search_path || expand_path)
|
175
|
+
git_sysdir__dirs[which].guess(&git_sysdir__dirs[which].buf);
|
190
176
|
|
191
177
|
/* if $PATH is not referenced, then just set the path */
|
192
|
-
if (!expand_path)
|
193
|
-
|
178
|
+
if (!expand_path) {
|
179
|
+
if (search_path)
|
180
|
+
git_buf_sets(&git_sysdir__dirs[which].buf, search_path);
|
181
|
+
|
182
|
+
goto done;
|
183
|
+
}
|
194
184
|
|
195
185
|
/* otherwise set to join(before $PATH, old value, after $PATH) */
|
196
186
|
if (expand_path > search_path)
|
197
187
|
git_buf_set(&merge, search_path, expand_path - search_path);
|
198
188
|
|
199
|
-
if (git_buf_len(&git_sysdir__dirs[which]))
|
189
|
+
if (git_buf_len(&git_sysdir__dirs[which].buf))
|
200
190
|
git_buf_join(&merge, GIT_PATH_LIST_SEPARATOR,
|
201
|
-
merge.ptr, git_sysdir__dirs[which].ptr);
|
191
|
+
merge.ptr, git_sysdir__dirs[which].buf.ptr);
|
202
192
|
|
203
193
|
expand_path += strlen(PATH_MAGIC);
|
204
194
|
if (*expand_path)
|
205
195
|
git_buf_join(&merge, GIT_PATH_LIST_SEPARATOR, merge.ptr, expand_path);
|
206
196
|
|
207
|
-
git_buf_swap(&git_sysdir__dirs[which], &merge);
|
197
|
+
git_buf_swap(&git_sysdir__dirs[which].buf, &merge);
|
208
198
|
git_buf_free(&merge);
|
209
199
|
|
210
|
-
|
200
|
+
done:
|
201
|
+
if (git_buf_oom(&git_sysdir__dirs[which].buf))
|
202
|
+
return -1;
|
203
|
+
|
204
|
+
return 0;
|
211
205
|
}
|
212
206
|
|
213
207
|
static int git_sysdir_find_in_dirlist(
|
data/vendor/libgit2/src/sysdir.h
CHANGED
@@ -103,9 +103,4 @@ extern int git_sysdir_get_str(char *out, size_t outlen, git_sysdir_t which);
|
|
103
103
|
*/
|
104
104
|
extern int git_sysdir_set(git_sysdir_t which, const char *paths);
|
105
105
|
|
106
|
-
/**
|
107
|
-
* Free the configuration file search paths.
|
108
|
-
*/
|
109
|
-
extern void git_sysdir_global_shutdown(void);
|
110
|
-
|
111
106
|
#endif /* INCLUDE_sysdir_h__ */
|
@@ -40,58 +40,12 @@ typedef git_atomic git_atomic_ssize;
|
|
40
40
|
|
41
41
|
#ifdef GIT_THREADS
|
42
42
|
|
43
|
-
#
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
} git_thread;
|
48
|
-
|
49
|
-
#define git_thread_create(git_thread_ptr, attr, start_routine, arg) \
|
50
|
-
pthread_create(&(git_thread_ptr)->thread, attr, start_routine, arg)
|
51
|
-
#define git_thread_join(git_thread_ptr, status) \
|
52
|
-
pthread_join((git_thread_ptr)->thread, status)
|
53
|
-
|
54
|
-
#endif
|
55
|
-
|
56
|
-
/* Pthreads Mutex */
|
57
|
-
#define git_mutex pthread_mutex_t
|
58
|
-
#define git_mutex_init(a) pthread_mutex_init(a, NULL)
|
59
|
-
#define git_mutex_lock(a) pthread_mutex_lock(a)
|
60
|
-
#define git_mutex_unlock(a) pthread_mutex_unlock(a)
|
61
|
-
#define git_mutex_free(a) pthread_mutex_destroy(a)
|
62
|
-
|
63
|
-
/* Pthreads condition vars */
|
64
|
-
#define git_cond pthread_cond_t
|
65
|
-
#define git_cond_init(c) pthread_cond_init(c, NULL)
|
66
|
-
#define git_cond_free(c) pthread_cond_destroy(c)
|
67
|
-
#define git_cond_wait(c, l) pthread_cond_wait(c, l)
|
68
|
-
#define git_cond_signal(c) pthread_cond_signal(c)
|
69
|
-
#define git_cond_broadcast(c) pthread_cond_broadcast(c)
|
70
|
-
|
71
|
-
/* Pthread (-ish) rwlock
|
72
|
-
*
|
73
|
-
* This differs from normal pthreads rwlocks in two ways:
|
74
|
-
* 1. Separate APIs for releasing read locks and write locks (as
|
75
|
-
* opposed to the pure POSIX API which only has one unlock fn)
|
76
|
-
* 2. You should not use recursive read locks (i.e. grabbing a read
|
77
|
-
* lock in a thread that already holds a read lock) because the
|
78
|
-
* Windows implementation doesn't support it
|
79
|
-
*/
|
80
|
-
#define git_rwlock pthread_rwlock_t
|
81
|
-
#define git_rwlock_init(a) pthread_rwlock_init(a, NULL)
|
82
|
-
#define git_rwlock_rdlock(a) pthread_rwlock_rdlock(a)
|
83
|
-
#define git_rwlock_rdunlock(a) pthread_rwlock_rdunlock(a)
|
84
|
-
#define git_rwlock_wrlock(a) pthread_rwlock_wrlock(a)
|
85
|
-
#define git_rwlock_wrunlock(a) pthread_rwlock_wrunlock(a)
|
86
|
-
#define git_rwlock_free(a) pthread_rwlock_destroy(a)
|
87
|
-
#define GIT_RWLOCK_STATIC_INIT PTHREAD_RWLOCK_INITIALIZER
|
88
|
-
|
89
|
-
#ifndef GIT_WIN32
|
90
|
-
#define pthread_rwlock_rdunlock pthread_rwlock_unlock
|
91
|
-
#define pthread_rwlock_wrunlock pthread_rwlock_unlock
|
43
|
+
#ifdef GIT_WIN32
|
44
|
+
# include "win32/thread.h"
|
45
|
+
#else
|
46
|
+
# include "unix/pthread.h"
|
92
47
|
#endif
|
93
48
|
|
94
|
-
|
95
49
|
GIT_INLINE(void) git_atomic_set(git_atomic *a, int val)
|
96
50
|
{
|
97
51
|
#if defined(GIT_WIN32)
|
@@ -178,7 +132,7 @@ GIT_INLINE(int64_t) git_atomic64_add(git_atomic64 *a, int64_t addend)
|
|
178
132
|
#else
|
179
133
|
|
180
134
|
#define git_thread unsigned int
|
181
|
-
#define git_thread_create(thread,
|
135
|
+
#define git_thread_create(thread, start_routine, arg) 0
|
182
136
|
#define git_thread_join(id, status) (void)0
|
183
137
|
|
184
138
|
/* Pthreads Mutex */
|
@@ -29,9 +29,7 @@ static transport_definition local_transport_definition = { "file://", git_transp
|
|
29
29
|
static transport_definition transports[] = {
|
30
30
|
{ "git://", git_transport_smart, &git_subtransport_definition },
|
31
31
|
{ "http://", git_transport_smart, &http_subtransport_definition },
|
32
|
-
#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT)
|
33
32
|
{ "https://", git_transport_smart, &http_subtransport_definition },
|
34
|
-
#endif
|
35
33
|
{ "file://", git_transport_local, NULL },
|
36
34
|
#ifdef GIT_SSH
|
37
35
|
{ "ssh://", git_transport_smart, &ssh_subtransport_definition },
|
@@ -89,10 +87,10 @@ static int transport_find_fn(
|
|
89
87
|
/* For other systems, perform the SSH check first, to avoid going to the
|
90
88
|
* filesystem if it is not necessary */
|
91
89
|
|
92
|
-
/* It could be a SSH remote path. Check to see if there's a :
|
93
|
-
* SSH is an unsupported transport mechanism in this version of libgit2 */
|
90
|
+
/* It could be a SSH remote path. Check to see if there's a : */
|
94
91
|
if (!definition && strrchr(url, ':')) {
|
95
|
-
|
92
|
+
/* re-search transports again with ssh:// as url
|
93
|
+
* so that we can find a third party ssh transport */
|
96
94
|
definition = transport_find_by_url("ssh://");
|
97
95
|
}
|
98
96
|
|
@@ -114,7 +114,7 @@ static bool challenge_match(git_http_auth_scheme *scheme, void *data)
|
|
114
114
|
size_t scheme_len;
|
115
115
|
|
116
116
|
scheme_len = strlen(scheme_name);
|
117
|
-
return (
|
117
|
+
return (strncasecmp(challenge, scheme_name, scheme_len) == 0 &&
|
118
118
|
(challenge[scheme_len] == '\0' || challenge[scheme_len] == ' '));
|
119
119
|
}
|
120
120
|
|
@@ -620,7 +620,6 @@ static int http_connect(http_subtransport *t)
|
|
620
620
|
|
621
621
|
error = git_stream_connect(t->io);
|
622
622
|
|
623
|
-
#if defined(GIT_OPENSSL) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CURL)
|
624
623
|
if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL &&
|
625
624
|
git_stream_is_encrypted(t->io)) {
|
626
625
|
git_cert *cert;
|
@@ -640,7 +639,7 @@ static int http_connect(http_subtransport *t)
|
|
640
639
|
return error;
|
641
640
|
}
|
642
641
|
}
|
643
|
-
|
642
|
+
|
644
643
|
if (error < 0)
|
645
644
|
return error;
|
646
645
|
|