rugged 0.27.5 → 0.27.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/CMakeLists.txt +2 -2
  4. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
  5. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
  6. data/vendor/libgit2/include/git2.h +1 -0
  7. data/vendor/libgit2/include/git2/attr.h +18 -7
  8. data/vendor/libgit2/include/git2/blame.h +39 -22
  9. data/vendor/libgit2/include/git2/blob.h +1 -1
  10. data/vendor/libgit2/include/git2/branch.h +1 -1
  11. data/vendor/libgit2/include/git2/buffer.h +14 -2
  12. data/vendor/libgit2/include/git2/checkout.h +13 -12
  13. data/vendor/libgit2/include/git2/cherrypick.h +6 -4
  14. data/vendor/libgit2/include/git2/clone.h +8 -6
  15. data/vendor/libgit2/include/git2/commit.h +28 -0
  16. data/vendor/libgit2/include/git2/common.h +27 -0
  17. data/vendor/libgit2/include/git2/config.h +1 -0
  18. data/vendor/libgit2/include/git2/describe.h +30 -7
  19. data/vendor/libgit2/include/git2/diff.h +32 -22
  20. data/vendor/libgit2/include/git2/errors.h +1 -0
  21. data/vendor/libgit2/include/git2/ignore.h +2 -2
  22. data/vendor/libgit2/include/git2/mailmap.h +115 -0
  23. data/vendor/libgit2/include/git2/merge.h +10 -8
  24. data/vendor/libgit2/include/git2/proxy.h +9 -5
  25. data/vendor/libgit2/include/git2/rebase.h +7 -4
  26. data/vendor/libgit2/include/git2/refspec.h +17 -0
  27. data/vendor/libgit2/include/git2/remote.h +12 -10
  28. data/vendor/libgit2/include/git2/repository.h +7 -5
  29. data/vendor/libgit2/include/git2/revert.h +5 -3
  30. data/vendor/libgit2/include/git2/stash.h +11 -8
  31. data/vendor/libgit2/include/git2/status.h +7 -3
  32. data/vendor/libgit2/include/git2/submodule.h +8 -7
  33. data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
  34. data/vendor/libgit2/include/git2/sys/index.h +3 -0
  35. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  36. data/vendor/libgit2/include/git2/sys/merge.h +6 -1
  37. data/vendor/libgit2/include/git2/sys/path.h +55 -0
  38. data/vendor/libgit2/include/git2/transaction.h +1 -0
  39. data/vendor/libgit2/include/git2/types.h +8 -5
  40. data/vendor/libgit2/include/git2/version.h +2 -2
  41. data/vendor/libgit2/include/git2/worktree.h +46 -11
  42. data/vendor/libgit2/src/CMakeLists.txt +87 -15
  43. data/vendor/libgit2/src/alloc.c +47 -0
  44. data/vendor/libgit2/src/alloc.h +40 -0
  45. data/vendor/libgit2/src/apply.c +4 -4
  46. data/vendor/libgit2/src/attr.c +4 -4
  47. data/vendor/libgit2/src/attr_file.c +8 -7
  48. data/vendor/libgit2/src/attrcache.c +2 -2
  49. data/vendor/libgit2/src/blame.c +11 -4
  50. data/vendor/libgit2/src/blame.h +1 -0
  51. data/vendor/libgit2/src/blame_git.c +8 -5
  52. data/vendor/libgit2/src/blob.c +5 -5
  53. data/vendor/libgit2/src/branch.c +20 -20
  54. data/vendor/libgit2/src/buffer.c +9 -4
  55. data/vendor/libgit2/src/buffer.h +1 -1
  56. data/vendor/libgit2/src/checkout.c +33 -24
  57. data/vendor/libgit2/src/cherrypick.c +3 -3
  58. data/vendor/libgit2/src/clone.c +13 -13
  59. data/vendor/libgit2/src/commit.c +16 -3
  60. data/vendor/libgit2/src/common.h +3 -1
  61. data/vendor/libgit2/src/config.c +3 -3
  62. data/vendor/libgit2/src/config_file.c +193 -241
  63. data/vendor/libgit2/src/config_parse.c +89 -66
  64. data/vendor/libgit2/src/config_parse.h +2 -2
  65. data/vendor/libgit2/src/crlf.c +9 -3
  66. data/vendor/libgit2/src/diff.c +2 -2
  67. data/vendor/libgit2/src/diff_driver.c +3 -3
  68. data/vendor/libgit2/src/diff_file.c +3 -3
  69. data/vendor/libgit2/src/diff_generate.c +4 -3
  70. data/vendor/libgit2/src/diff_print.c +8 -8
  71. data/vendor/libgit2/src/diff_tform.c +1 -1
  72. data/vendor/libgit2/src/diff_xdiff.c +12 -0
  73. data/vendor/libgit2/src/features.h.in +2 -0
  74. data/vendor/libgit2/src/fetch.c +2 -2
  75. data/vendor/libgit2/src/fetchhead.c +5 -5
  76. data/vendor/libgit2/src/filebuf.c +4 -4
  77. data/vendor/libgit2/src/fileops.c +10 -10
  78. data/vendor/libgit2/src/filter.c +3 -3
  79. data/vendor/libgit2/src/global.c +17 -12
  80. data/vendor/libgit2/src/hash.h +2 -0
  81. data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
  82. data/vendor/libgit2/src/hash/hash_mbedtls.h +20 -0
  83. data/vendor/libgit2/src/ignore.c +15 -20
  84. data/vendor/libgit2/src/index.c +77 -36
  85. data/vendor/libgit2/src/index.h +10 -0
  86. data/vendor/libgit2/src/indexer.c +9 -9
  87. data/vendor/libgit2/src/iterator.c +8 -8
  88. data/vendor/libgit2/src/khash.h +3 -1
  89. data/vendor/libgit2/src/mailmap.c +485 -0
  90. data/vendor/libgit2/src/mailmap.h +35 -0
  91. data/vendor/libgit2/src/merge.c +7 -7
  92. data/vendor/libgit2/src/netops.c +5 -5
  93. data/vendor/libgit2/src/notes.c +2 -2
  94. data/vendor/libgit2/src/odb.c +7 -7
  95. data/vendor/libgit2/src/odb_loose.c +13 -13
  96. data/vendor/libgit2/src/odb_pack.c +3 -3
  97. data/vendor/libgit2/src/pack-objects.c +2 -2
  98. data/vendor/libgit2/src/pack.c +5 -5
  99. data/vendor/libgit2/src/pack.h +1 -1
  100. data/vendor/libgit2/src/patch.c +1 -1
  101. data/vendor/libgit2/src/patch_generate.c +2 -2
  102. data/vendor/libgit2/src/patch_parse.c +11 -4
  103. data/vendor/libgit2/src/path.c +42 -66
  104. data/vendor/libgit2/src/path.h +2 -72
  105. data/vendor/libgit2/src/pathspec.c +1 -1
  106. data/vendor/libgit2/src/push.c +2 -2
  107. data/vendor/libgit2/src/rebase.c +19 -22
  108. data/vendor/libgit2/src/refdb_fs.c +65 -34
  109. data/vendor/libgit2/src/refs.c +6 -6
  110. data/vendor/libgit2/src/refspec.c +30 -5
  111. data/vendor/libgit2/src/refspec.h +1 -1
  112. data/vendor/libgit2/src/remote.c +40 -40
  113. data/vendor/libgit2/src/repository.c +63 -59
  114. data/vendor/libgit2/src/reset.c +1 -1
  115. data/vendor/libgit2/src/revert.c +3 -3
  116. data/vendor/libgit2/src/revparse.c +4 -4
  117. data/vendor/libgit2/src/revwalk.c +44 -10
  118. data/vendor/libgit2/src/revwalk.h +2 -1
  119. data/vendor/libgit2/src/settings.c +25 -1
  120. data/vendor/libgit2/src/signature.c +1 -1
  121. data/vendor/libgit2/src/stash.c +80 -34
  122. data/vendor/libgit2/src/status.c +1 -1
  123. data/vendor/libgit2/src/stdalloc.c +120 -0
  124. data/vendor/libgit2/src/stdalloc.h +17 -0
  125. data/vendor/libgit2/src/streams/mbedtls.c +463 -0
  126. data/vendor/libgit2/src/streams/mbedtls.h +20 -0
  127. data/vendor/libgit2/src/streams/openssl.c +132 -34
  128. data/vendor/libgit2/src/streams/openssl.h +0 -107
  129. data/vendor/libgit2/src/streams/tls.c +3 -0
  130. data/vendor/libgit2/src/submodule.c +117 -82
  131. data/vendor/libgit2/src/sysdir.c +4 -4
  132. data/vendor/libgit2/src/tag.c +7 -7
  133. data/vendor/libgit2/src/trace.h +1 -1
  134. data/vendor/libgit2/src/trailer.c +6 -6
  135. data/vendor/libgit2/src/transport.c +2 -2
  136. data/vendor/libgit2/src/transports/auth.c +1 -1
  137. data/vendor/libgit2/src/transports/auth_negotiate.c +2 -2
  138. data/vendor/libgit2/src/transports/git.c +1 -1
  139. data/vendor/libgit2/src/transports/http.c +12 -12
  140. data/vendor/libgit2/src/transports/local.c +7 -7
  141. data/vendor/libgit2/src/transports/smart.c +17 -8
  142. data/vendor/libgit2/src/transports/smart.h +5 -5
  143. data/vendor/libgit2/src/transports/smart_pkt.c +122 -130
  144. data/vendor/libgit2/src/transports/smart_protocol.c +48 -38
  145. data/vendor/libgit2/src/transports/ssh.c +1 -1
  146. data/vendor/libgit2/src/transports/winhttp.c +6 -6
  147. data/vendor/libgit2/src/tree.c +12 -53
  148. data/vendor/libgit2/src/tree.h +0 -12
  149. data/vendor/libgit2/src/util.c +16 -0
  150. data/vendor/libgit2/src/util.h +12 -135
  151. data/vendor/libgit2/src/win32/findfile.c +2 -2
  152. data/vendor/libgit2/src/win32/posix_w32.c +1 -1
  153. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +94 -0
  154. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
  155. data/vendor/libgit2/src/worktree.c +64 -43
  156. data/vendor/libgit2/src/worktree.h +2 -0
  157. data/vendor/libgit2/src/xdiff/xdiffi.c +3 -1
  158. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38cf39184ada925f1c17a76c4b9c23390f10e983360a2383243cf01e915c0352
