rugged 1.5.0.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +2 -2
  3. data/ext/rugged/rugged_blame.c +2 -0
  4. data/ext/rugged/rugged_blob.c +3 -0
  5. data/ext/rugged/rugged_commit.c +1 -0
  6. data/ext/rugged/rugged_config.c +2 -0
  7. data/ext/rugged/rugged_diff.c +1 -0
  8. data/ext/rugged/rugged_index.c +2 -0
  9. data/ext/rugged/rugged_patch.c +1 -0
  10. data/ext/rugged/rugged_rebase.c +1 -0
  11. data/ext/rugged/rugged_reference.c +1 -0
  12. data/ext/rugged/rugged_remote.c +1 -0
  13. data/ext/rugged/rugged_repo.c +5 -2
  14. data/ext/rugged/rugged_revwalk.c +5 -1
  15. data/ext/rugged/rugged_submodule.c +1 -0
  16. data/ext/rugged/rugged_tag.c +1 -0
  17. data/ext/rugged/rugged_tree.c +4 -0
  18. data/lib/rugged/index.rb +1 -1
  19. data/lib/rugged/tree.rb +1 -1
  20. data/lib/rugged/version.rb +1 -1
  21. data/vendor/libgit2/CMakeLists.txt +5 -1
  22. data/vendor/libgit2/COPYING +30 -0
  23. data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
  24. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +2 -0
  25. data/vendor/libgit2/include/git2/common.h +13 -6
  26. data/vendor/libgit2/include/git2/deprecated.h +6 -0
  27. data/vendor/libgit2/include/git2/diff.h +1 -1
  28. data/vendor/libgit2/include/git2/experimental.h +20 -0
  29. data/vendor/libgit2/include/git2/indexer.h +29 -0
  30. data/vendor/libgit2/include/git2/object.h +28 -2
  31. data/vendor/libgit2/include/git2/odb.h +58 -7
  32. data/vendor/libgit2/include/git2/odb_backend.h +106 -18
  33. data/vendor/libgit2/include/git2/oid.h +115 -15
  34. data/vendor/libgit2/include/git2/repository.h +20 -1
  35. data/vendor/libgit2/include/git2/stash.h +60 -6
  36. data/vendor/libgit2/include/git2/strarray.h +0 -13
  37. data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
  38. data/vendor/libgit2/include/git2/sys/transport.h +12 -0
  39. data/vendor/libgit2/include/git2/version.h +4 -4
  40. data/vendor/libgit2/include/git2.h +1 -0
  41. data/vendor/libgit2/src/CMakeLists.txt +0 -6
  42. data/vendor/libgit2/src/cli/CMakeLists.txt +6 -2
  43. data/vendor/libgit2/src/cli/cmd_hash_object.c +27 -8
  44. data/vendor/libgit2/src/cli/opt.c +1 -1
  45. data/vendor/libgit2/src/libgit2/CMakeLists.txt +25 -15
  46. data/vendor/libgit2/src/libgit2/annotated_commit.c +1 -1
  47. data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
  48. data/vendor/libgit2/src/libgit2/attr_file.c +1 -1
  49. data/vendor/libgit2/src/libgit2/attrcache.c +1 -1
  50. data/vendor/libgit2/src/libgit2/blame.c +2 -0
  51. data/vendor/libgit2/src/libgit2/blob.c +4 -2
  52. data/vendor/libgit2/src/libgit2/blob.h +2 -2
  53. data/vendor/libgit2/src/libgit2/branch.c +2 -2
  54. data/vendor/libgit2/src/libgit2/cherrypick.c +3 -3
  55. data/vendor/libgit2/src/libgit2/clone.c +31 -2
  56. data/vendor/libgit2/src/libgit2/commit.c +52 -17
  57. data/vendor/libgit2/src/libgit2/commit.h +25 -7
  58. data/vendor/libgit2/src/libgit2/commit_graph.c +47 -32
  59. data/vendor/libgit2/src/libgit2/commit_graph.h +3 -0
  60. data/vendor/libgit2/src/libgit2/commit_list.c +6 -2
  61. data/vendor/libgit2/src/libgit2/config.c +1 -1
  62. data/vendor/libgit2/src/libgit2/config_file.c +2 -2
  63. data/vendor/libgit2/src/libgit2/describe.c +8 -8
  64. data/vendor/libgit2/src/libgit2/diff.c +5 -1
  65. data/vendor/libgit2/src/libgit2/diff_file.c +15 -6
  66. data/vendor/libgit2/src/libgit2/diff_generate.c +17 -12
  67. data/vendor/libgit2/src/libgit2/diff_print.c +5 -5
  68. data/vendor/libgit2/src/libgit2/diff_tform.c +4 -0
  69. data/vendor/libgit2/src/libgit2/email.c +2 -2
  70. data/vendor/libgit2/src/libgit2/experimental.h.in +13 -0
  71. data/vendor/libgit2/src/libgit2/fetch.c +3 -6
  72. data/vendor/libgit2/src/libgit2/fetchhead.c +4 -4
  73. data/vendor/libgit2/src/libgit2/ident.c +3 -3
  74. data/vendor/libgit2/src/libgit2/index.c +11 -9
  75. data/vendor/libgit2/src/libgit2/indexer.c +107 -44
  76. data/vendor/libgit2/src/libgit2/iterator.c +4 -2
  77. data/vendor/libgit2/src/libgit2/libgit2.c +19 -0
  78. data/vendor/libgit2/src/libgit2/merge.c +3 -3
  79. data/vendor/libgit2/src/libgit2/midx.c +16 -15
  80. data/vendor/libgit2/src/libgit2/mwindow.c +5 -2
  81. data/vendor/libgit2/src/libgit2/mwindow.h +4 -1
  82. data/vendor/libgit2/src/libgit2/notes.c +5 -5
  83. data/vendor/libgit2/src/libgit2/object.c +89 -25
  84. data/vendor/libgit2/src/libgit2/object.h +12 -3
  85. data/vendor/libgit2/src/libgit2/odb.c +194 -50
  86. data/vendor/libgit2/src/libgit2/odb.h +43 -4
  87. data/vendor/libgit2/src/libgit2/odb_loose.c +128 -70
  88. data/vendor/libgit2/src/libgit2/odb_pack.c +96 -44
  89. data/vendor/libgit2/src/libgit2/oid.c +134 -76
  90. data/vendor/libgit2/src/libgit2/oid.h +183 -9
  91. data/vendor/libgit2/src/libgit2/pack-objects.c +15 -4
  92. data/vendor/libgit2/src/libgit2/pack.c +90 -66
  93. data/vendor/libgit2/src/libgit2/pack.h +29 -15
  94. data/vendor/libgit2/src/libgit2/parse.c +4 -3
  95. data/vendor/libgit2/src/libgit2/patch_parse.c +5 -5
  96. data/vendor/libgit2/src/libgit2/push.c +13 -3
  97. data/vendor/libgit2/src/libgit2/reader.c +1 -1
  98. data/vendor/libgit2/src/libgit2/rebase.c +19 -18
  99. data/vendor/libgit2/src/libgit2/refdb_fs.c +70 -39
  100. data/vendor/libgit2/src/libgit2/reflog.c +7 -5
  101. data/vendor/libgit2/src/libgit2/reflog.h +1 -2
  102. data/vendor/libgit2/src/libgit2/refs.c +2 -0
  103. data/vendor/libgit2/src/libgit2/remote.c +38 -37
  104. data/vendor/libgit2/src/libgit2/remote.h +40 -0
  105. data/vendor/libgit2/src/libgit2/repository.c +212 -36
  106. data/vendor/libgit2/src/libgit2/repository.h +9 -0
  107. data/vendor/libgit2/src/libgit2/reset.c +2 -2
  108. data/vendor/libgit2/src/libgit2/revert.c +4 -4
  109. data/vendor/libgit2/src/libgit2/revparse.c +23 -7
  110. data/vendor/libgit2/src/libgit2/revwalk.c +5 -1
  111. data/vendor/libgit2/src/libgit2/stash.c +201 -26
  112. data/vendor/libgit2/src/libgit2/strarray.c +1 -0
  113. data/vendor/libgit2/src/libgit2/strarray.h +25 -0
  114. data/vendor/libgit2/src/libgit2/streams/openssl.c +1 -1
  115. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +7 -3
  116. data/vendor/libgit2/src/libgit2/streams/socket.c +4 -1
  117. data/vendor/libgit2/src/libgit2/submodule.c +6 -2
  118. data/vendor/libgit2/src/libgit2/sysdir.c +294 -7
  119. data/vendor/libgit2/src/libgit2/sysdir.h +39 -9
  120. data/vendor/libgit2/src/libgit2/tag.c +29 -10
  121. data/vendor/libgit2/src/libgit2/tag.h +2 -2
  122. data/vendor/libgit2/src/libgit2/threadstate.h +1 -1
  123. data/vendor/libgit2/src/libgit2/transports/http.c +8 -7
  124. data/vendor/libgit2/src/libgit2/transports/httpclient.c +9 -0
  125. data/vendor/libgit2/src/libgit2/transports/httpclient.h +10 -0
  126. data/vendor/libgit2/src/libgit2/transports/local.c +14 -0
  127. data/vendor/libgit2/src/libgit2/transports/smart.c +35 -0
  128. data/vendor/libgit2/src/libgit2/transports/smart.h +10 -1
  129. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +153 -41
  130. data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +42 -12
  131. data/vendor/libgit2/src/libgit2/transports/ssh.c +333 -101
  132. data/vendor/libgit2/src/libgit2/transports/winhttp.c +9 -4
  133. data/vendor/libgit2/src/libgit2/tree-cache.c +4 -4
  134. data/vendor/libgit2/src/libgit2/tree.c +22 -16
  135. data/vendor/libgit2/src/libgit2/tree.h +2 -2
  136. data/vendor/libgit2/src/libgit2/worktree.c +5 -0
  137. data/vendor/libgit2/src/util/CMakeLists.txt +7 -1
  138. data/vendor/libgit2/src/util/fs_path.c +1 -1
  139. data/vendor/libgit2/src/util/futils.c +0 -3
  140. data/vendor/libgit2/src/util/git2_util.h +2 -2
  141. data/vendor/libgit2/src/util/hash/openssl.c +4 -3
  142. data/vendor/libgit2/src/util/hash/rfc6234/sha.h +0 -112
  143. data/vendor/libgit2/src/util/hash.h +13 -0
  144. data/vendor/libgit2/src/util/net.c +338 -84
  145. data/vendor/libgit2/src/util/net.h +7 -0
  146. data/vendor/libgit2/src/util/posix.h +2 -0
  147. data/vendor/libgit2/src/util/rand.c +4 -0
  148. data/vendor/libgit2/src/util/regexp.c +3 -3
  149. data/vendor/libgit2/src/util/thread.h +20 -19
  150. data/vendor/libgit2/src/util/util.h +1 -0
  151. metadata +7 -5
  152. data/vendor/libgit2/src/util/win32/findfile.c +0 -286
  153. data/vendor/libgit2/src/util/win32/findfile.h +0 -22
  154. /data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +0 -0
