rugged 1.5.1 → 1.6.2
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.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +2 -2
- data/ext/rugged/rugged_blame.c +2 -0
- data/ext/rugged/rugged_blob.c +3 -0
- data/ext/rugged/rugged_commit.c +1 -0
- data/ext/rugged/rugged_config.c +2 -0
- data/ext/rugged/rugged_diff.c +1 -0
- data/ext/rugged/rugged_index.c +2 -0
- data/ext/rugged/rugged_patch.c +1 -0
- data/ext/rugged/rugged_rebase.c +1 -0
- data/ext/rugged/rugged_reference.c +1 -0
- data/ext/rugged/rugged_remote.c +1 -0
- data/ext/rugged/rugged_repo.c +5 -2
- data/ext/rugged/rugged_revwalk.c +5 -1
- data/ext/rugged/rugged_submodule.c +1 -0
- data/ext/rugged/rugged_tag.c +1 -0
- data/ext/rugged/rugged_tree.c +4 -0
- data/lib/rugged/index.rb +1 -1
- data/lib/rugged/tree.rb +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +5 -1
- data/vendor/libgit2/COPYING +30 -0
- data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +2 -0
- data/vendor/libgit2/include/git2/common.h +13 -6
- data/vendor/libgit2/include/git2/deprecated.h +6 -0
- data/vendor/libgit2/include/git2/diff.h +1 -1
- data/vendor/libgit2/include/git2/experimental.h +20 -0
- data/vendor/libgit2/include/git2/indexer.h +29 -0
- data/vendor/libgit2/include/git2/object.h +28 -2
- data/vendor/libgit2/include/git2/odb.h +58 -7
- data/vendor/libgit2/include/git2/odb_backend.h +106 -18
- data/vendor/libgit2/include/git2/oid.h +115 -15
- data/vendor/libgit2/include/git2/repository.h +20 -1
- data/vendor/libgit2/include/git2/stash.h +60 -6
- data/vendor/libgit2/include/git2/strarray.h +0 -13
- data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +12 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +0 -6
- data/vendor/libgit2/src/cli/CMakeLists.txt +6 -2
- data/vendor/libgit2/src/cli/cmd_hash_object.c +27 -8
- data/vendor/libgit2/src/cli/opt.c +1 -1
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +25 -15
- data/vendor/libgit2/src/libgit2/annotated_commit.c +1 -1
- data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
- data/vendor/libgit2/src/libgit2/attr_file.c +1 -1
- data/vendor/libgit2/src/libgit2/attrcache.c +1 -1
- data/vendor/libgit2/src/libgit2/blame.c +2 -0
- data/vendor/libgit2/src/libgit2/blob.c +4 -2
- data/vendor/libgit2/src/libgit2/blob.h +2 -2
- data/vendor/libgit2/src/libgit2/branch.c +2 -2
- data/vendor/libgit2/src/libgit2/cherrypick.c +3 -3
- data/vendor/libgit2/src/libgit2/clone.c +31 -2
- data/vendor/libgit2/src/libgit2/commit.c +52 -17
- data/vendor/libgit2/src/libgit2/commit.h +25 -7
- data/vendor/libgit2/src/libgit2/commit_graph.c +47 -32
- data/vendor/libgit2/src/libgit2/commit_graph.h +3 -0
- data/vendor/libgit2/src/libgit2/commit_list.c +6 -2
- data/vendor/libgit2/src/libgit2/config.c +1 -1
- data/vendor/libgit2/src/libgit2/config_file.c +2 -2
- data/vendor/libgit2/src/libgit2/describe.c +8 -8
- data/vendor/libgit2/src/libgit2/diff.c +5 -1
- data/vendor/libgit2/src/libgit2/diff_file.c +15 -6
- data/vendor/libgit2/src/libgit2/diff_generate.c +17 -12
- data/vendor/libgit2/src/libgit2/diff_print.c +5 -5
- data/vendor/libgit2/src/libgit2/diff_tform.c +4 -0
- data/vendor/libgit2/src/libgit2/email.c +2 -2
- data/vendor/libgit2/src/libgit2/experimental.h.in +13 -0
- data/vendor/libgit2/src/libgit2/fetch.c +3 -6
- data/vendor/libgit2/src/libgit2/fetchhead.c +4 -4
- data/vendor/libgit2/src/libgit2/ident.c +3 -3
- data/vendor/libgit2/src/libgit2/index.c +11 -9
- data/vendor/libgit2/src/libgit2/indexer.c +107 -44
- data/vendor/libgit2/src/libgit2/iterator.c +4 -2
- data/vendor/libgit2/src/libgit2/libgit2.c +19 -0
- data/vendor/libgit2/src/libgit2/merge.c +3 -3
- data/vendor/libgit2/src/libgit2/midx.c +16 -15
- data/vendor/libgit2/src/libgit2/mwindow.c +5 -2
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -1
- data/vendor/libgit2/src/libgit2/notes.c +5 -5
- data/vendor/libgit2/src/libgit2/object.c +89 -25
- data/vendor/libgit2/src/libgit2/object.h +12 -3
- data/vendor/libgit2/src/libgit2/odb.c +194 -50
- data/vendor/libgit2/src/libgit2/odb.h +43 -4
- data/vendor/libgit2/src/libgit2/odb_loose.c +128 -70
- data/vendor/libgit2/src/libgit2/odb_pack.c +96 -44
- data/vendor/libgit2/src/libgit2/oid.c +134 -76
- data/vendor/libgit2/src/libgit2/oid.h +183 -9
- data/vendor/libgit2/src/libgit2/pack-objects.c +15 -4
- data/vendor/libgit2/src/libgit2/pack.c +90 -66
- data/vendor/libgit2/src/libgit2/pack.h +29 -15
- data/vendor/libgit2/src/libgit2/parse.c +4 -3
- data/vendor/libgit2/src/libgit2/patch_parse.c +5 -5
- data/vendor/libgit2/src/libgit2/push.c +13 -3
- data/vendor/libgit2/src/libgit2/reader.c +1 -1
- data/vendor/libgit2/src/libgit2/rebase.c +19 -18
- data/vendor/libgit2/src/libgit2/refdb_fs.c +70 -39
- data/vendor/libgit2/src/libgit2/reflog.c +7 -5
- data/vendor/libgit2/src/libgit2/reflog.h +1 -2
- data/vendor/libgit2/src/libgit2/refs.c +2 -0
- data/vendor/libgit2/src/libgit2/remote.c +38 -37
- data/vendor/libgit2/src/libgit2/remote.h +40 -0
- data/vendor/libgit2/src/libgit2/repository.c +212 -36
- data/vendor/libgit2/src/libgit2/repository.h +9 -0
- data/vendor/libgit2/src/libgit2/reset.c +2 -2
- data/vendor/libgit2/src/libgit2/revert.c +4 -4
- data/vendor/libgit2/src/libgit2/revparse.c +23 -7
- data/vendor/libgit2/src/libgit2/revwalk.c +5 -1
- data/vendor/libgit2/src/libgit2/stash.c +201 -26
- data/vendor/libgit2/src/libgit2/strarray.c +1 -0
- data/vendor/libgit2/src/libgit2/strarray.h +25 -0
- data/vendor/libgit2/src/libgit2/streams/openssl.c +1 -1
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +7 -3
- data/vendor/libgit2/src/libgit2/streams/socket.c +4 -1
- data/vendor/libgit2/src/libgit2/submodule.c +6 -2
- data/vendor/libgit2/src/libgit2/sysdir.c +294 -7
- data/vendor/libgit2/src/libgit2/sysdir.h +39 -9
- data/vendor/libgit2/src/libgit2/tag.c +29 -10
- data/vendor/libgit2/src/libgit2/tag.h +2 -2
- data/vendor/libgit2/src/libgit2/threadstate.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/http.c +8 -7
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +9 -0
- data/vendor/libgit2/src/libgit2/transports/httpclient.h +10 -0
- data/vendor/libgit2/src/libgit2/transports/local.c +14 -0
- data/vendor/libgit2/src/libgit2/transports/smart.c +35 -0
- data/vendor/libgit2/src/libgit2/transports/smart.h +10 -1
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +153 -41
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +42 -12
- data/vendor/libgit2/src/libgit2/transports/ssh.c +62 -65
- data/vendor/libgit2/src/libgit2/transports/winhttp.c +9 -4
- data/vendor/libgit2/src/libgit2/tree-cache.c +4 -4
- data/vendor/libgit2/src/libgit2/tree.c +22 -16
- data/vendor/libgit2/src/libgit2/tree.h +2 -2
- data/vendor/libgit2/src/libgit2/worktree.c +5 -0
- data/vendor/libgit2/src/util/CMakeLists.txt +7 -1
- data/vendor/libgit2/src/util/fs_path.c +1 -1
- data/vendor/libgit2/src/util/futils.c +0 -3
- data/vendor/libgit2/src/util/git2_util.h +2 -2
- data/vendor/libgit2/src/util/hash/openssl.c +4 -3
- data/vendor/libgit2/src/util/hash/rfc6234/sha.h +0 -112
- data/vendor/libgit2/src/util/hash.h +13 -0
- data/vendor/libgit2/src/util/net.c +338 -84
- data/vendor/libgit2/src/util/net.h +7 -0
- data/vendor/libgit2/src/util/posix.h +2 -0
- data/vendor/libgit2/src/util/rand.c +4 -0
- data/vendor/libgit2/src/util/regexp.c +3 -3
- data/vendor/libgit2/src/util/thread.h +20 -19
- data/vendor/libgit2/src/util/util.h +1 -0
- metadata +7 -5
- data/vendor/libgit2/src/util/win32/findfile.c +0 -286
- data/vendor/libgit2/src/util/win32/findfile.h +0 -22
- /data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +0 -0
@@ -93,121 +93,367 @@ int git_net_url_dup(git_net_url *out, git_net_url *in)
|
|
93
93
|
return 0;
|
94
94
|
}
|
95
95
|
|
96
|
-
int
|
96
|
+
static int url_invalid(const char *message)
|
97
97
|
{
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
host = GIT_STR_INIT,
|
102
|
-
port = GIT_STR_INIT,
|
103
|
-
path = GIT_STR_INIT,
|
104
|
-
username = GIT_STR_INIT,
|
105
|
-
password = GIT_STR_INIT,
|
106
|
-
query = GIT_STR_INIT;
|
107
|
-
int error = GIT_EINVALIDSPEC;
|
108
|
-
|
109
|
-
if (http_parser_parse_url(given, strlen(given), false, &u)) {
|
110
|
-
git_error_set(GIT_ERROR_NET, "malformed URL '%s'", given);
|
111
|
-
goto done;
|
112
|
-
}
|
98
|
+
git_error_set(GIT_ERROR_NET, "invalid url: %s", message);
|
99
|
+
return GIT_EINVALIDSPEC;
|
100
|
+
}
|
113
101
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
102
|
+
static int url_parse_authority(
|
103
|
+
const char **user_start, size_t *user_len,
|
104
|
+
const char **password_start, size_t *password_len,
|
105
|
+
const char **host_start, size_t *host_len,
|
106
|
+
const char **port_start, size_t *port_len,
|
107
|
+
const char *authority_start, size_t len,
|
108
|
+
const char *scheme_start, size_t scheme_len)
|
109
|
+
{
|
110
|
+
const char *c, *hostport_end, *host_end = NULL,
|
111
|
+
*userpass_end, *user_end = NULL;
|
120
112
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
git_str_put(&scheme, url_scheme, url_scheme_len);
|
125
|
-
git__strntolower(scheme.ptr, scheme.size);
|
126
|
-
} else {
|
127
|
-
git_error_set(GIT_ERROR_NET, "malformed URL '%s'", given);
|
128
|
-
goto done;
|
129
|
-
}
|
113
|
+
enum {
|
114
|
+
HOSTPORT, HOST, IPV6, HOST_END, USERPASS, USER
|
115
|
+
} state = HOSTPORT;
|
130
116
|
|
131
|
-
if (
|
132
|
-
|
133
|
-
size_t url_host_len = u.field_data[UF_HOST].len;
|
134
|
-
git_str_decode_percent(&host, url_host, url_host_len);
|
135
|
-
}
|
117
|
+
if (len == 0)
|
118
|
+
return 0;
|
136
119
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
120
|
+
/*
|
121
|
+
* walk the authority backwards so that we can parse google code's
|
122
|
+
* ssh urls that are not rfc compliant and allow @ in the username
|
123
|
+
*/
|
124
|
+
for (hostport_end = authority_start + len, c = hostport_end - 1;
|
125
|
+
c >= authority_start && !user_end;
|
126
|
+
c--) {
|
127
|
+
switch (state) {
|
128
|
+
case HOSTPORT:
|
129
|
+
if (*c == ':') {
|
130
|
+
*port_start = c + 1;
|
131
|
+
*port_len = hostport_end - *port_start;
|
132
|
+
host_end = c;
|
133
|
+
state = HOST;
|
134
|
+
break;
|
135
|
+
}
|
143
136
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
137
|
+
/*
|
138
|
+
* if we've only seen digits then we don't know
|
139
|
+
* if we're parsing just a host or a host and port.
|
140
|
+
* if we see a non-digit, then we're in a host,
|
141
|
+
* otherwise, fall through to possibly match the
|
142
|
+
* "@" (user/host separator).
|
143
|
+
*/
|
144
|
+
|
145
|
+
if (*c < '0' || *c > '9') {
|
146
|
+
host_end = hostport_end;
|
147
|
+
state = HOST;
|
148
|
+
}
|
148
149
|
|
149
|
-
|
150
|
-
}
|
150
|
+
/* fall through */
|
151
151
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
152
|
+
case HOST:
|
153
|
+
if (*c == ']' && host_end == c + 1) {
|
154
|
+
host_end = c;
|
155
|
+
state = IPV6;
|
156
|
+
}
|
157
|
+
|
158
|
+
else if (*c == '@') {
|
159
|
+
*host_start = c + 1;
|
160
|
+
*host_len = host_end ? host_end - *host_start :
|
161
|
+
hostport_end - *host_start;
|
162
|
+
userpass_end = c;
|
163
|
+
state = USERPASS;
|
164
|
+
}
|
165
|
+
|
166
|
+
else if (*c == '[' || *c == ']' || *c == ':') {
|
167
|
+
return url_invalid("malformed hostname");
|
168
|
+
}
|
169
|
+
|
170
|
+
break;
|
171
|
+
|
172
|
+
case IPV6:
|
173
|
+
if (*c == '[') {
|
174
|
+
*host_start = c + 1;
|
175
|
+
*host_len = host_end - *host_start;
|
176
|
+
state = HOST_END;
|
177
|
+
}
|
178
|
+
|
179
|
+
else if ((*c < '0' || *c > '9') &&
|
180
|
+
(*c < 'a' || *c > 'f') &&
|
181
|
+
(*c < 'A' || *c > 'F') &&
|
182
|
+
(*c != ':')) {
|
183
|
+
return url_invalid("malformed hostname");
|
184
|
+
}
|
185
|
+
|
186
|
+
break;
|
187
|
+
|
188
|
+
case HOST_END:
|
189
|
+
if (*c == '@') {
|
190
|
+
userpass_end = c;
|
191
|
+
state = USERPASS;
|
192
|
+
break;
|
193
|
+
}
|
194
|
+
|
195
|
+
return url_invalid("malformed hostname");
|
196
|
+
|
197
|
+
case USERPASS:
|
198
|
+
if (*c == '@' &&
|
199
|
+
strncasecmp(scheme_start, "ssh", scheme_len))
|
200
|
+
return url_invalid("malformed hostname");
|
201
|
+
|
202
|
+
if (*c == ':') {
|
203
|
+
*password_start = c + 1;
|
204
|
+
*password_len = userpass_end - *password_start;
|
205
|
+
user_end = c;
|
206
|
+
state = USER;
|
207
|
+
break;
|
208
|
+
}
|
209
|
+
|
210
|
+
break;
|
211
|
+
|
212
|
+
default:
|
213
|
+
GIT_ASSERT(!"unhandled state");
|
214
|
+
}
|
158
215
|
}
|
159
216
|
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
217
|
+
switch (state) {
|
218
|
+
case HOSTPORT:
|
219
|
+
*host_start = authority_start;
|
220
|
+
*host_len = (hostport_end - *host_start);
|
221
|
+
break;
|
222
|
+
case HOST:
|
223
|
+
*host_start = authority_start;
|
224
|
+
*host_len = (host_end - *host_start);
|
225
|
+
break;
|
226
|
+
case IPV6:
|
227
|
+
return url_invalid("malformed hostname");
|
228
|
+
case HOST_END:
|
229
|
+
break;
|
230
|
+
case USERPASS:
|
231
|
+
*user_start = authority_start;
|
232
|
+
*user_len = (userpass_end - *user_start);
|
233
|
+
break;
|
234
|
+
case USER:
|
235
|
+
*user_start = authority_start;
|
236
|
+
*user_len = (user_end - *user_start);
|
237
|
+
break;
|
238
|
+
default:
|
239
|
+
GIT_ASSERT(!"unhandled state");
|
164
240
|
}
|
165
241
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
242
|
+
return 0;
|
243
|
+
}
|
244
|
+
|
245
|
+
int git_net_url_parse(git_net_url *url, const char *given)
|
246
|
+
{
|
247
|
+
const char *c, *scheme_start, *authority_start, *user_start,
|
248
|
+
*password_start, *host_start, *port_start, *path_start,
|
249
|
+
*query_start, *fragment_start, *default_port;
|
250
|
+
git_str scheme = GIT_STR_INIT, user = GIT_STR_INIT,
|
251
|
+
password = GIT_STR_INIT, host = GIT_STR_INIT,
|
252
|
+
port = GIT_STR_INIT, path = GIT_STR_INIT,
|
253
|
+
query = GIT_STR_INIT, fragment = GIT_STR_INIT;
|
254
|
+
size_t scheme_len = 0, user_len = 0, password_len = 0, host_len = 0,
|
255
|
+
port_len = 0, path_len = 0, query_len = 0, fragment_len = 0;
|
256
|
+
bool hierarchical = false;
|
257
|
+
int error = 0;
|
258
|
+
|
259
|
+
enum {
|
260
|
+
SCHEME,
|
261
|
+
AUTHORITY_START, AUTHORITY,
|
262
|
+
PATH_START, PATH,
|
263
|
+
QUERY,
|
264
|
+
FRAGMENT
|
265
|
+
} state = SCHEME;
|
266
|
+
|
267
|
+
memset(url, 0, sizeof(git_net_url));
|
268
|
+
|
269
|
+
for (c = scheme_start = given; *c; c++) {
|
270
|
+
switch (state) {
|
271
|
+
case SCHEME:
|
272
|
+
if (*c == ':') {
|
273
|
+
scheme_len = (c - scheme_start);
|
274
|
+
|
275
|
+
if (*(c+1) == '/' && *(c+2) == '/') {
|
276
|
+
c += 2;
|
277
|
+
hierarchical = true;
|
278
|
+
state = AUTHORITY_START;
|
279
|
+
} else {
|
280
|
+
state = PATH_START;
|
281
|
+
}
|
282
|
+
} else if ((*c < 'A' || *c > 'Z') &&
|
283
|
+
(*c < 'a' || *c > 'z') &&
|
284
|
+
(*c < '0' || *c > '9') &&
|
285
|
+
(*c != '+' && *c != '-' && *c != '.')) {
|
286
|
+
/*
|
287
|
+
* an illegal scheme character means that we
|
288
|
+
* were just given a relative path
|
289
|
+
*/
|
290
|
+
path_start = given;
|
291
|
+
state = PATH;
|
292
|
+
break;
|
293
|
+
}
|
294
|
+
break;
|
295
|
+
|
296
|
+
case AUTHORITY_START:
|
297
|
+
authority_start = c;
|
298
|
+
state = AUTHORITY;
|
299
|
+
|
300
|
+
/* fall through */
|
301
|
+
|
302
|
+
case AUTHORITY:
|
303
|
+
if (*c != '/')
|
304
|
+
break;
|
305
|
+
|
306
|
+
/*
|
307
|
+
* authority is sufficiently complex that we parse
|
308
|
+
* it separately
|
309
|
+
*/
|
310
|
+
if ((error = url_parse_authority(
|
311
|
+
&user_start, &user_len,
|
312
|
+
&password_start,&password_len,
|
313
|
+
&host_start, &host_len,
|
314
|
+
&port_start, &port_len,
|
315
|
+
authority_start, (c - authority_start),
|
316
|
+
scheme_start, scheme_len)) < 0)
|
317
|
+
goto done;
|
318
|
+
|
319
|
+
/* fall through */
|
320
|
+
|
321
|
+
case PATH_START:
|
322
|
+
path_start = c;
|
323
|
+
state = PATH;
|
324
|
+
/* fall through */
|
325
|
+
|
326
|
+
case PATH:
|
327
|
+
switch (*c) {
|
328
|
+
case '?':
|
329
|
+
path_len = (c - path_start);
|
330
|
+
query_start = c + 1;
|
331
|
+
state = QUERY;
|
332
|
+
break;
|
333
|
+
case '#':
|
334
|
+
path_len = (c - path_start);
|
335
|
+
fragment_start = c + 1;
|
336
|
+
state = FRAGMENT;
|
337
|
+
break;
|
338
|
+
}
|
339
|
+
break;
|
340
|
+
|
341
|
+
case QUERY:
|
342
|
+
if (*c == '#') {
|
343
|
+
query_len = (c - query_start);
|
344
|
+
fragment_start = c + 1;
|
345
|
+
state = FRAGMENT;
|
346
|
+
}
|
347
|
+
break;
|
170
348
|
|
171
|
-
|
172
|
-
|
173
|
-
size_t url_username_len = colon - url_userinfo;
|
174
|
-
const char *url_password = colon + 1;
|
175
|
-
size_t url_password_len = url_userinfo_len - (url_username_len + 1);
|
349
|
+
case FRAGMENT:
|
350
|
+
break;
|
176
351
|
|
177
|
-
|
178
|
-
|
179
|
-
} else {
|
180
|
-
git_str_decode_percent(&username, url_userinfo, url_userinfo_len);
|
352
|
+
default:
|
353
|
+
GIT_ASSERT(!"unhandled state");
|
181
354
|
}
|
182
355
|
}
|
183
356
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
357
|
+
switch (state) {
|
358
|
+
case SCHEME:
|
359
|
+
/*
|
360
|
+
* if we never saw a ':' then we were given a relative
|
361
|
+
* path, not a bare scheme
|
362
|
+
*/
|
363
|
+
path_start = given;
|
364
|
+
path_len = (c - scheme_start);
|
365
|
+
break;
|
366
|
+
case AUTHORITY_START:
|
367
|
+
break;
|
368
|
+
case AUTHORITY:
|
369
|
+
if ((error = url_parse_authority(
|
370
|
+
&user_start, &user_len,
|
371
|
+
&password_start,&password_len,
|
372
|
+
&host_start, &host_len,
|
373
|
+
&port_start, &port_len,
|
374
|
+
authority_start, (c - authority_start),
|
375
|
+
scheme_start, scheme_len)) < 0)
|
376
|
+
goto done;
|
377
|
+
break;
|
378
|
+
case PATH_START:
|
379
|
+
break;
|
380
|
+
case PATH:
|
381
|
+
path_len = (c - path_start);
|
382
|
+
break;
|
383
|
+
case QUERY:
|
384
|
+
query_len = (c - query_start);
|
385
|
+
break;
|
386
|
+
case FRAGMENT:
|
387
|
+
fragment_len = (c - fragment_start);
|
388
|
+
break;
|
389
|
+
default:
|
390
|
+
GIT_ASSERT(!"unhandled state");
|
391
|
+
}
|
392
|
+
|
393
|
+
if (scheme_len) {
|
394
|
+
if ((error = git_str_put(&scheme, scheme_start, scheme_len)) < 0)
|
395
|
+
goto done;
|
396
|
+
|
397
|
+
git__strntolower(scheme.ptr, scheme.size);
|
398
|
+
}
|
399
|
+
|
400
|
+
if (user_len &&
|
401
|
+
(error = git_str_decode_percent(&user, user_start, user_len)) < 0)
|
402
|
+
goto done;
|
403
|
+
|
404
|
+
if (password_len &&
|
405
|
+
(error = git_str_decode_percent(&password, password_start, password_len)) < 0)
|
406
|
+
goto done;
|
407
|
+
|
408
|
+
if (host_len &&
|
409
|
+
(error = git_str_decode_percent(&host, host_start, host_len)) < 0)
|
410
|
+
goto done;
|
411
|
+
|
412
|
+
if (port_len)
|
413
|
+
error = git_str_put(&port, port_start, port_len);
|
414
|
+
else if (scheme_len && (default_port = default_port_for_scheme(scheme.ptr)) != NULL)
|
415
|
+
error = git_str_puts(&port, default_port);
|
416
|
+
|
417
|
+
if (error < 0)
|
418
|
+
goto done;
|
419
|
+
|
420
|
+
if (path_len)
|
421
|
+
error = git_str_put(&path, path_start, path_len);
|
422
|
+
else if (hierarchical)
|
423
|
+
error = git_str_puts(&path, "/");
|
424
|
+
|
425
|
+
if (error < 0)
|
426
|
+
goto done;
|
427
|
+
|
428
|
+
if (query_len &&
|
429
|
+
(error = git_str_decode_percent(&query, query_start, query_len)) < 0)
|
430
|
+
goto done;
|
431
|
+
|
432
|
+
if (fragment_len &&
|
433
|
+
(error = git_str_decode_percent(&fragment, fragment_start, fragment_len)) < 0)
|
434
|
+
goto done;
|
192
435
|
|
193
436
|
url->scheme = git_str_detach(&scheme);
|
194
437
|
url->host = git_str_detach(&host);
|
195
438
|
url->port = git_str_detach(&port);
|
196
439
|
url->path = git_str_detach(&path);
|
197
440
|
url->query = git_str_detach(&query);
|
198
|
-
url->
|
441
|
+
url->fragment = git_str_detach(&fragment);
|
442
|
+
url->username = git_str_detach(&user);
|
199
443
|
url->password = git_str_detach(&password);
|
200
444
|
|
201
445
|
error = 0;
|
202
446
|
|
203
447
|
done:
|
204
448
|
git_str_dispose(&scheme);
|
449
|
+
git_str_dispose(&user);
|
450
|
+
git_str_dispose(&password);
|
205
451
|
git_str_dispose(&host);
|
206
452
|
git_str_dispose(&port);
|
207
453
|
git_str_dispose(&path);
|
208
454
|
git_str_dispose(&query);
|
209
|
-
git_str_dispose(&
|
210
|
-
|
455
|
+
git_str_dispose(&fragment);
|
456
|
+
|
211
457
|
return error;
|
212
458
|
}
|
213
459
|
|
@@ -374,7 +620,7 @@ int git_net_url_parse_scp(git_net_url *url, const char *given)
|
|
374
620
|
break;
|
375
621
|
|
376
622
|
default:
|
377
|
-
GIT_ASSERT("unhandled state");
|
623
|
+
GIT_ASSERT(!"unhandled state");
|
378
624
|
}
|
379
625
|
}
|
380
626
|
|
@@ -400,6 +646,13 @@ int git_net_url_parse_scp(git_net_url *url, const char *given)
|
|
400
646
|
return 0;
|
401
647
|
}
|
402
648
|
|
649
|
+
int git_net_url_parse_standard_or_scp(git_net_url *url, const char *given)
|
650
|
+
{
|
651
|
+
return git_net_str_is_url(given) ?
|
652
|
+
git_net_url_parse(url, given) :
|
653
|
+
git_net_url_parse_scp(url, given);
|
654
|
+
}
|
655
|
+
|
403
656
|
int git_net_url_joinpath(
|
404
657
|
git_net_url *out,
|
405
658
|
git_net_url *one,
|
@@ -588,7 +841,7 @@ bool git_net_url_is_default_port(git_net_url *url)
|
|
588
841
|
{
|
589
842
|
const char *default_port;
|
590
843
|
|
591
|
-
if ((default_port = default_port_for_scheme(url->scheme)) != NULL)
|
844
|
+
if (url->scheme && (default_port = default_port_for_scheme(url->scheme)) != NULL)
|
592
845
|
return (strcmp(url->port, default_port) == 0);
|
593
846
|
else
|
594
847
|
return false;
|
@@ -744,6 +997,7 @@ void git_net_url_dispose(git_net_url *url)
|
|
744
997
|
git__free(url->port); url->port = NULL;
|
745
998
|
git__free(url->path); url->path = NULL;
|
746
999
|
git__free(url->query); url->query = NULL;
|
1000
|
+
git__free(url->fragment); url->fragment = NULL;
|
747
1001
|
git__free(url->username); url->username = NULL;
|
748
1002
|
git__free(url->password); url->password = NULL;
|
749
1003
|
}
|
@@ -15,6 +15,7 @@ typedef struct git_net_url {
|
|
15
15
|
char *port;
|
16
16
|
char *path;
|
17
17
|
char *query;
|
18
|
+
char *fragment;
|
18
19
|
char *username;
|
19
20
|
char *password;
|
20
21
|
} git_net_url;
|
@@ -33,6 +34,12 @@ extern int git_net_url_parse(git_net_url *url, const char *str);
|
|
33
34
|
/** Parses a string containing an SCP style path into a URL structure. */
|
34
35
|
extern int git_net_url_parse_scp(git_net_url *url, const char *str);
|
35
36
|
|
37
|
+
/**
|
38
|
+
* Parses a string containing a standard URL or an SCP style path into
|
39
|
+
* a URL structure.
|
40
|
+
*/
|
41
|
+
extern int git_net_url_parse_standard_or_scp(git_net_url *url, const char *str);
|
42
|
+
|
36
43
|
/** Appends a path and/or query string to the given URL */
|
37
44
|
extern int git_net_url_joinpath(
|
38
45
|
git_net_url *out,
|
@@ -108,11 +108,11 @@ int git_regexp_match(const git_regexp *r, const char *string)
|
|
108
108
|
data = pcre2_match_data_create(1, NULL);
|
109
109
|
GIT_ERROR_CHECK_ALLOC(data);
|
110
110
|
|
111
|
-
|
112
|
-
|
111
|
+
error = pcre2_match(*r, (const unsigned char *) string, strlen(string), 0, 0, data, NULL);
|
112
|
+
pcre2_match_data_free(data);
|
113
|
+
if (error < 0)
|
113
114
|
return (error == PCRE2_ERROR_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC;
|
114
115
|
|
115
|
-
pcre2_match_data_free(data);
|
116
116
|
return 0;
|
117
117
|
}
|
118
118
|
|
@@ -260,36 +260,37 @@ GIT_INLINE(int64_t) git_atomic64_get(git_atomic64 *a)
|
|
260
260
|
|
261
261
|
#else
|
262
262
|
|
263
|
-
#define git_threads_global_init
|
263
|
+
#define git_threads_global_init git__noop
|
264
264
|
|
265
265
|
#define git_thread unsigned int
|
266
|
-
#define git_thread_create(
|
267
|
-
#define git_thread_join(
|
266
|
+
#define git_thread_create(t, s, a) git__noop(t, s, a)
|
267
|
+
#define git_thread_join(i, s) git__noop_args(i, s)
|
268
268
|
|
269
269
|
/* Pthreads Mutex */
|
270
270
|
#define git_mutex unsigned int
|
271
|
-
#define git_mutex_init(a)
|
272
|
-
#define git_mutex_init(a)
|
273
|
-
#define git_mutex_lock(a)
|
274
|
-
#define git_mutex_unlock(a)
|
275
|
-
#define git_mutex_free(a)
|
271
|
+
#define git_mutex_init(a) git__noop_args(a)
|
272
|
+
#define git_mutex_init(a) git__noop_args(a)
|
273
|
+
#define git_mutex_lock(a) git__noop_args(a)
|
274
|
+
#define git_mutex_unlock(a) git__noop_args(a)
|
275
|
+
#define git_mutex_free(a) git__noop_args(a)
|
276
276
|
|
277
277
|
/* Pthreads condition vars */
|
278
278
|
#define git_cond unsigned int
|
279
|
-
#define git_cond_init(c)
|
280
|
-
#define git_cond_free(c)
|
281
|
-
#define git_cond_wait(c, l)
|
282
|
-
#define git_cond_signal(c)
|
283
|
-
#define git_cond_broadcast(c)
|
279
|
+
#define git_cond_init(c) git__noop_args(c)
|
280
|
+
#define git_cond_free(c) git__noop_args(c)
|
281
|
+
#define git_cond_wait(c, l) git__noop_args(c, l)
|
282
|
+
#define git_cond_signal(c) git__noop_args(c)
|
283
|
+
#define git_cond_broadcast(c) git__noop_args(c)
|
284
284
|
|
285
285
|
/* Pthreads rwlock */
|
286
286
|
#define git_rwlock unsigned int
|
287
|
-
#define git_rwlock_init(a)
|
288
|
-
#define git_rwlock_rdlock(a)
|
289
|
-
#define git_rwlock_rdunlock(a)
|
290
|
-
#define git_rwlock_wrlock(a)
|
291
|
-
#define git_rwlock_wrunlock(a)
|
292
|
-
#define git_rwlock_free(a)
|
287
|
+
#define git_rwlock_init(a) git__noop_args(a)
|
288
|
+
#define git_rwlock_rdlock(a) git__noop_args(a)
|
289
|
+
#define git_rwlock_rdunlock(a) git__noop_args(a)
|
290
|
+
#define git_rwlock_wrlock(a) git__noop_args(a)
|
291
|
+
#define git_rwlock_wrunlock(a) git__noop_args(a)
|
292
|
+
#define git_rwlock_free(a) git__noop_args(a)
|
293
|
+
|
293
294
|
#define GIT_RWLOCK_STATIC_INIT 0
|
294
295
|
|
295
296
|
|
@@ -381,6 +381,7 @@ extern int git__getenv(git_str *out, const char *name);
|
|
381
381
|
extern int git__online_cpus(void);
|
382
382
|
|
383
383
|
GIT_INLINE(int) git__noop(void) { return 0; }
|
384
|
+
GIT_INLINE(int) git__noop_args(void *a, ...) { GIT_UNUSED(a); return 0; }
|
384
385
|
|
385
386
|
#include "alloc.h"
|
386
387
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rugged
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Chacon
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-03-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- vendor/libgit2/cmake/AddClarTest.cmake
|
128
128
|
- vendor/libgit2/cmake/DefaultCFlags.cmake
|
129
129
|
- vendor/libgit2/cmake/EnableWarnings.cmake
|
130
|
+
- vendor/libgit2/cmake/ExperimentalFeatures.cmake
|
130
131
|
- vendor/libgit2/cmake/FindCoreFoundation.cmake
|
131
132
|
- vendor/libgit2/cmake/FindGSSAPI.cmake
|
132
133
|
- vendor/libgit2/cmake/FindGSSFramework.cmake
|
@@ -263,6 +264,7 @@ files:
|
|
263
264
|
- vendor/libgit2/include/git2/diff.h
|
264
265
|
- vendor/libgit2/include/git2/email.h
|
265
266
|
- vendor/libgit2/include/git2/errors.h
|
267
|
+
- vendor/libgit2/include/git2/experimental.h
|
266
268
|
- vendor/libgit2/include/git2/filter.h
|
267
269
|
- vendor/libgit2/include/git2/global.h
|
268
270
|
- vendor/libgit2/include/git2/graph.h
|
@@ -356,7 +358,6 @@ files:
|
|
356
358
|
- vendor/libgit2/src/cli/win32/precompiled.c
|
357
359
|
- vendor/libgit2/src/cli/win32/precompiled.h
|
358
360
|
- vendor/libgit2/src/cli/win32/sighandler.c
|
359
|
-
- vendor/libgit2/src/features.h.in
|
360
361
|
- vendor/libgit2/src/libgit2/CMakeLists.txt
|
361
362
|
- vendor/libgit2/src/libgit2/annotated_commit.c
|
362
363
|
- vendor/libgit2/src/libgit2/annotated_commit.h
|
@@ -428,6 +429,7 @@ files:
|
|
428
429
|
- vendor/libgit2/src/libgit2/email.h
|
429
430
|
- vendor/libgit2/src/libgit2/errors.c
|
430
431
|
- vendor/libgit2/src/libgit2/errors.h
|
432
|
+
- vendor/libgit2/src/libgit2/experimental.h.in
|
431
433
|
- vendor/libgit2/src/libgit2/fetch.c
|
432
434
|
- vendor/libgit2/src/libgit2/fetch.h
|
433
435
|
- vendor/libgit2/src/libgit2/fetchhead.c
|
@@ -531,6 +533,7 @@ files:
|
|
531
533
|
- vendor/libgit2/src/libgit2/status.c
|
532
534
|
- vendor/libgit2/src/libgit2/status.h
|
533
535
|
- vendor/libgit2/src/libgit2/strarray.c
|
536
|
+
- vendor/libgit2/src/libgit2/strarray.h
|
534
537
|
- vendor/libgit2/src/libgit2/stream.h
|
535
538
|
- vendor/libgit2/src/libgit2/streams/mbedtls.c
|
536
539
|
- vendor/libgit2/src/libgit2/streams/mbedtls.h
|
@@ -627,6 +630,7 @@ files:
|
|
627
630
|
- vendor/libgit2/src/util/fs_path.h
|
628
631
|
- vendor/libgit2/src/util/futils.c
|
629
632
|
- vendor/libgit2/src/util/futils.h
|
633
|
+
- vendor/libgit2/src/util/git2_features.h.in
|
630
634
|
- vendor/libgit2/src/util/git2_util.h
|
631
635
|
- vendor/libgit2/src/util/hash.c
|
632
636
|
- vendor/libgit2/src/util/hash.h
|
@@ -694,8 +698,6 @@ files:
|
|
694
698
|
- vendor/libgit2/src/util/win32/dir.h
|
695
699
|
- vendor/libgit2/src/util/win32/error.c
|
696
700
|
- vendor/libgit2/src/util/win32/error.h
|
697
|
-
- vendor/libgit2/src/util/win32/findfile.c
|
698
|
-
- vendor/libgit2/src/util/win32/findfile.h
|
699
701
|
- vendor/libgit2/src/util/win32/map.c
|
700
702
|
- vendor/libgit2/src/util/win32/mingw-compat.h
|
701
703
|
- vendor/libgit2/src/util/win32/msvc-compat.h
|