rugged 1.9.0 → 1.9.5.1

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.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +4 -4
  3. data/ext/rugged/rugged.c +12 -1
  4. data/ext/rugged/rugged_blame.c +22 -6
  5. data/ext/rugged/rugged_blob.c +24 -9
  6. data/ext/rugged/rugged_branch.c +10 -7
  7. data/ext/rugged/rugged_branch_collection.c +8 -6
  8. data/ext/rugged/rugged_commit.c +7 -6
  9. data/ext/rugged/rugged_config.c +20 -11
  10. data/ext/rugged/rugged_diff.c +26 -12
  11. data/ext/rugged/rugged_diff_hunk.c +2 -1
  12. data/ext/rugged/rugged_index.c +39 -29
  13. data/ext/rugged/rugged_note.c +7 -6
  14. data/ext/rugged/rugged_object.c +3 -2
  15. data/ext/rugged/rugged_patch.c +23 -9
  16. data/ext/rugged/rugged_rebase.c +22 -10
  17. data/ext/rugged/rugged_reference.c +22 -13
  18. data/ext/rugged/rugged_reference_collection.c +9 -7
  19. data/ext/rugged/rugged_remote.c +23 -12
  20. data/ext/rugged/rugged_remote_collection.c +11 -9
  21. data/ext/rugged/rugged_repo.c +60 -45
  22. data/ext/rugged/rugged_revwalk.c +22 -12
  23. data/ext/rugged/rugged_submodule.c +23 -20
  24. data/ext/rugged/rugged_submodule_collection.c +20 -9
  25. data/ext/rugged/rugged_tag.c +6 -4
  26. data/ext/rugged/rugged_tag_collection.c +7 -5
  27. data/ext/rugged/rugged_tree.c +27 -15
  28. data/lib/rugged/version.rb +1 -1
  29. data/vendor/libgit2/AUTHORS +2 -0
  30. data/vendor/libgit2/CMakeLists.txt +1 -1
  31. data/vendor/libgit2/COPYING +83 -11
  32. data/vendor/libgit2/cmake/DefaultCFlags.cmake +4 -1
  33. data/vendor/libgit2/cmake/SelectRegex.cmake +8 -3
  34. data/vendor/libgit2/cmake/SelectSSH.cmake +9 -3
  35. data/vendor/libgit2/deps/pcre2/CMakeLists.txt +110 -0
  36. data/vendor/libgit2/deps/pcre2/LICENCE.md +104 -0
  37. data/vendor/libgit2/deps/pcre2/config.h.in +54 -0
  38. data/vendor/libgit2/deps/pcre2/pcre2.h +1079 -0
  39. data/vendor/libgit2/deps/pcre2/pcre2_auto_possess.c +1416 -0
  40. data/vendor/libgit2/deps/{pcre/pcre_chartables.c → pcre2/pcre2_chartables.c} +41 -47
  41. data/vendor/libgit2/deps/{pcre/pcre_ord2utf8.c → pcre2/pcre2_chkdint.c} +36 -36
  42. data/vendor/libgit2/deps/pcre2/pcre2_compile.c +11345 -0
  43. data/vendor/libgit2/deps/pcre2/pcre2_compile.h +356 -0
  44. data/vendor/libgit2/deps/pcre2/pcre2_compile_cgroup.c +632 -0
  45. data/vendor/libgit2/deps/pcre2/pcre2_compile_class.c +2777 -0
  46. data/vendor/libgit2/deps/pcre2/pcre2_config.c +250 -0
  47. data/vendor/libgit2/deps/pcre2/pcre2_context.c +557 -0
  48. data/vendor/libgit2/deps/pcre2/pcre2_convert.c +1263 -0
  49. data/vendor/libgit2/deps/{pcre/pcre_dfa_exec.c → pcre2/pcre2_dfa_match.c} +1402 -943
  50. data/vendor/libgit2/deps/pcre2/pcre2_error.c +384 -0
  51. data/vendor/libgit2/deps/pcre2/pcre2_extuni.c +159 -0
  52. data/vendor/libgit2/deps/pcre2/pcre2_find_bracket.c +217 -0
  53. data/vendor/libgit2/deps/pcre2/pcre2_fuzzsupport.c +844 -0
  54. data/vendor/libgit2/deps/pcre2/pcre2_internal.h +2353 -0
  55. data/vendor/libgit2/deps/pcre2/pcre2_intmodedep.h +1044 -0
  56. data/vendor/libgit2/deps/pcre2/pcre2_maketables.c +177 -0
  57. data/vendor/libgit2/deps/pcre2/pcre2_match.c +8244 -0
  58. data/vendor/libgit2/deps/pcre2/pcre2_match_data.c +184 -0
  59. data/vendor/libgit2/deps/pcre2/pcre2_match_next.c +171 -0
  60. data/vendor/libgit2/deps/{pcre/pcre_newline.c → pcre2/pcre2_newline.c} +92 -63
  61. data/vendor/libgit2/deps/{pcre/pcre_refcount.c → pcre2/pcre2_ord2utf.c} +64 -38
  62. data/vendor/libgit2/deps/pcre2/pcre2_pattern_info.c +430 -0
  63. data/vendor/libgit2/deps/pcre2/pcre2_printint_inc.h +1098 -0
  64. data/vendor/libgit2/deps/pcre2/pcre2_script_run.c +344 -0
  65. data/vendor/libgit2/deps/pcre2/pcre2_serialize.c +284 -0
  66. data/vendor/libgit2/deps/pcre2/pcre2_string_utils.c +199 -0
  67. data/vendor/libgit2/deps/pcre2/pcre2_study.c +2087 -0
  68. data/vendor/libgit2/deps/pcre2/pcre2_substitute.c +1761 -0
  69. data/vendor/libgit2/deps/pcre2/pcre2_substring.c +553 -0
  70. data/vendor/libgit2/deps/pcre2/pcre2_tables.c +310 -0
  71. data/vendor/libgit2/deps/pcre2/pcre2_ucd.c +5805 -0
  72. data/vendor/libgit2/deps/pcre2/pcre2_ucp.h +408 -0
  73. data/vendor/libgit2/deps/pcre2/pcre2_ucptables_inc.h +1596 -0
  74. data/vendor/libgit2/deps/pcre2/pcre2_util.h +179 -0
  75. data/vendor/libgit2/deps/pcre2/pcre2_valid_utf.c +397 -0
  76. data/vendor/libgit2/deps/pcre2/pcre2_xclass.c +547 -0
  77. data/vendor/libgit2/deps/xdiff/CMakeLists.txt +1 -1
  78. data/vendor/libgit2/deps/xdiff/xmerge.c +14 -10
  79. data/vendor/libgit2/include/git2/common.h +13 -1
  80. data/vendor/libgit2/include/git2/deprecated.h +1 -1
  81. data/vendor/libgit2/include/git2/index.h +1 -1
  82. data/vendor/libgit2/include/git2/merge.h +4 -2
  83. data/vendor/libgit2/include/git2/oid.h +0 -1
  84. data/vendor/libgit2/include/git2/proxy.h +2 -3
  85. data/vendor/libgit2/include/git2/remote.h +19 -7
  86. data/vendor/libgit2/include/git2/stdint.h +1 -1
  87. data/vendor/libgit2/include/git2/sys/transport.h +1 -1
  88. data/vendor/libgit2/include/git2/version.h +4 -2
  89. data/vendor/libgit2/src/cli/CMakeLists.txt +1 -2
  90. data/vendor/libgit2/src/cli/opt.c +3 -3
  91. data/vendor/libgit2/src/cli/opt_usage.c +1 -1
  92. data/vendor/libgit2/src/libgit2/CMakeLists.txt +32 -16
  93. data/vendor/libgit2/src/libgit2/attr_file.c +10 -3
  94. data/vendor/libgit2/src/libgit2/blame.c +6 -0
  95. data/vendor/libgit2/src/libgit2/clone.c +6 -0
  96. data/vendor/libgit2/src/libgit2/commit.c +1 -1
  97. data/vendor/libgit2/src/libgit2/commit_graph.c +1 -2
  98. data/vendor/libgit2/src/libgit2/config.c +1 -1
  99. data/vendor/libgit2/src/libgit2/config_file.c +2 -1
  100. data/vendor/libgit2/src/libgit2/config_mem.c +1 -0
  101. data/vendor/libgit2/src/libgit2/config_parse.c +2 -1
  102. data/vendor/libgit2/src/libgit2/delta.c +13 -1
  103. data/vendor/libgit2/src/libgit2/diff_driver.c +1 -1
  104. data/vendor/libgit2/src/libgit2/diff_stats.c +19 -12
  105. data/vendor/libgit2/src/libgit2/fetchhead.c +1 -1
  106. data/vendor/libgit2/src/libgit2/index.c +8 -8
  107. data/vendor/libgit2/src/libgit2/index.h +3 -0
  108. data/vendor/libgit2/src/libgit2/indexer.c +5 -4
  109. data/vendor/libgit2/src/libgit2/merge.c +1 -1
  110. data/vendor/libgit2/src/libgit2/merge.h +4 -0
  111. data/vendor/libgit2/src/libgit2/merge_file.c +43 -30
  112. data/vendor/libgit2/src/libgit2/message.c +1 -1
  113. data/vendor/libgit2/src/libgit2/midx.c +2 -3
  114. data/vendor/libgit2/src/libgit2/odb.c +2 -6
  115. data/vendor/libgit2/src/libgit2/odb_loose.c +24 -14
  116. data/vendor/libgit2/src/libgit2/oid.c +4 -5
  117. data/vendor/libgit2/src/libgit2/pack-objects.c +2 -4
  118. data/vendor/libgit2/src/libgit2/pack.c +3 -0
  119. data/vendor/libgit2/src/libgit2/refs.c +15 -6
  120. data/vendor/libgit2/src/libgit2/remote.c +4 -1
  121. data/vendor/libgit2/src/libgit2/remote.h +0 -1
  122. data/vendor/libgit2/src/libgit2/repository.c +5 -4
  123. data/vendor/libgit2/src/libgit2/settings.c +9 -0
  124. data/vendor/libgit2/src/libgit2/streams/openssl.c +4 -1
  125. data/vendor/libgit2/src/libgit2/streams/socket.c +30 -0
  126. data/vendor/libgit2/src/libgit2/submodule.c +89 -17
  127. data/vendor/libgit2/src/libgit2/tag.c +3 -1
  128. data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +2 -0
  129. data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
  130. data/vendor/libgit2/src/libgit2/transports/git.c +1 -1
  131. data/vendor/libgit2/src/libgit2/transports/http.c +4 -4
  132. data/vendor/libgit2/src/libgit2/transports/httpclient.c +12 -9
  133. data/vendor/libgit2/src/libgit2/transports/local.c +8 -1
  134. data/vendor/libgit2/src/libgit2/transports/smart.c +5 -5
  135. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +5 -4
  136. data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +57 -18
  137. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +3 -3
  138. data/vendor/libgit2/src/util/CMakeLists.txt +3 -4
  139. data/vendor/libgit2/src/util/fs_path.c +66 -6
  140. data/vendor/libgit2/src/util/fs_path.h +16 -10
  141. data/vendor/libgit2/src/util/futils.h +11 -3
  142. data/vendor/libgit2/src/util/hash/builtin.c +14 -4
  143. data/vendor/libgit2/src/util/hash/openssl.c +0 -4
  144. data/vendor/libgit2/src/util/hash/rfc6234/sha224-256.c +8 -6
  145. data/vendor/libgit2/src/util/hashmap.h +1 -0
  146. data/vendor/libgit2/src/util/net.c +5 -5
  147. data/vendor/libgit2/src/util/process.h +2 -1
  148. data/vendor/libgit2/src/util/regexp.c +27 -12
  149. data/vendor/libgit2/src/util/regexp.h +7 -2
  150. data/vendor/libgit2/src/util/runtime.c +2 -2
  151. data/vendor/libgit2/src/util/str.c +18 -6
  152. data/vendor/libgit2/src/util/str.h +5 -3
  153. data/vendor/libgit2/src/util/unix/process.c +92 -15
  154. data/vendor/libgit2/src/util/util.c +16 -3
  155. data/vendor/libgit2/src/util/util.h +1 -0
  156. data/vendor/libgit2/src/util/win32/path_w32.c +81 -5
  157. data/vendor/libgit2/src/util/win32/process.c +22 -6
  158. metadata +59 -41
  159. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -141
  160. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  161. data/vendor/libgit2/deps/pcre/LICENCE +0 -93
  162. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  163. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  164. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  165. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  166. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  167. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  168. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  169. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9815
  170. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  171. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  172. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  173. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  174. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  175. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  176. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  177. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  178. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  179. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  180. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  181. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  182. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  183. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  184. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  185. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  186. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -420
  187. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  188. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