@@ -187,6 +187,11 @@ int git_worktree_lookup(git_worktree **out, git_repository *repo, const char *na
187
187
  if ((error = git_str_join3(&path, '/', repo->commondir, "worktrees", name)) < 0)
188
188
  goto out;
189
189
 
190
+ if (!git_fs_path_isdir(path.ptr)) {
191
+ error = GIT_ENOTFOUND;
192
+ goto out;
193
+ }
194
+
190
195
  if ((error = (open_worktree_dir(out, git_repository_workdir(repo), path.ptr, name))) < 0)
191
196
  goto out;
192
197
 
@@ -4,8 +4,12 @@ add_library(util OBJECT)
4
4
  set_target_properties(util PROPERTIES C_STANDARD 90)
5
5
  set_target_properties(util PROPERTIES C_EXTENSIONS OFF)
6
6
 
7
+ configure_file(git2_features.h.in git2_features.h)
8
+
7
9
  set(UTIL_INCLUDES
8
- "${PROJECT_BINARY_DIR}/src"
10
+ "${PROJECT_BINARY_DIR}/src/util"
11
+ "${PROJECT_BINARY_DIR}/include"
12
+ "${PROJECT_BINARY_DIR}/include/git2"
9
13
  "${PROJECT_SOURCE_DIR}/src/util"
10
14
  "${PROJECT_SOURCE_DIR}/include")
11
15
 
@@ -34,6 +38,7 @@ if(USE_SHA1 STREQUAL "CollisionDetection")
34
38
  target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_SHA1_C=\"git2_util.h\")
35
39
  target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"git2_util.h\")
36
40
  elseif(USE_SHA1 STREQUAL "OpenSSL" OR USE_SHA1 STREQUAL "OpenSSL-Dynamic")
41
+ add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
37
42
  file(GLOB UTIL_SRC_SHA1 hash/openssl.*)
38
43
  elseif(USE_SHA1 STREQUAL "CommonCrypto")
39
44
  file(GLOB UTIL_SRC_SHA1 hash/common_crypto.*)
@@ -50,6 +55,7 @@ list(SORT UTIL_SRC_SHA1)
50
55
  if(USE_SHA256 STREQUAL "Builtin")
51
56
  file(GLOB UTIL_SRC_SHA256 hash/builtin.* hash/rfc6234/*)
52
57
  elseif(USE_SHA256 STREQUAL "OpenSSL" OR USE_SHA256 STREQUAL "OpenSSL-Dynamic")
58
+ add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
53
59
  file(GLOB UTIL_SRC_SHA256 hash/openssl.*)
54
60
  elseif(USE_SHA256 STREQUAL "CommonCrypto")
55
61
  file(GLOB UTIL_SRC_SHA256 hash/common_crypto.*)
@@ -1855,7 +1855,7 @@ static int file_owner_sid(PSID *out, const char *path)
1855
1855
  PSECURITY_DESCRIPTOR descriptor = NULL;
1856
1856
  PSID owner_sid;
1857
1857
  DWORD ret;
1858
- int error = -1;
1858
+ int error = GIT_EINVALID;
1859
1859
 
1860
1860
  if (git_win32_path_from_utf8(path_w32, path) < 0)
1861
1861
  return -1;
@@ -13,9 +13,6 @@
13
13
  #include "rand.h"
14
14
 
15
15
  #include <ctype.h>
16
- #if GIT_WIN32
17
- #include "win32/findfile.h"
18
- #endif
19
16
 
20
17
  #define GIT_FILEMODE_DEFAULT 0100666
21
18
 
@@ -7,8 +7,8 @@
7
7
  #ifndef INCLUDE_git2_util_h__
8
8
  #define INCLUDE_git2_util_h__
9
9
 
10
- #ifndef LIBGIT2_NO_FEATURES_H
11
- # include "git2/sys/features.h"
10
+ #if !defined(LIBGIT2_NO_FEATURES_H)
11
+ # include "git2_features.h"
12
12
  #endif
13
13
 
14
14
  #include "git2/common.h"
@@ -10,8 +10,8 @@
10
10
  #ifdef GIT_OPENSSL_DYNAMIC
11
11
  # include <dlfcn.h>
12
12
 
13
- int handle_count;
14
- void *openssl_handle;
13
+ static int handle_count;
14
+ static void *openssl_handle;
15
15
 
16
16
  static int git_hash_openssl_global_shutdown(void)
17
17
  {
@@ -30,7 +30,8 @@ static int git_hash_openssl_global_init(void)
30
30
  (openssl_handle = dlopen("libssl.1.1.dylib", RTLD_NOW)) == NULL &&
31
31
  (openssl_handle = dlopen("libssl.so.1.0.0", RTLD_NOW)) == NULL &&
32
32
  (openssl_handle = dlopen("libssl.1.0.0.dylib", RTLD_NOW)) == NULL &&
33
- (openssl_handle = dlopen("libssl.so.10", RTLD_NOW)) == NULL) {
33
+ (openssl_handle = dlopen("libssl.so.10", RTLD_NOW)) == NULL &&
34
+ (openssl_handle = dlopen("libssl.so.3", RTLD_NOW)) == NULL) {
34
35
  git_error_set(GIT_ERROR_SSL, "could not load ssl libraries");
35
36
  return -1;
36
37
  }
@@ -191,49 +191,6 @@ typedef struct SHA256Context SHA224Context;
191
191
  */
192
192
  typedef struct SHA512Context SHA384Context;
193
193
 
194
- /*
195
- * This structure holds context information for all SHA
196
- * hashing operations.
197
- */
198
- typedef struct USHAContext {
199
- int whichSha; /* which SHA is being used */
200
- union {
201
- SHA1Context sha1Context;
202
- SHA224Context sha224Context; SHA256Context sha256Context;
203
- SHA384Context sha384Context; SHA512Context sha512Context;
204
- } ctx;
205
- } USHAContext;
206
-
207
- /*
208
- * This structure will hold context information for the HMAC
209
- * keyed-hashing operation.
210
- */
211
- typedef struct HMACContext {
212
- int whichSha; /* which SHA is being used */
213
- int hashSize; /* hash size of SHA being used */
214
- int blockSize; /* block size of SHA being used */
215
- USHAContext shaContext; /* SHA context */
216
- unsigned char k_opad[USHA_Max_Message_Block_Size];
217
- /* outer padding - key XORd with opad */
218
- int Computed; /* Is the MAC computed? */
219
- int Corrupted; /* Cumulative corruption code */
220
-
221
- } HMACContext;
222
-
223
- /*
224
- * This structure will hold context information for the HKDF
225
- * extract-and-expand Key Derivation Functions.
226
- */
227
- typedef struct HKDFContext {
228
- int whichSha; /* which SHA is being used */
229
- HMACContext hmacContext;
230
- int hashSize; /* hash size of SHA being used */
231
- unsigned char prk[USHAMaxHashSize];
232
- /* pseudo-random key - output of hkdfInput */
233
- int Computed; /* Is the key material computed? */
234
- int Corrupted; /* Cumulative corruption code */
235
- } HKDFContext;
236
-
237
194
  /*
238
195
  * Function Prototypes
239
196
  */
@@ -283,73 +240,4 @@ extern int SHA512FinalBits(SHA512Context *, uint8_t bits,
283
240
  extern int SHA512Result(SHA512Context *,
284
241
  uint8_t Message_Digest[SHA512HashSize]);
285
242
 
286
- /* Unified SHA functions, chosen by whichSha */
287
- extern int USHAReset(USHAContext *context, SHAversion whichSha);
288
- extern int USHAInput(USHAContext *context,
289
- const uint8_t *bytes, unsigned int bytecount);
290
- extern int USHAFinalBits(USHAContext *context,
291
- uint8_t bits, unsigned int bit_count);
292
- extern int USHAResult(USHAContext *context,
293
- uint8_t Message_Digest[USHAMaxHashSize]);
294
- extern int USHABlockSize(enum SHAversion whichSha);
295
- extern int USHAHashSize(enum SHAversion whichSha);
296
- extern int USHAHashSizeBits(enum SHAversion whichSha);
297
- extern const char *USHAHashName(enum SHAversion whichSha);
298
-
299
- /*
300
- * HMAC Keyed-Hashing for Message Authentication, RFC 2104,
301
- * for all SHAs.
302
- * This interface allows a fixed-length text input to be used.
303
- */
304
- extern int hmac(SHAversion whichSha, /* which SHA algorithm to use */
305
- const unsigned char *text, /* pointer to data stream */
306
- int text_len, /* length of data stream */
307
- const unsigned char *key, /* pointer to authentication key */
308
- int key_len, /* length of authentication key */
309
- uint8_t digest[USHAMaxHashSize]); /* caller digest to fill in */
310
-
311
- /*
312
- * HMAC Keyed-Hashing for Message Authentication, RFC 2104,
313
- * for all SHAs.
314
- * This interface allows any length of text input to be used.
315
- */
316
- extern int hmacReset(HMACContext *context, enum SHAversion whichSha,
317
- const unsigned char *key, int key_len);
318
- extern int hmacInput(HMACContext *context, const unsigned char *text,
319
- int text_len);
320
- extern int hmacFinalBits(HMACContext *context, uint8_t bits,
321
- unsigned int bit_count);
322
- extern int hmacResult(HMACContext *context,
323
- uint8_t digest[USHAMaxHashSize]);
324
-
325
- /*
326
- * HKDF HMAC-based Extract-and-Expand Key Derivation Function,
327
- * RFC 5869, for all SHAs.
328
- */
329
- extern int hkdf(SHAversion whichSha, const unsigned char *salt,
330
- int salt_len, const unsigned char *ikm, int ikm_len,
331
- const unsigned char *info, int info_len,
332
- uint8_t okm[ ], int okm_len);
333
- extern int hkdfExtract(SHAversion whichSha, const unsigned char *salt,
334
- int salt_len, const unsigned char *ikm,
335
- int ikm_len, uint8_t prk[USHAMaxHashSize]);
336
- extern int hkdfExpand(SHAversion whichSha, const uint8_t prk[ ],
337
- int prk_len, const unsigned char *info,
338
- int info_len, uint8_t okm[ ], int okm_len);
339
-
340
- /*
341
- * HKDF HMAC-based Extract-and-Expand Key Derivation Function,
342
- * RFC 5869, for all SHAs.
343
- * This interface allows any length of text input to be used.
344
- */
345
- extern int hkdfReset(HKDFContext *context, enum SHAversion whichSha,
346
- const unsigned char *salt, int salt_len);
347
- extern int hkdfInput(HKDFContext *context, const unsigned char *ikm,
348
- int ikm_len);
349
- extern int hkdfFinalBits(HKDFContext *context, uint8_t ikm_bits,
350
- unsigned int ikm_bit_count);
351
- extern int hkdfResult(HKDFContext *context,
352
- uint8_t prk[USHAMaxHashSize],
353
- const unsigned char *info, int info_len,
354
- uint8_t okm[USHAMaxHashSize], int okm_len);
355
243
  #endif /* _SHA_H_ */
@@ -23,6 +23,8 @@ typedef enum {
23
23
  GIT_HASH_ALGORITHM_SHA256
24
24
  } git_hash_algorithm_t;
25
25
 
26
+ #define GIT_HASH_MAX_SIZE GIT_HASH_SHA256_SIZE
27
+
26
28
  typedef struct git_hash_ctx {
27
29
  union {
28
30
  git_hash_sha1_ctx sha1;
@@ -45,4 +47,15 @@ int git_hash_vec(unsigned char *out, git_str_vec *vec, size_t n, git_hash_algori
45
47
 
46
48
  int git_hash_fmt(char *out, unsigned char *hash, size_t hash_len);
47
49
 
50
+ GIT_INLINE(size_t) git_hash_size(git_hash_algorithm_t algorithm) {
51
+ switch (algorithm) {
52
+ case GIT_HASH_ALGORITHM_SHA1:
53
+ return GIT_HASH_SHA1_SIZE;
54
+ case GIT_HASH_ALGORITHM_SHA256:
55
+ return GIT_HASH_SHA256_SIZE;
56
+ default:
57
+ return 0;
58
+ }
59
+ }
60
+
48
61
  #endif