4
- data.tar.gz: 76e02389e381e6efca72089dce787260bdb6b869f7fb201c3c1f5000d6f3453b
3
+ metadata.gz: ff10e024463517713720e2d4e8ea45634f6960c3fe0f5f2aa6e3dd653b271c6d
4
+ data.tar.gz: 359d2509194e1c6841fac18cfca3fd94ae4e23285da330ce7e94405d41e0c5f5
5
5
  SHA512:
6
- metadata.gz: 2332a9d8d33f3b873ccd9de0949185589925ea22449d79ccc7c03230e54216beaf99032420dad85086e313f5d5225739b26f322392fb1370e66c3c1e3f8e4487
7
- data.tar.gz: a8748762ade17561d1548da2c90bbc02e9da4bf1703a4e984d678dd6944fc1feff74e51f9921d016e7c3abc2f413e6bc07bda798feea04a5d1b549eb78869030
6
+ metadata.gz: 1e20fdce0243b2fb693702bfda14459813fabae492f1884f477ab2e6070e715e112eee09c210daee609bb51402cb45bb2d5a096512789070bdba3938343a799e
7
+ data.tar.gz: f4fca979a4d7d027a1f79c40a350d54776e0d659dba531e65a6677f335295c3209f5c55e903639b3bdb33dbc4f1c9be12f8f3b1d8990303ace013e603c558d2a
@@ -4,5 +4,5 @@
4
4
  # For full terms see the included LICENSE file.