@@ -249,9 +249,9 @@ GIT_EXTERN(const char *) git_remote_name(const git_remote *remote);
249
249
  /**
250
250
  * Get the remote's url
251
251
  *
252
- * If url.*.insteadOf has been configured for this URL, it will
253
- * return the modified URL. If `git_remote_set_instance_pushurl`
254
- * has been called for this remote, then that URL will be returned.
252
+ * If url.*.insteadOf has been configured for this URL, it will return
253
+ * the modified URL. This function does not consider if a push url has
254
+ * been configured for this remote (use `git_remote_pushurl` if needed).
255
255
  *
256
256
  * @param remote the remote
257
257
  * @return a pointer to the url
@@ -417,6 +417,19 @@ GIT_EXTERN(int) git_remote_ls(const git_remote_head ***out, size_t *size, git_r
417
417
  */
418
418
  GIT_EXTERN(int) git_remote_connected(const git_remote *remote);
419
419
 
420
+ /**
421
+ * Get the remote repository's object format.
422
+ *
423
+ * The remote (or more exactly its transport) must have connected to
424
+ * the remote repository. This format is available as soon as the
425
+ * connection to the remote is initiated and stays connected.
426
+ *
427
+ * @param out the resulting object format type
428
+ * @param remote the remote
429
+ * @return 0 on success, or an error code
430
+ */
431
+ GIT_EXTERN(int) git_remote_oid_type(git_oid_t *out, git_remote *remote);
432
+
420
433
  /**
421
434
  * Cancel the operation
422
435
  *
@@ -596,9 +609,8 @@ struct git_remote_callbacks {
596
609
  git_credential_acquire_cb credentials;
597
610
 
598
611
  /**
599
- * If cert verification fails, this will be called to let the
600
- * user make the final decision of whether to allow the
601
- * connection to proceed. Returns 0 to allow the connection
612
+ * This will be called to let the user make the final decision of whether
613
+ * to allow the connection to proceed. Returns 0 to allow the connection
602
614
  * or a negative value to indicate an error.
603
615
  */
