rugged 0.27.5 → 0.27.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +2 -2
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/include/git2/attr.h +18 -7
- data/vendor/libgit2/include/git2/blame.h +39 -22
- data/vendor/libgit2/include/git2/blob.h +1 -1
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +14 -2
- data/vendor/libgit2/include/git2/checkout.h +13 -12
- data/vendor/libgit2/include/git2/cherrypick.h +6 -4
- data/vendor/libgit2/include/git2/clone.h +8 -6
- data/vendor/libgit2/include/git2/commit.h +28 -0
- data/vendor/libgit2/include/git2/common.h +27 -0
- data/vendor/libgit2/include/git2/config.h +1 -0
- data/vendor/libgit2/include/git2/describe.h +30 -7
- data/vendor/libgit2/include/git2/diff.h +32 -22
- data/vendor/libgit2/include/git2/errors.h +1 -0
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/mailmap.h +115 -0
- data/vendor/libgit2/include/git2/merge.h +10 -8
- data/vendor/libgit2/include/git2/proxy.h +9 -5
- data/vendor/libgit2/include/git2/rebase.h +7 -4
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +12 -10
- data/vendor/libgit2/include/git2/repository.h +7 -5
- data/vendor/libgit2/include/git2/revert.h +5 -3
- data/vendor/libgit2/include/git2/stash.h +11 -8
- data/vendor/libgit2/include/git2/status.h +7 -3
- data/vendor/libgit2/include/git2/submodule.h +8 -7
- data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
- data/vendor/libgit2/include/git2/sys/index.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +6 -1
- data/vendor/libgit2/include/git2/sys/path.h +55 -0
- data/vendor/libgit2/include/git2/transaction.h +1 -0
- data/vendor/libgit2/include/git2/types.h +8 -5
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +46 -11
- data/vendor/libgit2/src/CMakeLists.txt +87 -15
- data/vendor/libgit2/src/alloc.c +47 -0
- data/vendor/libgit2/src/alloc.h +40 -0
- data/vendor/libgit2/src/apply.c +4 -4
- data/vendor/libgit2/src/attr.c +4 -4
- data/vendor/libgit2/src/attr_file.c +8 -7
- data/vendor/libgit2/src/attrcache.c +2 -2
- data/vendor/libgit2/src/blame.c +11 -4
- data/vendor/libgit2/src/blame.h +1 -0
- data/vendor/libgit2/src/blame_git.c +8 -5
- data/vendor/libgit2/src/blob.c +5 -5
- data/vendor/libgit2/src/branch.c +20 -20
- data/vendor/libgit2/src/buffer.c +9 -4
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/checkout.c +33 -24
- data/vendor/libgit2/src/cherrypick.c +3 -3
- data/vendor/libgit2/src/clone.c +13 -13
- data/vendor/libgit2/src/commit.c +16 -3
- data/vendor/libgit2/src/common.h +3 -1
- data/vendor/libgit2/src/config.c +3 -3
- data/vendor/libgit2/src/config_file.c +193 -241
- data/vendor/libgit2/src/config_parse.c +89 -66
- data/vendor/libgit2/src/config_parse.h +2 -2
- data/vendor/libgit2/src/crlf.c +9 -3
- data/vendor/libgit2/src/diff.c +2 -2
- data/vendor/libgit2/src/diff_driver.c +3 -3
- data/vendor/libgit2/src/diff_file.c +3 -3
- data/vendor/libgit2/src/diff_generate.c +4 -3
- data/vendor/libgit2/src/diff_print.c +8 -8
- data/vendor/libgit2/src/diff_tform.c +1 -1
- data/vendor/libgit2/src/diff_xdiff.c +12 -0
- data/vendor/libgit2/src/features.h.in +2 -0
- data/vendor/libgit2/src/fetch.c +2 -2
- data/vendor/libgit2/src/fetchhead.c +5 -5
- data/vendor/libgit2/src/filebuf.c +4 -4
- data/vendor/libgit2/src/fileops.c +10 -10
- data/vendor/libgit2/src/filter.c +3 -3
- data/vendor/libgit2/src/global.c +17 -12
- data/vendor/libgit2/src/hash.h +2 -0
- data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
- data/vendor/libgit2/src/hash/hash_mbedtls.h +20 -0
- data/vendor/libgit2/src/ignore.c +15 -20
- data/vendor/libgit2/src/index.c +77 -36
- data/vendor/libgit2/src/index.h +10 -0
- data/vendor/libgit2/src/indexer.c +9 -9
- data/vendor/libgit2/src/iterator.c +8 -8
- data/vendor/libgit2/src/khash.h +3 -1
- data/vendor/libgit2/src/mailmap.c +485 -0
- data/vendor/libgit2/src/mailmap.h +35 -0
- data/vendor/libgit2/src/merge.c +7 -7
- data/vendor/libgit2/src/netops.c +5 -5
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/odb.c +7 -7
- data/vendor/libgit2/src/odb_loose.c +13 -13
- data/vendor/libgit2/src/odb_pack.c +3 -3
- data/vendor/libgit2/src/pack-objects.c +2 -2
- data/vendor/libgit2/src/pack.c +5 -5
- data/vendor/libgit2/src/pack.h +1 -1
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +11 -4
- data/vendor/libgit2/src/path.c +42 -66
- data/vendor/libgit2/src/path.h +2 -72
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/push.c +2 -2
- data/vendor/libgit2/src/rebase.c +19 -22
- data/vendor/libgit2/src/refdb_fs.c +65 -34
- data/vendor/libgit2/src/refs.c +6 -6
- data/vendor/libgit2/src/refspec.c +30 -5
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +40 -40
- data/vendor/libgit2/src/repository.c +63 -59
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revert.c +3 -3
- data/vendor/libgit2/src/revparse.c +4 -4
- data/vendor/libgit2/src/revwalk.c +44 -10
- data/vendor/libgit2/src/revwalk.h +2 -1
- data/vendor/libgit2/src/settings.c +25 -1
- data/vendor/libgit2/src/signature.c +1 -1
- data/vendor/libgit2/src/stash.c +80 -34
- data/vendor/libgit2/src/status.c +1 -1
- data/vendor/libgit2/src/stdalloc.c +120 -0
- data/vendor/libgit2/src/stdalloc.h +17 -0
- data/vendor/libgit2/src/streams/mbedtls.c +463 -0
- data/vendor/libgit2/src/streams/mbedtls.h +20 -0
- data/vendor/libgit2/src/streams/openssl.c +132 -34
- data/vendor/libgit2/src/streams/openssl.h +0 -107
- data/vendor/libgit2/src/streams/tls.c +3 -0
- data/vendor/libgit2/src/submodule.c +117 -82
- data/vendor/libgit2/src/sysdir.c +4 -4
- data/vendor/libgit2/src/tag.c +7 -7
- data/vendor/libgit2/src/trace.h +1 -1
- data/vendor/libgit2/src/trailer.c +6 -6
- data/vendor/libgit2/src/transport.c +2 -2
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +2 -2
- data/vendor/libgit2/src/transports/git.c +1 -1
- data/vendor/libgit2/src/transports/http.c +12 -12
- data/vendor/libgit2/src/transports/local.c +7 -7
- data/vendor/libgit2/src/transports/smart.c +17 -8
- data/vendor/libgit2/src/transports/smart.h +5 -5
- data/vendor/libgit2/src/transports/smart_pkt.c +122 -130
- data/vendor/libgit2/src/transports/smart_protocol.c +48 -38
- data/vendor/libgit2/src/transports/ssh.c +1 -1
- data/vendor/libgit2/src/transports/winhttp.c +6 -6
- data/vendor/libgit2/src/tree.c +12 -53
- data/vendor/libgit2/src/tree.h +0 -12
- data/vendor/libgit2/src/util.c +16 -0
- data/vendor/libgit2/src/util.h +12 -135
- data/vendor/libgit2/src/win32/findfile.c +2 -2
- data/vendor/libgit2/src/win32/posix_w32.c +1 -1
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +94 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
- data/vendor/libgit2/src/worktree.c +64 -43
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +3 -1
- metadata +16 -2
@@ -0,0 +1,20 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_steams_mbedtls_h__
|
8
|
+
#define INCLUDE_steams_mbedtls_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
#include "git2/sys/stream.h"
|
13
|
+
|
14
|
+
extern int git_mbedtls_stream_global_init(void);
|
15
|
+
|
16
|
+
extern int git_mbedtls_stream_new(git_stream **out, const char *host, const char *port);
|
17
|
+
|
18
|
+
extern int git_mbedtls__set_cert_location(const char *path, int is_dir);
|
19
|
+
|
20
|
+
#endif
|
@@ -38,8 +38,115 @@ SSL_CTX *git__ssl_ctx;
|
|
38
38
|
|
39
39
|
#define GIT_SSL_DEFAULT_CIPHERS "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES128-SHA256:DHE-DSS-AES256-SHA256:DHE-DSS-AES128-SHA:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA"
|
40
40
|
|
41
|
-
#if defined(
|
41
|
+
#if (defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x10100000L) || \
|
42
|
+
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
|
43
|
+
# define OPENSSL_LEGACY_API
|
44
|
+
#endif
|
45
|
+
|
46
|
+
/*
|
47
|
+
* OpenSSL 1.1 made BIO opaque so we have to use functions to interact with it
|
48
|
+
* which do not exist in previous versions. We define these inline functions so
|
49
|
+
* we can program against the interface instead of littering the implementation
|
50
|
+
* with ifdefs. We do the same for OPENSSL_init_ssl.
|
51
|
+
*/
|
52
|
+
#if defined(OPENSSL_LEGACY_API)
|
53
|
+
static int OPENSSL_init_ssl(int opts, void *settings)
|
54
|
+
{
|
55
|
+
GIT_UNUSED(opts);
|
56
|
+
GIT_UNUSED(settings);
|
57
|
+
SSL_load_error_strings();
|
58
|
+
OpenSSL_add_ssl_algorithms();
|
59
|
+
return 0;
|
60
|
+
}
|
61
|
+
|
62
|
+
static BIO_METHOD* BIO_meth_new(int type, const char *name)
|
63
|
+
{
|
64
|
+
BIO_METHOD *meth = git__calloc(1, sizeof(BIO_METHOD));
|
65
|
+
if (!meth) {
|
66
|
+
return NULL;
|
67
|
+
}
|
68
|
+
|
69
|
+
meth->type = type;
|
70
|
+
meth->name = name;
|
71
|
+
|
72
|
+
return meth;
|
73
|
+
}
|
74
|
+
|
75
|
+
static void BIO_meth_free(BIO_METHOD *biom)
|
76
|
+
{
|
77
|
+
git__free(biom);
|
78
|
+
}
|
79
|
+
|
80
|
+
static int BIO_meth_set_write(BIO_METHOD *biom, int (*write) (BIO *, const char *, int))
|
81
|
+
{
|
82
|
+
biom->bwrite = write;
|
83
|
+
return 1;
|
84
|
+
}
|
42
85
|
|
86
|
+
static int BIO_meth_set_read(BIO_METHOD *biom, int (*read) (BIO *, char *, int))
|
87
|
+
{
|
88
|
+
biom->bread = read;
|
89
|
+
return 1;
|
90
|
+
}
|
91
|
+
|
92
|
+
static int BIO_meth_set_puts(BIO_METHOD *biom, int (*puts) (BIO *, const char *))
|
93
|
+
{
|
94
|
+
biom->bputs = puts;
|
95
|
+
return 1;
|
96
|
+
}
|
97
|
+
|
98
|
+
static int BIO_meth_set_gets(BIO_METHOD *biom, int (*gets) (BIO *, char *, int))
|
99
|
+
|
100
|
+
{
|
101
|
+
biom->bgets = gets;
|
102
|
+
return 1;
|
103
|
+
}
|
104
|
+
|
105
|
+
static int BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl) (BIO *, int, long, void *))
|
106
|
+
{
|
107
|
+
biom->ctrl = ctrl;
|
108
|
+
return 1;
|
109
|
+
}
|
110
|
+
|
111
|
+
static int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *))
|
112
|
+
{
|
113
|
+
biom->create = create;
|
114
|
+
return 1;
|
115
|
+
}
|
116
|
+
|
117
|
+
static int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *))
|
118
|
+
{
|
119
|
+
biom->destroy = destroy;
|
120
|
+
return 1;
|
121
|
+
}
|
122
|
+
|
123
|
+
static int BIO_get_new_index(void)
|
124
|
+
{
|
125
|
+
/* This exists as of 1.1 so before we'd just have 0 */
|
126
|
+
return 0;
|
127
|
+
}
|
128
|
+
|
129
|
+
static void BIO_set_init(BIO *b, int init)
|
130
|
+
{
|
131
|
+
b->init = init;
|
132
|
+
}
|
133
|
+
|
134
|
+
static void BIO_set_data(BIO *a, void *ptr)
|
135
|
+
{
|
136
|
+
a->ptr = ptr;
|
137
|
+
}
|
138
|
+
|
139
|
+
static void *BIO_get_data(BIO *a)
|
140
|
+
{
|
141
|
+
return a->ptr;
|
142
|
+
}
|
143
|
+
|
144
|
+
static const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x)
|
145
|
+
{
|
146
|
+
return ASN1_STRING_data((ASN1_STRING *)x);
|
147
|
+
}
|
148
|
+
|
149
|
+
# if defined(GIT_THREADS)
|
43
150
|
static git_mutex *openssl_locks;
|
44
151
|
|
45
152
|
static void openssl_locking_function(
|
@@ -70,8 +177,8 @@ static void shutdown_ssl_locking(void)
|
|
70
177
|
git_mutex_free(&openssl_locks[i]);
|
71
178
|
git__free(openssl_locks);
|
72
179
|
}
|
73
|
-
|
74
|
-
#endif /*
|
180
|
+
# endif /* GIT_THREADS */
|
181
|
+
#endif /* OPENSSL_LEGACY_API */
|
75
182
|
|
76
183
|
static BIO_METHOD *git_stream_bio_method;
|
77
184
|
static int init_bio_method(void);
|
@@ -95,7 +202,6 @@ static void shutdown_ssl(void)
|
|
95
202
|
|
96
203
|
int git_openssl_stream_global_init(void)
|
97
204
|
{
|
98
|
-
#ifdef GIT_OPENSSL
|
99
205
|
long ssl_opts = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
|
100
206
|
const char *ciphers = git_libgit2__ssl_ciphers();
|
101
207
|
|
@@ -104,13 +210,7 @@ int git_openssl_stream_global_init(void)
|
|
104
210
|
ssl_opts |= SSL_OP_NO_COMPRESSION;
|
105
211
|
#endif
|
106
212
|
|
107
|
-
#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
|
108
|
-
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
|
109
|
-
SSL_load_error_strings();
|
110
|
-
OpenSSL_add_ssl_algorithms();
|
111
|
-
#else
|
112
213
|
OPENSSL_init_ssl(0, NULL);
|
113
|
-
#endif
|
114
214
|
|
115
215
|
/*
|
116
216
|
* Load SSLv{2,3} and TLSv1 so that we can talk with servers
|
@@ -118,49 +218,47 @@ int git_openssl_stream_global_init(void)
|
|
118
218
|
* compatibility. We then disable SSL so we only allow OpenSSL
|
119
219
|
* to speak TLSv1 to perform the encryption itself.
|
120
220
|
*/
|
121
|
-
git__ssl_ctx = SSL_CTX_new(SSLv23_method())
|
221
|
+
if (!(git__ssl_ctx = SSL_CTX_new(SSLv23_method())))
|
222
|
+
goto error;
|
223
|
+
|
122
224
|
SSL_CTX_set_options(git__ssl_ctx, ssl_opts);
|
123
225
|
SSL_CTX_set_mode(git__ssl_ctx, SSL_MODE_AUTO_RETRY);
|
124
226
|
SSL_CTX_set_verify(git__ssl_ctx, SSL_VERIFY_NONE, NULL);
|
125
|
-
if (!SSL_CTX_set_default_verify_paths(git__ssl_ctx))
|
126
|
-
|
127
|
-
git__ssl_ctx = NULL;
|
128
|
-
return -1;
|
129
|
-
}
|
227
|
+
if (!SSL_CTX_set_default_verify_paths(git__ssl_ctx))
|
228
|
+
goto error;
|
130
229
|
|
131
|
-
if (!ciphers)
|
230
|
+
if (!ciphers)
|
132
231
|
ciphers = GIT_SSL_DEFAULT_CIPHERS;
|
133
|
-
}
|
134
232
|
|
135
|
-
if(!SSL_CTX_set_cipher_list(git__ssl_ctx, ciphers))
|
136
|
-
|
137
|
-
git__ssl_ctx = NULL;
|
138
|
-
return -1;
|
139
|
-
}
|
140
|
-
|
141
|
-
if (init_bio_method() < 0) {
|
142
|
-
SSL_CTX_free(git__ssl_ctx);
|
143
|
-
git__ssl_ctx = NULL;
|
144
|
-
return -1;
|
145
|
-
}
|
233
|
+
if(!SSL_CTX_set_cipher_list(git__ssl_ctx, ciphers))
|
234
|
+
goto error;
|
146
235
|
|
147
|
-
|
236
|
+
if (init_bio_method() < 0)
|
237
|
+
goto error;
|
148
238
|
|
149
239
|
git__on_shutdown(shutdown_ssl);
|
150
240
|
|
151
241
|
return 0;
|
242
|
+
|
243
|
+
error:
|
244
|
+
giterr_set(GITERR_NET, "could not initialize openssl: %s",
|
245
|
+
ERR_error_string(ERR_get_error(), NULL));
|
246
|
+
SSL_CTX_free(git__ssl_ctx);
|
247
|
+
git__ssl_ctx = NULL;
|
248
|
+
return -1;
|
152
249
|
}
|
153
250
|
|
154
|
-
#if defined(GIT_THREADS)
|
251
|
+
#if defined(GIT_THREADS) && defined(OPENSSL_LEGACY_API)
|
155
252
|
static void threadid_cb(CRYPTO_THREADID *threadid)
|
156
253
|
{
|
157
|
-
|
254
|
+
GIT_UNUSED(threadid);
|
255
|
+
CRYPTO_THREADID_set_numeric(threadid, git_thread_currentid());
|
158
256
|
}
|
159
257
|
#endif
|
160
258
|
|
161
259
|
int git_openssl_set_locking(void)
|
162
260
|
{
|
163
|
-
#if defined(GIT_THREADS) &&
|
261
|
+
#if defined(GIT_THREADS) && defined(OPENSSL_LEGACY_API)
|
164
262
|
int num_locks, i;
|
165
263
|
|
166
264
|
CRYPTO_THREADID_set_callback(threadid_cb);
|
@@ -179,7 +277,7 @@ int git_openssl_set_locking(void)
|
|
179
277
|
CRYPTO_set_locking_callback(openssl_locking_function);
|
180
278
|
git__on_shutdown(shutdown_ssl_locking);
|
181
279
|
return 0;
|
182
|
-
#elif
|
280
|
+
#elif !defined(OPENSSL_LEGACY_API)
|
183
281
|
return 0;
|
184
282
|
#else
|
185
283
|
giterr_set(GITERR_THREAD, "libgit2 was not built with threads");
|
@@ -17,111 +17,4 @@ extern int git_openssl_stream_new(git_stream **out, const char *host, const char
|
|
17
17
|
|
18
18
|
extern int git_openssl__set_cert_location(const char *file, const char *path);
|
19
19
|
|
20
|
-
/*
|
21
|
-
* OpenSSL 1.1 made BIO opaque so we have to use functions to interact with it
|
22
|
-
* which do not exist in previous versions. We define these inline functions so
|
23
|
-
* we can program against the interface instead of littering the implementation
|
24
|
-
* with ifdefs.
|
25
|
-
*/
|
26
|
-
#ifdef GIT_OPENSSL
|
27
|
-
# include <openssl/ssl.h>
|
28
|
-
# include <openssl/err.h>
|
29
|
-
# include <openssl/x509v3.h>
|
30
|
-
# include <openssl/bio.h>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
# if OPENSSL_VERSION_NUMBER < 0x10100000L || \
|
35
|
-
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
|
36
|
-
|
37
|
-
GIT_INLINE(BIO_METHOD*) BIO_meth_new(int type, const char *name)
|
38
|
-
{
|
39
|
-
BIO_METHOD *meth = git__calloc(1, sizeof(BIO_METHOD));
|
40
|
-
if (!meth) {
|
41
|
-
return NULL;
|
42
|
-
}
|
43
|
-
|
44
|
-
meth->type = type;
|
45
|
-
meth->name = name;
|
46
|
-
|
47
|
-
return meth;
|
48
|
-
}
|
49
|
-
|
50
|
-
GIT_INLINE(void) BIO_meth_free(BIO_METHOD *biom)
|
51
|
-
{
|
52
|
-
git__free(biom);
|
53
|
-
}
|
54
|
-
|
55
|
-
GIT_INLINE(int) BIO_meth_set_write(BIO_METHOD *biom, int (*write) (BIO *, const char *, int))
|
56
|
-
{
|
57
|
-
biom->bwrite = write;
|
58
|
-
return 1;
|
59
|
-
}
|
60
|
-
|
61
|
-
GIT_INLINE(int) BIO_meth_set_read(BIO_METHOD *biom, int (*read) (BIO *, char *, int))
|
62
|
-
{
|
63
|
-
biom->bread = read;
|
64
|
-
return 1;
|
65
|
-
}
|
66
|
-
|
67
|
-
GIT_INLINE(int) BIO_meth_set_puts(BIO_METHOD *biom, int (*puts) (BIO *, const char *))
|
68
|
-
{
|
69
|
-
biom->bputs = puts;
|
70
|
-
return 1;
|
71
|
-
}
|
72
|
-
|
73
|
-
GIT_INLINE(int) BIO_meth_set_gets(BIO_METHOD *biom, int (*gets) (BIO *, char *, int))
|
74
|
-
|
75
|
-
{
|
76
|
-
biom->bgets = gets;
|
77
|
-
return 1;
|
78
|
-
}
|
79
|
-
|
80
|
-
GIT_INLINE(int) BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl) (BIO *, int, long, void *))
|
81
|
-
{
|
82
|
-
biom->ctrl = ctrl;
|
83
|
-
return 1;
|
84
|
-
}
|
85
|
-
|
86
|
-
GIT_INLINE(int) BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *))
|
87
|
-
{
|
88
|
-
biom->create = create;
|
89
|
-
return 1;
|
90
|
-
}
|
91
|
-
|
92
|
-
GIT_INLINE(int) BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *))
|
93
|
-
{
|
94
|
-
biom->destroy = destroy;
|
95
|
-
return 1;
|
96
|
-
}
|
97
|
-
|
98
|
-
GIT_INLINE(int) BIO_get_new_index(void)
|
99
|
-
{
|
100
|
-
/* This exists as of 1.1 so before we'd just have 0 */
|
101
|
-
return 0;
|
102
|
-
}
|
103
|
-
|
104
|
-
GIT_INLINE(void) BIO_set_init(BIO *b, int init)
|
105
|
-
{
|
106
|
-
b->init = init;
|
107
|
-
}
|
108
|
-
|
109
|
-
GIT_INLINE(void) BIO_set_data(BIO *a, void *ptr)
|
110
|
-
{
|
111
|
-
a->ptr = ptr;
|
112
|
-
}
|
113
|
-
|
114
|
-
GIT_INLINE(void*) BIO_get_data(BIO *a)
|
115
|
-
{
|
116
|
-
return a->ptr;
|
117
|
-
}
|
118
|
-
|
119
|
-
GIT_INLINE(const unsigned char *) ASN1_STRING_get0_data(const ASN1_STRING *x)
|
120
|
-
{
|
121
|
-
return ASN1_STRING_data((ASN1_STRING *)x);
|
122
|
-
}
|
123
|
-
|
124
|
-
# endif // OpenSSL < 1.1
|
125
|
-
#endif // GIT_OPENSSL
|
126
|
-
|
127
20
|
#endif
|
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
#include "git2/errors.h"
|
11
11
|
|
12
|
+
#include "streams/mbedtls.h"
|
12
13
|
#include "streams/openssl.h"
|
13
14
|
#include "streams/stransport.h"
|
14
15
|
|
@@ -31,6 +32,8 @@ int git_tls_stream_new(git_stream **out, const char *host, const char *port)
|
|
31
32
|
return git_stransport_stream_new(out, host, port);
|
32
33
|
#elif defined(GIT_OPENSSL)
|
33
34
|
return git_openssl_stream_new(out, host, port);
|
35
|
+
#elif defined(GIT_MBEDTLS)
|
36
|
+
return git_mbedtls_stream_new(out, host, port);
|
34
37
|
#else
|
35
38
|
GIT_UNUSED(out);
|
36
39
|
GIT_UNUSED(host);
|
@@ -149,18 +149,66 @@ static int find_by_path(const git_config_entry *entry, void *payload)
|
|
149
149
|
return 0;
|
150
150
|
}
|
151
151
|
|
152
|
+
/*
|
153
|
+
* Checks to see if the submodule shares its name with a file or directory that
|
154
|
+
* already exists on the index. If so, the submodule cannot be added.
|
155
|
+
*/
|
156
|
+
static int is_path_occupied(bool *occupied, git_repository *repo, const char *path)
|
157
|
+
{
|
158
|
+
int error = 0;
|
159
|
+
git_index *index;
|
160
|
+
git_buf dir = GIT_BUF_INIT;
|
161
|
+
*occupied = false;
|
162
|
+
|
163
|
+
if ((error = git_repository_index__weakptr(&index, repo)) < 0)
|
164
|
+
goto out;
|
165
|
+
|
166
|
+
if ((error = git_index_find(NULL, index, path)) != GIT_ENOTFOUND) {
|
167
|
+
if (!error) {
|
168
|
+
giterr_set(GITERR_SUBMODULE,
|
169
|
+
"File '%s' already exists in the index", path);
|
170
|
+
*occupied = true;
|
171
|
+
}
|
172
|
+
goto out;
|
173
|
+
}
|
174
|
+
|
175
|
+
if ((error = git_buf_sets(&dir, path)) < 0)
|
176
|
+
goto out;
|
177
|
+
|
178
|
+
if ((error = git_path_to_dir(&dir)) < 0)
|
179
|
+
goto out;
|
180
|
+
|
181
|
+
if ((error = git_index_find_prefix(NULL, index, dir.ptr)) != GIT_ENOTFOUND) {
|
182
|
+
if (!error) {
|
183
|
+
giterr_set(GITERR_SUBMODULE,
|
184
|
+
"Directory '%s' already exists in the index", path);
|
185
|
+
*occupied = true;
|
186
|
+
}
|
187
|
+
goto out;
|
188
|
+
}
|
189
|
+
|
190
|
+
error = 0;
|
191
|
+
|
192
|
+
out:
|
193
|
+
git_buf_dispose(&dir);
|
194
|
+
return error;
|
195
|
+
}
|
196
|
+
|
152
197
|
/**
|
153
198
|
* Release the name map returned by 'load_submodule_names'.
|
154
199
|
*/
|
155
200
|
static void free_submodule_names(git_strmap *names)
|
156
201
|
{
|
157
|
-
git_buf *name
|
202
|
+
git_buf *name;
|
203
|
+
|
158
204
|
if (names == NULL)
|
159
205
|
return;
|
206
|
+
|
160
207
|
git_strmap_foreach_value(names, name, {
|
161
208
|
git__free(name);
|
162
209
|
});
|
163
210
|
git_strmap_free(names);
|
211
|
+
|
164
212
|
return;
|
165
213
|
}
|
166
214
|
|
@@ -169,24 +217,30 @@ static void free_submodule_names(git_strmap *names)
|
|
169
217
|
* TODO: for some use-cases, this might need case-folding on a
|
170
218
|
* case-insensitive filesystem
|
171
219
|
*/
|
172
|
-
static int load_submodule_names(git_strmap
|
220
|
+
static int load_submodule_names(git_strmap **out, git_repository *repo, git_config *cfg)
|
173
221
|
{
|
174
222
|
const char *key = "submodule\\..*\\.path";
|
175
|
-
git_config_iterator *iter;
|
223
|
+
git_config_iterator *iter = NULL;
|
176
224
|
git_config_entry *entry;
|
177
225
|
git_buf buf = GIT_BUF_INIT;
|
226
|
+
git_strmap *names;
|
178
227
|
int rval, isvalid;
|
179
228
|
int error = 0;
|
180
229
|
|
230
|
+
*out = NULL;
|
231
|
+
|
232
|
+
if ((error = git_strmap_alloc(&names)) < 0)
|
233
|
+
goto out;
|
234
|
+
|
181
235
|
if ((error = git_config_iterator_glob_new(&iter, cfg, key)) < 0)
|
182
|
-
|
236
|
+
goto out;
|
183
237
|
|
184
238
|
while (git_config_next(&entry, iter) == 0) {
|
185
239
|
const char *fdot, *ldot;
|
186
240
|
fdot = strchr(entry->name, '.');
|
187
241
|
ldot = strrchr(entry->name, '.');
|
188
242
|
|
189
|
-
if (git_strmap_exists(
|
243
|
+
if (git_strmap_exists(names, entry->value)) {
|
190
244
|
giterr_set(GITERR_SUBMODULE,
|
191
245
|
"duplicated submodule path '%s'", entry->value);
|
192
246
|
error = -1;
|
@@ -203,7 +257,7 @@ static int load_submodule_names(git_strmap *out, git_repository *repo, git_confi
|
|
203
257
|
if (!isvalid)
|
204
258
|
continue;
|
205
259
|
|
206
|
-
git_strmap_insert(
|
260
|
+
git_strmap_insert(names, entry->value, git_buf_detach(&buf), &rval);
|
207
261
|
if (rval < 0) {
|
208
262
|
giterr_set(GITERR_NOMEMORY, "error inserting submodule into hash table");
|
209
263
|
return -1;
|
@@ -212,8 +266,12 @@ static int load_submodule_names(git_strmap *out, git_repository *repo, git_confi
|
|
212
266
|
if (error == GIT_ITEROVER)
|
213
267
|
error = 0;
|
214
268
|
|
269
|
+
*out = names;
|
270
|
+
names = NULL;
|
271
|
+
|
215
272
|
out:
|
216
|
-
|
273
|
+
free_submodule_names(names);
|
274
|
+
git_buf_dispose(&buf);
|
217
275
|
git_config_iterator_free(iter);
|
218
276
|
return error;
|
219
277
|
}
|
@@ -280,7 +338,7 @@ int git_submodule_lookup(
|
|
280
338
|
|
281
339
|
if (error < 0) {
|
282
340
|
git_submodule_free(sm);
|
283
|
-
|
341
|
+
git_buf_dispose(&path);
|
284
342
|
return error;
|
285
343
|
}
|
286
344
|
|
@@ -296,7 +354,7 @@ int git_submodule_lookup(
|
|
296
354
|
}
|
297
355
|
}
|
298
356
|
|
299
|
-
|
357
|
+
git_buf_dispose(&path);
|
300
358
|
}
|
301
359
|
|
302
360
|
if ((error = git_submodule_location(&location, sm)) < 0) {
|
@@ -319,7 +377,7 @@ int git_submodule_lookup(
|
|
319
377
|
if (git_path_exists(path.ptr))
|
320
378
|
error = GIT_EEXISTS;
|
321
379
|
|
322
|
-
|
380
|
+
git_buf_dispose(&path);
|
323
381
|
}
|
324
382
|
|
325
383
|
submodule_set_lookup_error(error, name);
|
@@ -351,7 +409,7 @@ int git_submodule_name_is_valid(git_repository *repo, const char *name, int flag
|
|
351
409
|
}
|
352
410
|
|
353
411
|
isvalid = git_path_isvalid(repo, buf.ptr, 0, flags);
|
354
|
-
|
412
|
+
git_buf_dispose(&buf);
|
355
413
|
|
356
414
|
return isvalid;
|
357
415
|
}
|
@@ -398,10 +456,9 @@ static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cf
|
|
398
456
|
int error;
|
399
457
|
git_iterator *i = NULL;
|
400
458
|
const git_index_entry *entry;
|
401
|
-
git_strmap *names
|
459
|
+
git_strmap *names;
|
402
460
|
|
403
|
-
|
404
|
-
if ((error = load_submodule_names(names, git_index_owner(idx), cfg)))
|
461
|
+
if ((error = load_submodule_names(&names, git_index_owner(idx), cfg)))
|
405
462
|
goto done;
|
406
463
|
|
407
464
|
if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
|
@@ -451,9 +508,9 @@ static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg
|
|
451
508
|
int error;
|
452
509
|
git_iterator *i = NULL;
|
453
510
|
const git_index_entry *entry;
|
454
|
-
git_strmap *names
|
455
|
-
|
456
|
-
if ((error = load_submodule_names(names, git_tree_owner(head), cfg)))
|
511
|
+
git_strmap *names;
|
512
|
+
|
513
|
+
if ((error = load_submodule_names(&names, git_tree_owner(head), cfg)))
|
457
514
|
goto done;
|
458
515
|
|
459
516
|
if ((error = git_iterator_for_tree(&i, head, NULL)) < 0)
|
@@ -515,7 +572,6 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
|
|
515
572
|
git_buf path = GIT_BUF_INIT;
|
516
573
|
git_submodule *sm;
|
517
574
|
git_config *mods = NULL;
|
518
|
-
uint32_t mask;
|
519
575
|
|
520
576
|
assert(repo && map);
|
521
577
|
|
@@ -529,22 +585,6 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
|
|
529
585
|
if (wd && (error = git_buf_joinpath(&path, wd, GIT_MODULES_FILE)) < 0)
|
530
586
|
goto cleanup;
|
531
587
|
|
532
|
-
/* clear submodule flags that are to be refreshed */
|
533
|
-
mask = 0;
|
534
|
-
mask |= GIT_SUBMODULE_STATUS_IN_INDEX |
|
535
|
-
GIT_SUBMODULE_STATUS__INDEX_FLAGS |
|
536
|
-
GIT_SUBMODULE_STATUS__INDEX_OID_VALID |
|
537
|
-
GIT_SUBMODULE_STATUS__INDEX_MULTIPLE_ENTRIES;
|
538
|
-
|
539
|
-
mask |= GIT_SUBMODULE_STATUS_IN_HEAD |
|
540
|
-
GIT_SUBMODULE_STATUS__HEAD_OID_VALID;
|
541
|
-
mask |= GIT_SUBMODULE_STATUS_IN_CONFIG;
|
542
|
-
if (mask != 0)
|
543
|
-
mask |= GIT_SUBMODULE_STATUS_IN_WD |
|
544
|
-
GIT_SUBMODULE_STATUS__WD_SCANNED |
|
545
|
-
GIT_SUBMODULE_STATUS__WD_FLAGS |
|
546
|
-
GIT_SUBMODULE_STATUS__WD_OID_VALID;
|
547
|
-
|
548
588
|
/* add submodule information from .gitmodules */
|
549
589
|
if (wd) {
|
550
590
|
lfc_data data = { 0 };
|
@@ -573,7 +613,7 @@ int git_submodule__map(git_repository *repo, git_strmap *map)
|
|
573
613
|
goto cleanup;
|
574
614
|
}
|
575
615
|
/* shallow scan submodules in work tree as needed */
|
576
|
-
if (wd
|
616
|
+
if (wd) {
|
577
617
|
git_strmap_foreach_value(map, sm, {
|
578
618
|
submodule_load_from_wd_lite(sm);
|
579
619
|
});
|
@@ -584,7 +624,7 @@ cleanup:
|
|
584
624
|
/* TODO: if we got an error, mark submodule config as invalid? */
|
585
625
|
git_index_free(idx);
|
586
626
|
git_tree_free(head);
|
587
|
-
|
627
|
+
git_buf_dispose(&path);
|
588
628
|
return error;
|
589
629
|
}
|
590
630
|
|
@@ -689,8 +729,8 @@ static int submodule_repo_init(
|
|
689
729
|
error = git_repository_init_ext(&subrepo, workdir.ptr, &initopt);
|
690
730
|
|
691
731
|
cleanup:
|
692
|
-
|
693
|
-
|
732
|
+
git_buf_dispose(&workdir);
|
733
|
+
git_buf_dispose(&repodir);
|
694
734
|
|
695
735
|
*out = subrepo;
|
696
736
|
|
@@ -709,6 +749,7 @@ int git_submodule_add_setup(
|
|
709
749
|
git_submodule *sm = NULL;
|
710
750
|
git_buf name = GIT_BUF_INIT, real_url = GIT_BUF_INIT;
|
711
751
|
git_repository *subrepo = NULL;
|
752
|
+
bool path_occupied;
|
712
753
|
|
713
754
|
assert(repo && url && path);
|
714
755
|
|
@@ -733,6 +774,14 @@ int git_submodule_add_setup(
|
|
733
774
|
goto cleanup;
|
734
775
|
}
|
735
776
|
|
777
|
+
if ((error = is_path_occupied(&path_occupied, repo, path)) < 0)
|
778
|
+
goto cleanup;
|
779
|
+
|
780
|
+
if (path_occupied) {
|
781
|
+
error = GIT_EEXISTS;
|
782
|
+
goto cleanup;
|
783
|
+
}
|
784
|
+
|
736
785
|
/* update .gitmodules */
|
737
786
|
|
738
787
|
if (!(mods = open_gitmodules(repo, GITMODULES_CREATE))) {
|
@@ -786,8 +835,8 @@ cleanup:
|
|
786
835
|
|
787
836
|
git_config_file_free(mods);
|
788
837
|
git_repository_free(subrepo);
|
789
|
-
|
790
|
-
|
838
|
+
git_buf_dispose(&real_url);
|
839
|
+
git_buf_dispose(&name);
|
791
840
|
|
792
841
|
return error;
|
793
842
|
}
|
@@ -816,7 +865,7 @@ int git_submodule_repo_init(
|
|
816
865
|
|
817
866
|
done:
|
818
867
|
git_config_free(cfg);
|
819
|
-
|
868
|
+
git_buf_dispose(&buf);
|
820
869
|
return error;
|
821
870
|
}
|
822
871
|
|
@@ -900,7 +949,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
|
|
900
949
|
|
901
950
|
cleanup:
|
902
951
|
git_repository_free(sm_repo);
|
903
|
-
|
952
|
+
git_buf_dispose(&path);
|
904
953
|
return error;
|
905
954
|
}
|
906
955
|
|
@@ -965,7 +1014,7 @@ int git_submodule_resolve_url(git_buf *out, git_repository *repo, const char *ur
|
|
965
1014
|
error = -1;
|
966
1015
|
}
|
967
1016
|
|
968
|
-
|
1017
|
+
git_buf_dispose(&normalized);
|
969
1018
|
return error;
|
970
1019
|
}
|
971
1020
|
|
@@ -987,7 +1036,7 @@ static int write_var(git_repository *repo, const char *name, const char *var, co
|
|
987
1036
|
else
|
988
1037
|
error = git_config_file_delete(mods, key.ptr);
|
989
1038
|
|
990
|
-
|
1039
|
+
git_buf_dispose(&key);
|
991
1040
|
|
992
1041
|
cleanup:
|
993
1042
|
git_config_file_free(mods);
|
@@ -1152,8 +1201,8 @@ static int submodule_repo_create(
|
|
1152
1201
|
error = git_repository_init_ext(&subrepo, repodir.ptr, &initopt);
|
1153
1202
|
|
1154
1203
|
cleanup:
|
1155
|
-
|
1156
|
-
|
1204
|
+
git_buf_dispose(&workdir);
|
1205
|
+
git_buf_dispose(&repodir);
|
1157
1206
|
|
1158
1207
|
*out = subrepo;
|
1159
1208
|
|
@@ -1306,7 +1355,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
|
|
1306
1355
|
}
|
1307
1356
|
|
1308
1357
|
done:
|
1309
|
-
|
1358
|
+
git_buf_dispose(&buf);
|
1310
1359
|
git_config_free(config);
|
1311
1360
|
git_object_free(target_commit);
|
1312
1361
|
git_remote_free(remote);
|
@@ -1353,8 +1402,8 @@ int git_submodule_init(git_submodule *sm, int overwrite)
|
|
1353
1402
|
|
1354
1403
|
cleanup:
|
1355
1404
|
git_config_free(cfg);
|
1356
|
-
|
1357
|
-
|
1405
|
+
git_buf_dispose(&key);
|
1406
|
+
git_buf_dispose(&effective_submodule_url);
|
1358
1407
|
|
1359
1408
|
return error;
|
1360
1409
|
}
|
@@ -1394,7 +1443,7 @@ int git_submodule_sync(git_submodule *sm)
|
|
1394
1443
|
} else {
|
1395
1444
|
error = git_buf_join3(
|
1396
1445
|
&key, '.', "remote", remote_name.ptr, "url");
|
1397
|
-
|
1446
|
+
git_buf_dispose(&remote_name);
|
1398
1447
|
}
|
1399
1448
|
|
1400
1449
|
if (!error)
|
@@ -1403,7 +1452,7 @@ int git_submodule_sync(git_submodule *sm)
|
|
1403
1452
|
git_repository_free(smrepo);
|
1404
1453
|
}
|
1405
1454
|
|
1406
|
-
|
1455
|
+
git_buf_dispose(&key);
|
1407
1456
|
|
1408
1457
|
return error;
|
1409
1458
|
}
|
@@ -1457,7 +1506,7 @@ static int git_submodule__open(
|
|
1457
1506
|
sm->flags |= GIT_SUBMODULE_STATUS__WD_SCANNED;
|
1458
1507
|
}
|
1459
1508
|
|
1460
|
-
|
1509
|
+
git_buf_dispose(&path);
|
1461
1510
|
|
1462
1511
|
return error;
|
1463
1512
|
}
|
@@ -1813,14 +1862,6 @@ static int get_value(const char **out, git_config *cfg, git_buf *buf, const char
|
|
1813
1862
|
return error;
|
1814
1863
|
}
|
1815
1864
|
|
1816
|
-
static bool looks_like_command_line_option(const char *s)
|
1817
|
-
{
|
1818
|
-
if (s && s[0] == '-')
|
1819
|
-
return true;
|
1820
|
-
|
1821
|
-
return false;
|
1822
|
-
}
|
1823
|
-
|
1824
1865
|
static int submodule_read_config(git_submodule *sm, git_config *cfg)
|
1825
1866
|
{
|
1826
1867
|
git_buf key = GIT_BUF_INIT;
|
@@ -1834,31 +1875,24 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
|
|
1834
1875
|
|
1835
1876
|
if ((error = get_value(&value, cfg, &key, sm->name, "path")) == 0) {
|
1836
1877
|
in_config = 1;
|
1837
|
-
/* We would warn here if we had that API */
|
1838
|
-
if (!looks_like_command_line_option(value)) {
|
1839
1878
|
/*
|
1840
1879
|
* TODO: if case insensitive filesystem, then the following strcmp
|
1841
1880
|
* should be strcasecmp
|
1842
1881
|
*/
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
}
|
1849
|
-
|
1882
|
+
if (strcmp(sm->name, value) != 0) {
|
1883
|
+
if (sm->path != sm->name)
|
1884
|
+
git__free(sm->path);
|
1885
|
+
sm->path = git__strdup(value);
|
1886
|
+
GITERR_CHECK_ALLOC(sm->path);
|
1850
1887
|
}
|
1851
1888
|
} else if (error != GIT_ENOTFOUND) {
|
1852
1889
|
goto cleanup;
|
1853
1890
|
}
|
1854
1891
|
|
1855
1892
|
if ((error = get_value(&value, cfg, &key, sm->name, "url")) == 0) {
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
sm->url = git__strdup(value);
|
1860
|
-
GITERR_CHECK_ALLOC(sm->url);
|
1861
|
-
}
|
1893
|
+
in_config = 1;
|
1894
|
+
sm->url = git__strdup(value);
|
1895
|
+
GITERR_CHECK_ALLOC(sm->url);
|
1862
1896
|
} else if (error != GIT_ENOTFOUND) {
|
1863
1897
|
goto cleanup;
|
1864
1898
|
}
|
@@ -1904,7 +1938,7 @@ static int submodule_read_config(git_submodule *sm, git_config *cfg)
|
|
1904
1938
|
error = 0;
|
1905
1939
|
|
1906
1940
|
cleanup:
|
1907
|
-
|
1941
|
+
git_buf_dispose(&key);
|
1908
1942
|
return error;
|
1909
1943
|
}
|
1910
1944
|
|
@@ -1966,7 +2000,7 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
|
|
1966
2000
|
error = 0;
|
1967
2001
|
|
1968
2002
|
done:
|
1969
|
-
|
2003
|
+
git_buf_dispose(&name);
|
1970
2004
|
return error;
|
1971
2005
|
}
|
1972
2006
|
|
@@ -1983,7 +2017,7 @@ static int submodule_load_from_wd_lite(git_submodule *sm)
|
|
1983
2017
|
if (git_path_contains(&path, DOT_GIT))
|
1984
2018
|
sm->flags |= GIT_SUBMODULE_STATUS_IN_WD;
|
1985
2019
|
|
1986
|
-
|
2020
|
+
git_buf_dispose(&path);
|
1987
2021
|
return 0;
|
1988
2022
|
}
|
1989
2023
|
|
@@ -2007,6 +2041,7 @@ static int gitmodules_snapshot(git_config **snap, git_repository *repo)
|
|
2007
2041
|
|
2008
2042
|
if ((error = git_config_open_ondisk(&mods, path.ptr)) < 0)
|
2009
2043
|
goto cleanup;
|
2044
|
+
git_buf_dispose(&path);
|
2010
2045
|
|
2011
2046
|
if ((error = git_config_snapshot(snap, mods)) < 0)
|
2012
2047
|
goto cleanup;
|
@@ -2016,7 +2051,7 @@ static int gitmodules_snapshot(git_config **snap, git_repository *repo)
|
|
2016
2051
|
cleanup:
|
2017
2052
|
if (mods)
|
2018
2053
|
git_config_free(mods);
|
2019
|
-
|
2054
|
+
git_buf_dispose(&path);
|
2020
2055
|
|
2021
2056
|
return error;
|
2022
2057
|
}
|
@@ -2045,7 +2080,7 @@ static git_config_backend *open_gitmodules(
|
|
2045
2080
|
}
|
2046
2081
|
}
|
2047
2082
|
|
2048
|
-
|
2083
|
+
git_buf_dispose(&path);
|
2049
2084
|
|
2050
2085
|
return mods;
|
2051
2086
|
}
|
@@ -2085,7 +2120,7 @@ static int lookup_head_remote_key(git_buf *remote_name, git_repository *repo)
|
|
2085
2120
|
goto done;
|
2086
2121
|
|
2087
2122
|
done:
|
2088
|
-
|
2123
|
+
git_buf_dispose(&upstream_name);
|
2089
2124
|
git_reference_free(head);
|
2090
2125
|
|
2091
2126
|
return error;
|
@@ -2101,7 +2136,7 @@ static int lookup_head_remote(git_remote **remote, git_repository *repo)
|
|
2101
2136
|
if (!(error = lookup_head_remote_key(&remote_name, repo)))
|
2102
2137
|
error = git_remote_lookup(remote, repo, remote_name.ptr);
|
2103
2138
|
|
2104
|
-
|
2139
|
+
git_buf_dispose(&remote_name);
|
2105
2140
|
|
2106
2141
|
return error;
|
2107
2142
|
}
|