5
5
 
6
6
  module Rugged
7
- Version = VERSION = '0.27.5'
7
+ Version = VERSION = '0.27.7'
8
8
  end
@@ -48,7 +48,7 @@ OPTION( PROFILE "Generate profiling information" OFF )
48
48
  OPTION( ENABLE_TRACE "Enables tracing support" OFF )
49
49
  OPTION( LIBGIT2_FILENAME "Name of the produced binary" OFF )
50
50
 
51
- SET(SHA1_BACKEND "CollisionDetection" CACHE STRING "Backend to use for SHA1. One of Generic, OpenSSL, Win32, CommonCrypto, CollisionDetection. ")
51
+ SET(SHA1_BACKEND "CollisionDetection" CACHE STRING "Backend to use for SHA1. One of Generic, OpenSSL, Win32, CommonCrypto, mbedTLS, CollisionDetection. ")
52
52
  OPTION( USE_SSH "Link with libssh to enable SSH support" ON )
53
53
  OPTION( USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON )
54
54
  OPTION( USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF )
@@ -196,7 +196,7 @@ ELSE ()
196
196
  ENABLE_WARNINGS(extra)
197
197
 
198
198
  IF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
199
- SET(CMAKE_C_FLAGS "-std=c99 -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS ${CMAKE_C_FLAGS}")
199
+ SET(CMAKE_C_FLAGS "-D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS ${CMAKE_C_FLAGS}")
200
200
  ENDIF()