604
616
  git_transport_certificate_check_cb certificate_check;
@@ -751,7 +763,7 @@ typedef enum {
751
763
  */
752
764
  GIT_REMOTE_DOWNLOAD_TAGS_NONE,
753
765
  /**
754
- * Ask for the all the tags.
766
+ * Ask for all the tags.
755
767
  */
756
768
  GIT_REMOTE_DOWNLOAD_TAGS_ALL
757
769
  } git_remote_autotag_option_t;
@@ -221,7 +221,7 @@ typedef uint64_t uintmax_t;
221
221
  #endif /* __STDC_LIMIT_MACROS ] */
222
222
 
223
223
 
224
- /* 7.18.4 Limits of other integer types
224
+ /* 7.18.4 Limits of other integer types */
225
225
 
226
226
  #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) /* [ See footnote 224 at page 260 */
227
227
 
@@ -206,7 +206,7 @@ GIT_EXTERN(int) git_transport_ssh_with_paths(git_transport **out, git_remote *ow
206
206
  * and git_transport_unregister with other calls to the library that
207
207
  * instantiate transports.
208
208
  *
209
- * @param prefix The scheme (ending in "://") to match, i.e. "git://"
209
+ * @param prefix The scheme to match, eg "git" or "https"
210
210
  * @param cb The callback used to create an instance of the transport
211
211
  * @param param A fixed parameter to pass to cb at creation time
212
212
  * @return 0 or an error code
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_git_version_h__
8
8
  #define INCLUDE_git_version_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  /**
11
13
  * @file git2/version.h
12
14
  * @brief The version of libgit2
@@ -19,7 +21,7 @@ GIT_BEGIN_DECL
19
21
  * The version string for libgit2. This string follows semantic
20
22
  * versioning (v2) guidelines.
21
23
  */
22
- #define LIBGIT2_VERSION "1.9.0"
24
+ #define LIBGIT2_VERSION "1.9.5"
23
25
 
24
26
  /** The major version number for this version of libgit2. */
25
27
  #define LIBGIT2_VERSION_MAJOR 1
@@ -28,7 +30,7 @@ GIT_BEGIN_DECL
28
30
  #define LIBGIT2_VERSION_MINOR 9
29
31
 
30
32
  /** The revision ("teeny") version number for this version of libgit2. */
31
- #define LIBGIT2_VERSION_REVISION 0
33
+ #define LIBGIT2_VERSION_REVISION 5
32
34
 
33
35
  /** The Windows DLL patch number for this version of libgit2. */
34
36
  #define LIBGIT2_VERSION_PATCH 0
@@ -1,9 +1,8 @@
1
1
  set(CLI_INCLUDES
2
- "${libgit2_BINARY_DIR}/src/util"
3
- "${libgit2_BINARY_DIR}/include"
4
2
  "${libgit2_SOURCE_DIR}/src/util"
5
3
  "${libgit2_SOURCE_DIR}/src/cli"
6
4
  "${libgit2_SOURCE_DIR}/include"
5
+ "${libgit2_BINARY_DIR}/gen_headers"
7
6
  "${LIBGIT2_DEPENDENCY_INCLUDES}"
8
7
  "${LIBGIT2_SYSTEM_INCLUDES}")
9
8
 
@@ -19,7 +19,7 @@
19
19
  #include <limits.h>
20
20
  #include <assert.h>
21
21
 
22
- #if defined(__sun) || defined(__illumos__)
22
+ #if defined(__sun) || defined(__illumos__) || defined(__CYGWIN__)
23
23
  # include <alloca.h>
24
24
  #endif
25
25
 
@@ -50,7 +50,7 @@ GIT_INLINE(const cli_opt_spec *) spec_for_long(
50
50
  const char *arg)
51
51
  {
52
52
  const cli_opt_spec *spec;
53
- char *eql;
53
+ const char *eql;
54
54
  size_t eql_pos;
55
55
 
56
56
  eql = strchr(arg, '=');
@@ -359,7 +359,7 @@ GIT_INLINE(const cli_opt_spec *) spec_for_sort(
359
359
  const char *arg)
360
360
  {
361
361
  int is_negated, has_value = 0;
362
- const char *value;
362
+ const char *value = NULL;
363
363
  const cli_opt_spec *spec = NULL;
364
364
  size_t idx = 0;
365
365
 
@@ -201,7 +201,7 @@ int cli_opt_help_fprint(
201
201
  {
202
202
  git_str help = GIT_BUF_INIT;
203
203
  const cli_opt_spec *spec;
204
- bool required;
204
+ bool required = true;
205
205
  int error = 0;
206
206
 
207
207
  /* Display required arguments first */
@@ -7,11 +7,10 @@ include(PkgBuildConfig)
7
7
  include(CMakePackageConfigHelpers)
8
8
 
9
9
  set(LIBGIT2_INCLUDES
10
- "${PROJECT_BINARY_DIR}/src/util"
11
- "${PROJECT_BINARY_DIR}/include"
12
10
  "${PROJECT_SOURCE_DIR}/src/libgit2"
13
11
  "${PROJECT_SOURCE_DIR}/src/util"
14
- "${PROJECT_SOURCE_DIR}/include")
12
+ "${PROJECT_SOURCE_DIR}/include"
13
+ "${PROJECT_BINARY_DIR}/gen_headers")
15
14
 
16
15
  # Collect sourcefiles
17
16
  file(GLOB SRC_H
@@ -41,7 +40,11 @@ ide_split_sources(libgit2)
41
40
  list(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:util> $<TARGET_OBJECTS:libgit2> ${LIBGIT2_DEPENDENCY_OBJECTS})
42
41
  list(APPEND LIBGIT2_INCLUDES ${LIBGIT2_DEPENDENCY_INCLUDES})
43
42
 
44
- target_include_directories(libgit2 PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES} PUBLIC ${PROJECT_SOURCE_DIR}/include)
43
+ target_include_directories(libgit2
44
+ PRIVATE ${LIBGIT2_INCLUDES} ${LIBGIT2_DEPENDENCY_INCLUDES}
45
+ PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
46
+ $<INSTALL_INTERFACE:include>)
47
+
45
48
  target_include_directories(libgit2 SYSTEM PRIVATE ${LIBGIT2_SYSTEM_INCLUDES})
46
49
 
47
50
  set(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE)
@@ -55,10 +58,16 @@ set(LIBGIT2_SYSTEM_LIBS ${LIBGIT2_SYSTEM_LIBS} PARENT_SCOPE)
55
58
  # Compile and link libgit2
56
59
  #
57
60
 
61
+ if (NOT BUILD_SHARED_LIBS AND XCODE_VERSION)
62
+ # This is required for Xcode to actually create the static libgit2 library
63
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.c "")
64
+ list(APPEND LIBGIT2_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.c)
65
+ endif()
66
+
58
67
  add_library(libgit2package ${SRC_RC} ${LIBGIT2_OBJECTS})
59
68
  target_link_libraries(libgit2package ${LIBGIT2_SYSTEM_LIBS})
60
69
  target_include_directories(libgit2package SYSTEM PRIVATE ${LIBGIT2_INCLUDES})
61
- target_include_directories(libgit2package INTERFACE $<INSTALL_INTERFACE:./include/git2>)
70
+ target_include_directories(libgit2package INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
62
71
 
63
72
  set_target_properties(libgit2package PROPERTIES C_STANDARD 90)
64
73
  set_target_properties(libgit2package PROPERTIES C_EXTENSIONS OFF)
@@ -94,14 +103,23 @@ endif()
94
103
 
95
104
  # support experimental features and functionality
96
105
 
97
- configure_file(experimental.h.in "${PROJECT_BINARY_DIR}/include/git2/experimental.h")
106
+ configure_file(experimental.h.in "${PROJECT_BINARY_DIR}/gen_headers/experimental.h")
98
107
 
99
- # translate filenames in the git2.h so that they match the install directory
108
+ # translate filenames in the headers so that they match the install directory
100
109
  # (allows for side-by-side installs of libgit2 and libgit2-experimental.)
101
110
 
102
- FILE(READ "${PROJECT_SOURCE_DIR}/include/git2.h" LIBGIT2_INCLUDE)
103
- STRING(REGEX REPLACE "#include \"git2\/" "#include \"${LIBGIT2_FILENAME}/" LIBGIT2_INCLUDE "${LIBGIT2_INCLUDE}")
104
- FILE(WRITE "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}.h" ${LIBGIT2_INCLUDE})
111
+ foreach(HEADER_SOURCE ${SRC_H})
112
+ file(RELATIVE_PATH HEADER_RELATIVE ${PROJECT_SOURCE_DIR} ${HEADER_SOURCE})
113
+ string(REGEX REPLACE "^include\/git2" "include/${LIBGIT2_FILENAME}" HEADER_RELATIVE ${HEADER_RELATIVE})
114
+
115
+ file(READ "${HEADER_SOURCE}" HEADER_CONTENTS)
116
+ string(REGEX REPLACE "#include \"git2\/" "#include \"${LIBGIT2_FILENAME}/" HEADER_CONTENTS "${HEADER_CONTENTS}")
117
+
118
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${HEADER_RELATIVE}.tmp" "${HEADER_CONTENTS}")
119
+ configure_file("${CMAKE_CURRENT_BINARY_DIR}/${HEADER_RELATIVE}.tmp" "${PROJECT_BINARY_DIR}/${HEADER_RELATIVE}" COPYONLY)
120
+ endforeach()
121
+
122
+ configure_file("${PROJECT_BINARY_DIR}/gen_headers/experimental.h" "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}/experimental.h" COPYONLY)
105
123
 
106
124
  # cmake package targets
107
125
 
@@ -119,11 +137,11 @@ configure_file(config.cmake.in
119
137
  install(FILES
120
138
  "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake"
121
139
  "${PROJECT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake"
122
- DESTINATION "lib/cmake/${PROJECT_NAME}")
140
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
123
141
  install(
124
142
  EXPORT ${LIBGIT2_TARGETS_EXPORT_NAME}
125
143
  NAMESPACE "${PROJECT_NAME}::"
126
- DESTINATION "lib/cmake/${PROJECT_NAME}")
144
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
127
145
 
128
146
  # Install
129
147
 
@@ -132,9 +150,7 @@ install(TARGETS libgit2package
132
150
  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
133
151
  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
134
152
  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
135
- install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2/
136
- DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
137
- install(FILES ${PROJECT_BINARY_DIR}/include/git2/experimental.h
138
- DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
139
153
  install(FILES "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}.h"
140
154
  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
155
+ install(DIRECTORY "${PROJECT_BINARY_DIR}/include/${LIBGIT2_FILENAME}"
156
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
@@ -347,7 +347,7 @@ int git_attr_file__parse_buffer(
347
347
  {
348
348
  const char *scan = data, *context = NULL;
349
349
  git_attr_rule *rule = NULL;
350
- int error = 0;
350
+ int ignorecase = 0, error = 0;
351
351
 
352
352
  /* If subdir file path, convert context for file paths */
353
353
  if (attrs->entry && git_fs_path_root(attrs->entry->path) < 0 &&
@@ -379,6 +379,13 @@ int git_attr_file__parse_buffer(
379
379
  continue;
380
380
  }
381
381
 
382
+ if (repo &&
383
+ (error = git_repository__configmap_lookup(&ignorecase, repo, GIT_CONFIGMAP_IGNORECASE)) < 0)
384
+ goto out;
385
+
386
+ if (ignorecase)
387
+ rule->match.flags |= GIT_ATTR_FNMATCH_ICASE;
388
+
382
389
  if (rule->match.flags & GIT_ATTR_FNMATCH_MACRO) {
383
390
  /* TODO: warning if macro found in file below repo root */
384
391
  if (!allow_macros)
@@ -482,7 +489,7 @@ bool git_attr_fnmatch__match(
482
489
  */
483
490
  if (match->containing_dir) {
484
491
  if (match->flags & GIT_ATTR_FNMATCH_ICASE) {
485
- if (git__strncasecmp(path->path, match->containing_dir, match->containing_dir_length))
492
+ if (git__prefixcmp_icase(path->path, match->containing_dir))
486
493
  return 0;
487
494
  } else {
488
495
  if (git__prefixcmp(path->path, match->containing_dir))
@@ -804,7 +811,7 @@ int git_attr_fnmatch__parse(
804
811
  }
805
812
 
806
813
  if (context) {
807
- char *slash = strrchr(context, '/');
814
+ const char *slash = strrchr(context, '/');
808
815
  size_t len;
809
816
  if (slash) {
810
817
  /* include the slash for easier matching */
@@ -461,6 +461,12 @@ static int blame_internal(git_blame *blame)
461
461
 
462
462
  for (ent = blame->ent; ent; ent = ent->next) {
463
463
  git_blame_hunk *h = hunk_from_entry(ent, blame);
464
+
465
+ if (!h) {
466
+ error = -1;
467
+ goto on_error;
468
+ }
469
+
464
470
  git_vector_insert(&blame->hunks, h);
465
471
  }
466
472
 
@@ -519,6 +519,12 @@ static int clone_local_into(
519
519
  return error;
520
520
  }
521
521
 
522
+ /* Propagate the source repository's object format to the target
523
+ * so that it can read the copied object database. */
524
+ if ((error = git_repository__set_objectformat(
525
+ repo, git_repository_oid_type(src))) < 0)
526
+ goto cleanup;
527
+
522
528
  if (git_repository__item_path(&src_odb, src, GIT_REPOSITORY_ITEM_OBJECTS) < 0 ||
523
529
  git_repository__item_path(&dst_odb, repo, GIT_REPOSITORY_ITEM_OBJECTS) < 0) {
524
530
  error = -1;
@@ -340,7 +340,7 @@ int git_commit_amend(
340
340
  {
341
341
  git_repository *repo;
342
342
  git_oid tree_id;
343
- git_reference *ref;
343
+ git_reference *ref = NULL;
344
344
  int error;
345
345
 
346
346
  GIT_ASSERT_ARG(id);
@@ -817,8 +817,7 @@ int git_commit_graph_writer_add_index_file(
817
817
  if (error < 0)
818
818
  goto cleanup;
819
819
 
820
- /* TODO: SHA256 */
821
- error = git_mwindow_get_pack(&p, idx_path, 0);
820
+ error = git_mwindow_get_pack(&p, idx_path, repo->oid_type);
822
821
  if (error < 0)
823
822
  goto cleanup;
824
823
 
@@ -1447,7 +1447,7 @@ int git_config_parse_bool(int *out, const char *value)
1447
1447
  return 0;
1448
1448
  }
1449
1449
 
1450
- git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a boolean value", value);
1450
+ git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a boolean", value ? value : "(null)");
1451
1451
  return -1;
1452
1452
  }
1453
1453
 
@@ -1135,7 +1135,8 @@ static int config_file_write(
1135
1135
  const char *value)
1136
1136
 
1137
1137
  {
1138
- char *orig_section = NULL, *section = NULL, *orig_name, *name, *ldot;
1138
+ char *orig_section = NULL, *section = NULL;
1139
+ const char *orig_name, *name, *ldot;
1139
1140
  git_str buf = GIT_STR_INIT, contents = GIT_STR_INIT;
1140
1141
  git_config_parser parser = GIT_CONFIG_PARSER_INIT;
1141
1142
  git_filebuf file = GIT_FILEBUF_INIT;
@@ -199,6 +199,7 @@ static int config_memory_get(git_config_backend *backend, const char *key, git_c
199
199
  if ((error = git_config_list_get(&entry, memory_backend->config_list, key)) != 0)
200
200
  return error;
201
201
 
202
+ git_config_list_incref(memory_backend->config_list);
202
203
  *out = &entry->base;
203
204
  return 0;
204
205
  }
@@ -282,7 +282,8 @@ static int skip_bom(git_parse_ctx *parser)
282
282
  /* '\"' -> '"' etc */
283
283
  static int unescape_line(char **out, bool *is_multi, const char *ptr, int *quote_count)
284
284
  {
285
- char *str, *fixed, *esc;
285
+ char *str, *fixed;
286
+ const char *esc;
286
287
  size_t ptr_len = strlen(ptr), alloc_len;
287
288
 
288
289
  *is_multi = false;
@@ -13,6 +13,8 @@
13
13
  #define RABIN_SHIFT 23
14
14
  #define RABIN_WINDOW 16
15
15
 
16
+ extern size_t git_indexer__max_object_size;
17
+
16
18
  static const unsigned int T[256] = {
17
19
  0x00000000, 0xab59b4d1, 0x56b369a2, 0xfdeadd73, 0x063f6795, 0xad66d344,
18
20
  0x508c0e37, 0xfbd5bae6, 0x0c7ecf2a, 0xa7277bfb, 0x5acda688, 0xf1941259,
@@ -477,8 +479,12 @@ static int hdr_sz(
477
479
  return -1;
478
480
  }
479
481
 
482
+ if (shift >= (sizeof(size_t) * 8)) {
483
+ git_error_set(GIT_ERROR_INVALID, "delta header overflow");
484
+ return -1;
485
+ }
480
486
  c = *d++;
481
- r |= (c & 0x7f) << shift;
487
+ r |= ((size_t)(c & 0x7f)) << shift;
482
488
  shift += 7;
483
489
  } while (c & 0x80);
484
490
  *delta = d;
@@ -561,6 +567,12 @@ int git_delta_apply(
561
567
  return -1;
562
568
  }
563
569
 
570
+ if (res_sz > git_indexer__max_object_size) {
571
+ git_error_set(GIT_ERROR_INVALID,
572
+ "failed to apply delta: overly large object");
573
+ return -1;
574
+ }
575
+
564
576
  GIT_ERROR_CHECK_ALLOC_ADD(&alloc_sz, res_sz, 1);
565
577
  res_dp = git__malloc(alloc_sz);
566
578
  GIT_ERROR_CHECK_ALLOC(res_dp);
@@ -225,7 +225,7 @@ static int git_diff_driver_load(
225
225
  {
226
226
  int error = 0;
227
227
  git_diff_driver_registry *reg;
228
- git_diff_driver *drv;
228
+ git_diff_driver *drv = NULL;
229
229
  size_t namelen;
230
230
  git_config *cfg = NULL;
231
231
  git_str name = GIT_STR_INIT;
@@ -28,7 +28,6 @@ struct git_diff_stats {
28
28
  size_t files_changed;
29
29
  size_t insertions;
30
30
  size_t deletions;
31
- size_t renames;
32
31
 
33
32
  size_t max_name;
34
33
  size_t max_filestat;
@@ -68,17 +67,19 @@ static int diff_file_stats_full_to_buf(
68
67
  size_t common_dirlen;
69
68
  int error;
70
69
 
71
- padding = stats->max_name - strlen(old_path) - strlen(new_path);
72
-
73
70
  if ((common_dirlen = git_fs_path_common_dirlen(old_path, new_path)) &&
74
71
  common_dirlen <= INT_MAX) {
75
72
  error = git_str_printf(out, " %.*s{%s"DIFF_RENAME_FILE_SEPARATOR"%s}",
76
73
  (int) common_dirlen, old_path,
77
74
  old_path + common_dirlen,
78
75
  new_path + common_dirlen);
76
+ padding = stats->max_name + common_dirlen - strlen(old_path)
77
+ - strlen(new_path) - 2 - strlen(DIFF_RENAME_FILE_SEPARATOR);
79
78
  } else {
80
79
  error = git_str_printf(out, " %s" DIFF_RENAME_FILE_SEPARATOR "%s",
81
80
  old_path, new_path);
81
+ padding = stats->max_name - strlen(old_path)
82
+ - strlen(new_path) - strlen(DIFF_RENAME_FILE_SEPARATOR);
82
83
  }
83
84
 
84
85
  if (error < 0)
@@ -89,9 +90,6 @@ static int diff_file_stats_full_to_buf(
89
90
  goto on_error;
90
91
 
91
92
  padding = stats->max_name - strlen(adddel_path);
92
-
93
- if (stats->renames > 0)
94
- padding += strlen(DIFF_RENAME_FILE_SEPARATOR);
95
93
  }
96
94
 
97
95
  if (git_str_putcn(out, ' ', padding) < 0 ||
@@ -210,14 +208,23 @@ int git_diff_get_stats(
210
208
  if ((error = git_patch_from_diff(&patch, diff, i)) < 0)
211
209
  break;
212
210
 
213
- /* keep a count of renames because it will affect formatting */
211
+ /* Length calculation for renames mirrors the actual presentation format
212
+ * generated in diff_file_stats_full_to_buf; namelen is the full length of
213
+ * what will be printed, taking into account renames and common prefixes.
214
+ */
214
215
  delta = patch->delta;
215
-
216
- /* TODO ugh */
217
216
  namelen = strlen(delta->new_file.path);
218
- if (delta->old_file.path && strcmp(delta->old_file.path, delta->new_file.path) != 0) {
219
- namelen += strlen(delta->old_file.path);
220
- stats->renames++;
217
+ if (delta->old_file.path &&
218
+ strcmp(delta->old_file.path, delta->new_file.path) != 0) {
219
+ size_t common_dirlen;
220
+ if ((common_dirlen = git_fs_path_common_dirlen(delta->old_file.path, delta->new_file.path)) &&
221
+ common_dirlen <= INT_MAX) {
222
+ namelen += strlen(delta->old_file.path) + 2 +
223
+ strlen(DIFF_RENAME_FILE_SEPARATOR) - common_dirlen;
224
+ } else {
225
+ namelen += strlen(delta->old_file.path) +
226
+ strlen(DIFF_RENAME_FILE_SEPARATOR);
227
+ }
221
228
  }
222
229
 
223
230
  /* and, of course, count the line stats */
@@ -106,7 +106,7 @@ static int fetchhead_ref_write(
106
106
  git_fetchhead_ref *fetchhead_ref)
107
107
  {
108
108
  char oid[GIT_OID_MAX_HEXSIZE + 1];
109
- const char *type, *name;
109
+ const char *type = NULL, *name = NULL;
110
110
  int head = 0;
111
111
 
112
112
  GIT_ASSERT_ARG(file);
@@ -1225,7 +1225,7 @@ static int canonicalize_directory_path(
1225
1225
  {
1226
1226
  const git_index_entry *match, *best = NULL;
1227
1227
  char *search, *sep;
1228
- size_t pos, search_len, best_len;
1228
+ size_t pos, search_len, best_len = 0;
1229
1229
 
1230
1230
  if (!index->ignore_case)
1231
1231
  return 0;
@@ -1448,7 +1448,7 @@ out:
1448
1448
  return error;
1449
1449
  }
1450
1450
 
1451
- static int index_conflict_to_reuc(git_index *index, const char *path)
1451
+ int git_index__conflict_to_reuc(git_index *index, const char *path)
1452
1452
  {
1453
1453
  const git_index_entry *conflict_entries[3];
1454
1454
  int ancestor_mode, our_mode, their_mode;
@@ -1528,7 +1528,7 @@ int git_index_add_from_buffer(
1528
1528
  return error;
1529
1529
 
1530
1530
  /* Adding implies conflict was resolved, move conflict entries to REUC */
1531
- if ((error = index_conflict_to_reuc(index, entry->path)) < 0 && error != GIT_ENOTFOUND)
1531
+ if ((error = git_index__conflict_to_reuc(index, entry->path)) < 0 && error != GIT_ENOTFOUND)
1532
1532
  return error;
1533
1533
 
1534
1534
  git_tree_cache_invalidate_path(index->tree, entry->path);
@@ -1624,7 +1624,7 @@ int git_index_add_bypath(git_index *index, const char *path)
1624
1624
  }
1625
1625
 
1626
1626
  /* Adding implies conflict was resolved, move conflict entries to REUC */
1627
- if ((ret = index_conflict_to_reuc(index, path)) < 0 && ret != GIT_ENOTFOUND)
1627
+ if ((ret = git_index__conflict_to_reuc(index, path)) < 0 && ret != GIT_ENOTFOUND)
1628
1628
  return ret;
1629
1629
 
1630
1630
  git_tree_cache_invalidate_path(index->tree, entry->path);
@@ -1640,7 +1640,7 @@ int git_index_remove_bypath(git_index *index, const char *path)
1640
1640
 
1641
1641
  if (((ret = git_index_remove(index, path, 0)) < 0 &&
1642
1642
  ret != GIT_ENOTFOUND) ||
1643
- ((ret = index_conflict_to_reuc(index, path)) < 0 &&
1643
+ ((ret = git_index__conflict_to_reuc(index, path)) < 0 &&
1644
1644
  ret != GIT_ENOTFOUND))
1645
1645
  return ret;
1646
1646
 
@@ -2525,7 +2525,7 @@ static int read_entry(
2525
2525
  {
2526
2526
  size_t path_length, path_offset, entry_size;
2527
2527
  const char *path_ptr;
2528
- struct entry_common *source_common;
2528
+ struct entry_common *source_common = NULL;
2529
2529
  index_entry_short_sha1 source_sha1;
2530
2530
  #ifdef GIT_EXPERIMENTAL_SHA256
2531
2531
  index_entry_short_sha256 source_sha256;
@@ -2877,7 +2877,7 @@ static int write_disk_entry(
2877
2877
  const char *last)
2878
2878
  {
2879
2879
  void *mem = NULL;
2880
- struct entry_common *ondisk_common;
2880
+ struct entry_common *ondisk_common = NULL;
2881
2881
  size_t path_len, path_offset, disk_size;
2882
2882
  int varint_len = 0;
2883
2883
  char *path;
@@ -2966,7 +2966,7 @@ static int write_disk_entry(
2966
2966
  path_offset = index_entry_path_offset(index->oid_type, entry->flags);
2967
2967
 
2968
2968
  if (entry->flags & GIT_INDEX_ENTRY_EXTENDED) {
2969
- struct entry_common *ondisk_ext;
2969
+ struct entry_common *ondisk_ext = NULL;
2970
2970
  uint16_t flags_extended = htons(entry->flags_extended &
2971
2971
  GIT_INDEX_ENTRY_EXTENDED_FLAGS);
2972
2972
 
@@ -154,6 +154,9 @@ extern int git_index__open(
154
154
  const char *index_path,
155
155
  git_oid_t oid_type);
156
156
 
157
+ /* If the path is conflicted, move it from the index to reuc. */
158
+ int git_index__conflict_to_reuc(git_index *index, const char *path);
159
+
157
160
  /* Copy the current entries vector *and* increment the index refcount.
158
161
  * Call `git_index__release_snapshot` when done.
159
162
  */
@@ -24,10 +24,11 @@
24
24
  #include "object.h"
25
25
  #include "hashmap_oid.h"
26
26
 
27
- size_t git_indexer__max_objects = UINT32_MAX;
28
-
29
27
  #define UINT31_MAX (0x7FFFFFFF)
30
28
 
29
+ size_t git_indexer__max_objects = UINT32_MAX;
30
+ size_t git_indexer__max_object_size = UINT31_MAX;
31
+
31
32
  GIT_HASHMAP_OID_SETUP(git_indexer_oidmap, git_oid *);
32
33
 
33
34
  struct entry {
@@ -921,12 +922,12 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_inde
921
922
  if (git_vector_init(&idx->deltas, total_objects / 2, NULL) < 0)
922
923
  return -1;
923
924
 
925
+ stats->total_objects = total_objects;
926
+ stats->indexed_objects = 0;
924
927
  stats->received_objects = 0;
925
928
  stats->local_objects = 0;
926
929
  stats->total_deltas = 0;
927
930
  stats->indexed_deltas = 0;
928
- stats->indexed_objects = 0;
929
- stats->total_objects = total_objects;
930
931
 
931
932
  if ((error = do_progress_callback(idx, stats)) != 0)
932
933
  return error;
@@ -936,7 +936,7 @@ static int merge_conflict_resolve_contents(
936
936
  git_merge_file_result result = {0};
937
937
  git_merge_driver *driver;
938
938
  git_merge_driver__builtin builtin = {{0}};
939
- git_index_entry *merge_result;
939
+ git_index_entry *merge_result = NULL;
940
940
  git_odb *odb = NULL;
941
941
  const char *name;
942
942
  bool fallback = false;
@@ -165,6 +165,10 @@ GIT_INLINE(const char *) git_merge_file__best_path(
165
165
  if (!ancestor) {
166
166
  if (ours && theirs && strcmp(ours, theirs) == 0)
167
167
  return ours;
168
+ if (ours && !theirs)
169
+ return ours;
170
+ if (theirs && !ours)
171
+ return theirs;
168
172
 
169
173
  return NULL;
170
174
  }