201
201
 
202
202
  SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O0")
@@ -0,0 +1,93 @@
1
+ # - Try to find mbedTLS
2
+ # Once done this will define
3
+ #
4
+ # Read-Only variables
5
+ # MBEDTLS_FOUND - system has mbedTLS
6
+ # MBEDTLS_INCLUDE_DIR - the mbedTLS include directory
7
+ # MBEDTLS_LIBRARY_DIR - the mbedTLS library directory
8
+ # MBEDTLS_LIBRARIES - Link these to use mbedTLS
9
+ # MBEDTLS_LIBRARY - path to mbedTLS library
10
+ # MBEDX509_LIBRARY - path to mbedTLS X.509 library
11
+ # MBEDCRYPTO_LIBRARY - path to mbedTLS Crypto library
12
+ #
13
+ # Hint
14
+ # MBEDTLS_ROOT_DIR can be pointed to a local mbedTLS installation.
15
+
16
+ SET(_MBEDTLS_ROOT_HINTS
17
+ ${MBEDTLS_ROOT_DIR}
18
+ ENV MBEDTLS_ROOT_DIR
19
+ )
20
+
21
+ SET(_MBEDTLS_ROOT_HINTS_AND_PATHS
22
+ HINTS ${_MBEDTLS_ROOT_HINTS}
23
+ PATHS ${_MBEDTLS_ROOT_PATHS}
24
+ )
25
+
26
+ FIND_PATH(MBEDTLS_INCLUDE_DIR
27
+ NAMES mbedtls/version.h
28
+ ${_MBEDTLS_ROOT_HINTS_AND_PATHS}
29
+ PATH_SUFFIXES include
30
+ )
31
+
32
+ IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES)
33
+ # Already in cache, be silent
34
+ SET(MBEDTLS_FIND_QUIETLY TRUE)
35
+ ENDIF()
36
+
37
+ FIND_LIBRARY(MBEDTLS_LIBRARY
38
+ NAMES mbedtls libmbedtls
39
+ ${_MBEDTLS_ROOT_HINTS_AND_PATHS}
40
+ PATH_SUFFIXES library
41
+ )
42
+ FIND_LIBRARY(MBEDX509_LIBRARY
43
+ NAMES mbedx509 libmbedx509
44
+ ${_MBEDTLS_ROOT_HINTS_AND_PATHS}
45
+ PATH_SUFFIXES library
46
+ )
47
+ FIND_LIBRARY(MBEDCRYPTO_LIBRARY
48
+ NAMES mbedcrypto libmbedcrypto
49
+ ${_MBEDTLS_ROOT_HINTS_AND_PATHS}
50
+ PATH_SUFFIXES library
51
+ )
52
+
53
+ IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY)
54
+ SET(MBEDTLS_FOUND TRUE)
55
+ ENDIF()
56
+
57
+ IF(MBEDTLS_FOUND)
58
+ # split mbedTLS into -L and -l linker options, so we can set them for pkg-config
59
+ GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_DIR ${MBEDTLS_LIBRARY} PATH)
60
+ GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY} NAME_WE)
61
+ GET_FILENAME_COMPONENT(MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY} NAME_WE)
62
+ GET_FILENAME_COMPONENT(MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY} NAME_WE)
63
+ STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
64
+ STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
65
+ STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
66
+ SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
67
+
68
+ IF(NOT MBEDTLS_FIND_QUIETLY)
69
+ MESSAGE(STATUS "Found mbedTLS:")
70
+ FILE(READ ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLSCONTENT)
71
+ STRING(REGEX MATCH "MBEDTLS_VERSION_STRING +\"[0-9|.]+\"" MBEDTLSMATCH ${MBEDTLSCONTENT})
72
+ IF (MBEDTLSMATCH)
73
+ STRING(REGEX REPLACE "MBEDTLS_VERSION_STRING +\"([0-9|.]+)\"" "\\1" MBEDTLS_VERSION ${MBEDTLSMATCH})
74
+ MESSAGE(STATUS " version ${MBEDTLS_VERSION}")
75
+ ENDIF(MBEDTLSMATCH)
76
+ MESSAGE(STATUS " TLS: ${MBEDTLS_LIBRARY}")
77
+ MESSAGE(STATUS " X509: ${MBEDX509_LIBRARY}")
78
+ MESSAGE(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}")
79
+ ENDIF(NOT MBEDTLS_FIND_QUIETLY)
80
+ ELSE(MBEDTLS_FOUND)
81
+ IF(MBEDTLS_FIND_REQUIRED)
82
+ MESSAGE(FATAL_ERROR "Could not find mbedTLS")
83
+ ENDIF(MBEDTLS_FIND_REQUIRED)
84
+ ENDIF(MBEDTLS_FOUND)
85
+
86
+ MARK_AS_ADVANCED(
87
+ MBEDTLS_INCLUDE_DIR
88
+ MBEDTLS_LIBRARY_DIR
89
+ MBEDTLS_LIBRARIES
90
+ MBEDTLS_LIBRARY
91
+ MBEDX509_LIBRARY
92
+ MBEDCRYPTO_LIBRARY
93
+ )
@@ -1,3 +1,5 @@
1
1
  FILE(GLOB SRC_HTTP "*.c" "*.h")
2
2
 
3
3
  ADD_LIBRARY(http-parser OBJECT ${SRC_HTTP})
4
+
5
+ ENABLE_WARNINGS(implicit-fallthrough=1)
@@ -29,6 +29,7 @@
29
29
  #include "git2/ignore.h"
30
30
  #include "git2/index.h"
31
31
  #include "git2/indexer.h"
32
+ #include "git2/mailmap.h"
32
33
  #include "git2/merge.h"
33
34
  #include "git2/message.h"
34
35
  #include "git2/net.h"
@@ -186,6 +186,22 @@ GIT_EXTERN(int) git_attr_get_many(
186
186
  size_t num_attr,
187
187
  const char **names);
188
188
 
189
+ /**
190
+ * The callback used with git_attr_foreach.
191
+ *
192
+ * This callback will be invoked only once per attribute name, even if there
193
+ * are multiple rules for a given file. The highest priority rule will be
194
+ * used.
195
+ *
196
+ * @see git_attr_foreach.
197
+ *
198
+ * @param name The attribute name.
199
+ * @param value The attribute value. May be NULL if the attribute is explicitly
200
+ * set to UNSPECIFIED using the '!' sign.
201
+ * @param payload A user-specified pointer.
202
+ * @return 0 to continue looping, non-zero to stop. This value will be returned
203
+ * from git_attr_foreach.
204
+ */
189
205
  typedef int (*git_attr_foreach_cb)(const char *name, const char *value, void *payload);
190
206
 
191
207
  /**
@@ -196,13 +212,8 @@ typedef int (*git_attr_foreach_cb)(const char *name, const char *value, void *pa
196
212
  * @param path Path inside the repo to check attributes. This does not have
197
213
  * to exist, but if it does not, then it will be treated as a
198
214
  * plain file (i.e. not a directory).
199
- * @param callback Function to invoke on each attribute name and value. The
200
- * value may be NULL is the attribute is explicitly set to
201
- * UNSPECIFIED using the '!' sign. Callback will be invoked
202
- * only once per attribute name, even if there are multiple
203
- * rules for a given file. The highest priority rule will be
204
- * used. Return a non-zero value from this to stop looping.
205
- * The value will be returned from `git_attr_foreach`.
215
+ * @param callback Function to invoke on each attribute name and value.
216
+ * See git_attr_foreach_cb.
206
217
  * @param payload Passed on as extra parameter to callback function.
207
218
  * @return 0 on success, non-zero callback return value, or error code
208
219
  */
@@ -43,38 +43,47 @@ typedef enum {
43
43
  /** Restrict the search of commits to those reachable following only the
44
44
  * first parents. */
45
45
  GIT_BLAME_FIRST_PARENT = (1<<4),
46
+ /** Use mailmap file to map author and committer names and email addresses
47
+ * to canonical real names and email addresses. The mailmap will be read
48
+ * from the working directory, or HEAD in a bare repository. */
49
+ GIT_BLAME_USE_MAILMAP = (1<<5),
46
50
  } git_blame_flag_t;
47
51
 
48
52
  /**
49
53
  * Blame options structure
50
54
  *
51
- * Use zeros to indicate default settings. It's easiest to use the
52
- * `GIT_BLAME_OPTIONS_INIT` macro:
53
- * git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
55
+ * Initialize with `GIT_BLAME_OPTIONS_INIT`. Alternatively, you can
56
+ * use `git_blame_init_options`.
54
57
  *
55
- * - `flags` is a combination of the `git_blame_flag_t` values above.
56
- * - `min_match_characters` is the lower bound on the number of alphanumeric
57
- * characters that must be detected as moving/copying within a file for it to
58
- * associate those lines with the parent commit. The default value is 20.
59
- * This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
60
- * flags are specified.
61
- * - `newest_commit` is the id of the newest commit to consider. The default
62
- * is HEAD.
63
- * - `oldest_commit` is the id of the oldest commit to consider. The default
64
- * is the first commit encountered with a NULL parent.
65
- * - `min_line` is the first line in the file to blame. The default is 1 (line
66
- * numbers start with 1).
67
- * - `max_line` is the last line in the file to blame. The default is the last
68
- * line of the file.
69
58
  */
70
59
  typedef struct git_blame_options {
71
60
  unsigned int version;
72
61
 
62
+ /** A combination of `git_blame_flag_t` */
73
63
  uint32_t flags;
64
+ /** The lower bound on the number of alphanumeric
65
+ * characters that must be detected as moving/copying within a file for it to
66
+ * associate those lines with the parent commit. The default value is 20.
67
+ * This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
68
+ * flags are specified.
69
+ */
74
70
  uint16_t min_match_characters;
71
+ /** The id of the newest commit to consider. The default is HEAD. */
75
72
  git_oid newest_commit;
73
+ /**
74
+ * The id of the oldest commit to consider.
75
+ * The default is the first commit encountered with a NULL parent.
76
+ */
76
77
  git_oid oldest_commit;
78
+ /**
79
+ * The first line in the file to blame.
80
+ * The default is 1 (line numbers start with 1).
81
+ */
77
82
  size_t min_line;
83
+ /**
84
+ * The last line in the file to blame.
85
+ * The default is the last line of the file.
86
+ */
78
87
  size_t max_line;
79
88
  } git_blame_options;
80
89
 
@@ -82,11 +91,13 @@ typedef struct git_blame_options {
82
91
  #define GIT_BLAME_OPTIONS_INIT {GIT_BLAME_OPTIONS_VERSION}
83
92
 
84
93
  /**
85
- * Initializes a `git_blame_options` with default values. Equivalent to
86
- * creating an instance with GIT_BLAME_OPTIONS_INIT.
94
+ * Initialize git_blame_options structure
87
95
  *
88
- * @param opts The `git_blame_options` struct to initialize
89
- * @param version Version of struct; pass `GIT_BLAME_OPTIONS_VERSION`
96
+ * Initializes a `git_blame_options` with default values. Equivalent to creating
97
+ * an instance with GIT_BLAME_OPTIONS_INIT.
98
+ *
99
+ * @param opts The `git_blame_options` struct to initialize.
100
+ * @param version The struct version; pass `GIT_BLAME_OPTIONS_VERSION`.
90
101
  * @return Zero on success; -1 on failure.
91
102
  */
92
103
  GIT_EXTERN(int) git_blame_init_options(
@@ -101,6 +112,9 @@ GIT_EXTERN(int) git_blame_init_options(
101
112
  * changed.
102
113
  * - `final_start_line_number` is the 1-based line number where this hunk
103
114
  * begins, in the final version of the file
115
+ * - `final_signature` is the author of `final_commit_id`. If
116
+ * `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
117
+ * real name and email address.
104
118
  * - `orig_commit_id` is the OID of the commit where this hunk was found. This
105
119
  * will usually be the same as `final_commit_id`, except when
106
120
  * `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
@@ -109,6 +123,9 @@ GIT_EXTERN(int) git_blame_init_options(
109
123
  * - `orig_start_line_number` is the 1-based line number where this hunk begins
110
124
  * in the file named by `orig_path` in the commit specified by
111
125
  * `orig_commit_id`.
126
+ * - `orig_signature` is the author of `orig_commit_id`. If
127
+ * `GIT_BLAME_USE_MAILMAP` has been specified, it will contain the canonical
128
+ * real name and email address.
112
129
  * - `boundary` is 1 iff the hunk has been tracked to a boundary commit (the
113
130
  * root, or the commit specified in git_blame_options.oldest_commit)
114
131
  */
@@ -128,7 +145,7 @@ typedef struct git_blame_hunk {
128
145
  } git_blame_hunk;
129
146
 
130
147
 
131
- /* Opaque structure to hold blame results */
148
+ /** Opaque structure to hold blame results */
132
149
  typedef struct git_blame git_blame;
133
150
 
134
151
  /**
@@ -105,7 +105,7 @@ GIT_EXTERN(git_off_t) git_blob_rawsize(const git_blob *blob);
105
105
  * attributes set for the blob and the content detected in it.
106
106
  *
107
107
  * The output is written into a `git_buf` which the caller must free
108
- * when done (via `git_buf_free`).
108
+ * when done (via `git_buf_dispose`).
109
109
  *
110
110
  * If no filters need to be applied, then the `out` buffer will just
111
111
  * be populated with a pointer to the raw content of the blob. In
@@ -278,7 +278,7 @@ GIT_EXTERN(int) git_branch_remote_name(
278
278
 
279
279
 
280
280
  /**
281
- * Retrieve the name fo the upstream remote of a local branch
281
+ * Retrieve the name of the upstream remote of a local branch
282
282
  *
283
283
  * @param buf the buffer into which to write the name
284
284
  * @param repo the repository in which to look
@@ -25,7 +25,7 @@ GIT_BEGIN_DECL
25
25
  * caller and have the caller take responsibility for freeing that memory.
26
26
  * This can be awkward if the caller does not have easy access to the same
27
27
  * allocation functions that libgit2 is using. In those cases, libgit2
28
- * will fill in a `git_buf` and the caller can use `git_buf_free()` to
28
+ * will fill in a `git_buf` and the caller can use `git_buf_dispose()` to
29
29
  * release it when they are done.
30
30
  *
31
31
  * A `git_buf` may also be used for the caller to pass in a reference to
@@ -69,7 +69,19 @@ typedef struct {
69
69
  *
70
70
  * @param buffer The buffer to deallocate
71
71
  */
72
- GIT_EXTERN(void) git_buf_free(git_buf *buffer);
72
+ GIT_EXTERN(void) git_buf_dispose(git_buf *buffer);
73
+
74
+ /**
75
+ * Alias of `git_buf_dispose`.
76
+ *
77
+ * This function is directly calls `git_buf_dispose` now and is deprecated.
78
+ * Going forward, we refer to functions freeing the internal state of a
79
+ * structure a `dispose` function, while functions freeing the structure
80
+ * themselves will be called a `free` function.
81
+ *
82
+ * This function is going to be removed in v0.30.0.
83
+ */
84
+ GIT_EXTERN(void) GIT_DEPRECATED(git_buf_free)(git_buf *buffer);
73
85
 
74
86
  /**
75
87
  * Resize the buffer allocation to make more space.
@@ -243,15 +243,14 @@ typedef void (*git_checkout_perfdata_cb)(
243
243
  /**
244
244
  * Checkout options structure
245
245
  *
246
- * Zero out for defaults. Initialize with `GIT_CHECKOUT_OPTIONS_INIT` macro to
247
- * correctly set the `version` field. E.g.
246
+ * Initialize with `GIT_CHECKOUT_OPTIONS_INIT`. Alternatively, you can
247
+ * use `git_checkout_init_options`.
248
248
  *
249
- * git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
250
249
  */
251
250
  typedef struct git_checkout_options {
252
251
  unsigned int version;
253
252
 
254
- unsigned int checkout_strategy; /**< default will be a dry run */
253
+ unsigned int checkout_strategy; /**< default will be a safe checkout */
255
254
 
256
255
  int disable_filters; /**< don't apply filters like CRLF conversion */
257
256
  unsigned int dir_mode; /**< default is 0755 */
@@ -295,16 +294,18 @@ typedef struct git_checkout_options {
295
294
  } git_checkout_options;
296
295
 
297
296
  #define GIT_CHECKOUT_OPTIONS_VERSION 1
298
- #define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION}
297
+ #define GIT_CHECKOUT_OPTIONS_INIT {GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE}
299
298
 
300
299
  /**
301
- * Initializes a `git_checkout_options` with default values. Equivalent to
302
- * creating an instance with GIT_CHECKOUT_OPTIONS_INIT.
303
- *
304
- * @param opts the `git_checkout_options` struct to initialize.
305
- * @param version Version of struct; pass `GIT_CHECKOUT_OPTIONS_VERSION`
306
- * @return Zero on success; -1 on failure.
307
- */
300
+ * Initialize git_checkout_options structure
301
+ *
302
+ * Initializes a `git_checkout_options` with default values. Equivalent to creating
303
+ * an instance with GIT_CHECKOUT_OPTIONS_INIT.
304
+ *
305
+ * @param opts The `git_checkout_options` struct to initialize.
306
+ * @param version The struct version; pass `GIT_CHECKOUT_OPTIONS_VERSION`.
307
+ * @return Zero on success; -1 on failure.
308
+ */
308
309
  GIT_EXTERN(int) git_checkout_init_options(
309
310
  git_checkout_options *opts,
310
311
  unsigned int version);
@@ -37,11 +37,13 @@ typedef struct {
37
37
  #define GIT_CHERRYPICK_OPTIONS_INIT {GIT_CHERRYPICK_OPTIONS_VERSION, 0, GIT_MERGE_OPTIONS_INIT, GIT_CHECKOUT_OPTIONS_INIT}
38
38
 
39
39
  /**
40
- * Initializes a `git_cherrypick_options` with default values. Equivalent to
41
- * creating an instance with GIT_CHERRYPICK_OPTIONS_INIT.
40
+ * Initialize git_cherrypick_options structure
42
41
  *
43
- * @param opts the `git_cherrypick_options` struct to initialize
44
- * @param version Version of struct; pass `GIT_CHERRYPICK_OPTIONS_VERSION`
42
+ * Initializes a `git_cherrypick_options` with default values. Equivalent to creating
43
+ * an instance with GIT_CHERRYPICK_OPTIONS_INIT.
44
+ *
45
+ * @param opts The `git_cherrypick_options` struct to initialize.
46
+ * @param version The struct version; pass `GIT_CHERRYPICK_OPTIONS_VERSION`.
45
47
  * @return Zero on success; -1 on failure.
46
48
  */
47
49
  GIT_EXTERN(int) git_cherrypick_init_options(
@@ -96,9 +96,9 @@ typedef int (*git_repository_create_cb)(
96
96
  /**
97
97
  * Clone options structure
98
98
  *
99
- * Use the GIT_CLONE_OPTIONS_INIT to get the default settings, like this:
99
+ * Initialize with `GIT_CLONE_OPTIONS_INIT`. Alternatively, you can
100
+ * use `git_clone_init_options`.
100
101
  *
101
- * git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
102
102
  */
103
103
  typedef struct git_clone_options {
104
104
  unsigned int version;
@@ -169,11 +169,13 @@ typedef struct git_clone_options {
169
169
  GIT_FETCH_OPTIONS_INIT }
170
170
 
171
171
  /**
172
- * Initializes a `git_clone_options` with default values. Equivalent to
173
- * creating an instance with GIT_CLONE_OPTIONS_INIT.
172
+ * Initialize git_clone_options structure
174
173
  *
175
- * @param opts The `git_clone_options` struct to initialize
176
- * @param version Version of struct; pass `GIT_CLONE_OPTIONS_VERSION`
174
+ * Initializes a `git_clone_options` with default values. Equivalent to creating
175
+ * an instance with GIT_CLONE_OPTIONS_INIT.
176
+ *
177
+ * @param opts The `git_clone_options` struct to initialize.
178
+ * @param version The struct version; pass `GIT_CLONE_OPTIONS_VERSION`.
177
179
  * @return Zero on success; -1 on failure.
178
180
  */
179
181
  GIT_EXTERN(int) git_clone_init_options(
@@ -172,6 +172,34 @@ GIT_EXTERN(const git_signature *) git_commit_committer(const git_commit *commit)
172
172
  */
173
173
  GIT_EXTERN(const git_signature *) git_commit_author(const git_commit *commit);
174
174
 
175
+ /**
176
+ * Get the committer of a commit, using the mailmap to map names and email
177
+ * addresses to canonical real names and email addresses.
178
+ *
179
+ * Call `git_signature_free` to free the signature.
180
+ *
181
+ * @param out a pointer to store the resolved signature.
182
+ * @param commit a previously loaded commit.
183
+ * @param mailmap the mailmap to resolve with. (may be NULL)
184
+ * @return 0 or an error code
185
+ */
186
+ GIT_EXTERN(int) git_commit_committer_with_mailmap(
187
+ git_signature **out, const git_commit *commit, const git_mailmap *mailmap);
188
+
189
+ /**
190
+ * Get the author of a commit, using the mailmap to map names and email
191
+ * addresses to canonical real names and email addresses.
192
+ *
193
+ * Call `git_signature_free` to free the signature.
194
+ *
195
+ * @param out a pointer to store the resolved signature.
196
+ * @param commit a previously loaded commit.
197
+ * @param mailmap the mailmap to resolve with. (may be NULL)
198
+ * @return 0 or an error code
199
+ */
200
+ GIT_EXTERN(int) git_commit_author_with_mailmap(
201
+ git_signature **out, const git_commit *commit, const git_mailmap *mailmap);
202
+
175
203
  /**
176
204
  * Get the full raw text of the commit header.
177
205
  *