rugged 0.24.6.1 → 0.25.0b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged_repo.c +44 -36
  3. data/lib/rugged/version.rb +1 -1
  4. data/vendor/libgit2/CMakeLists.txt +10 -21
  5. data/vendor/libgit2/include/git2/checkout.h +0 -7
  6. data/vendor/libgit2/include/git2/commit.h +46 -0
  7. data/vendor/libgit2/include/git2/common.h +1 -16
  8. data/vendor/libgit2/include/git2/odb.h +47 -1
  9. data/vendor/libgit2/include/git2/version.h +2 -2
  10. data/vendor/libgit2/src/array.h +0 -40
  11. data/vendor/libgit2/src/blame.c +3 -8
  12. data/vendor/libgit2/src/blame_git.c +9 -20
  13. data/vendor/libgit2/src/checkout.c +5 -13
  14. data/vendor/libgit2/src/commit.c +132 -52
  15. data/vendor/libgit2/src/common.h +1 -1
  16. data/vendor/libgit2/src/config_cache.c +1 -2
  17. data/vendor/libgit2/src/config_file.c +20 -14
  18. data/vendor/libgit2/src/delta-apply.c +5 -36
  19. data/vendor/libgit2/src/delta-apply.h +0 -12
  20. data/vendor/libgit2/src/describe.c +1 -2
  21. data/vendor/libgit2/src/diff_tform.c +3 -5
  22. data/vendor/libgit2/src/filebuf.c +1 -6
  23. data/vendor/libgit2/src/global.c +8 -28
  24. data/vendor/libgit2/src/global.h +0 -1
  25. data/vendor/libgit2/src/ignore.c +19 -56
  26. data/vendor/libgit2/src/index.c +8 -27
  27. data/vendor/libgit2/src/indexer.c +7 -11
  28. data/vendor/libgit2/src/iterator.c +2 -2
  29. data/vendor/libgit2/src/merge.c +0 -1
  30. data/vendor/libgit2/src/mwindow.c +19 -8
  31. data/vendor/libgit2/src/mwindow.h +2 -1
  32. data/vendor/libgit2/src/object.c +6 -3
  33. data/vendor/libgit2/src/odb.c +188 -48
  34. data/vendor/libgit2/src/odb_loose.c +1 -1
  35. data/vendor/libgit2/src/odb_pack.c +3 -0
  36. data/vendor/libgit2/src/openssl_stream.c +27 -60
  37. data/vendor/libgit2/src/openssl_stream.h +0 -106
  38. data/vendor/libgit2/src/pack-objects.c +2 -4
  39. data/vendor/libgit2/src/pack.c +9 -5
  40. data/vendor/libgit2/src/posix.c +0 -7
  41. data/vendor/libgit2/src/posix.h +0 -1
  42. data/vendor/libgit2/src/push.c +6 -6
  43. data/vendor/libgit2/src/refdb_fs.c +0 -1
  44. data/vendor/libgit2/src/refs.c +0 -3
  45. data/vendor/libgit2/src/refspec.c +2 -4
  46. data/vendor/libgit2/src/remote.c +5 -15
  47. data/vendor/libgit2/src/repository.c +21 -29
  48. data/vendor/libgit2/src/settings.c +1 -23
  49. data/vendor/libgit2/src/stransport_stream.c +9 -15
  50. data/vendor/libgit2/src/submodule.c +2 -3
  51. data/vendor/libgit2/src/sysdir.c +47 -41
  52. data/vendor/libgit2/src/sysdir.h +5 -0
  53. data/vendor/libgit2/src/tag.c +2 -8
  54. data/vendor/libgit2/src/thread-utils.h +51 -5
  55. data/vendor/libgit2/src/transports/http.c +3 -3
  56. data/vendor/libgit2/src/transports/smart_pkt.c +4 -13
  57. data/vendor/libgit2/src/transports/smart_protocol.c +17 -61
  58. data/vendor/libgit2/src/tree.c +100 -83
  59. data/vendor/libgit2/src/tree.h +5 -4
  60. data/vendor/libgit2/src/unix/map.c +0 -5
  61. data/vendor/libgit2/src/util.c +3 -3
  62. data/vendor/libgit2/src/win32/map.c +5 -24
  63. data/vendor/libgit2/src/win32/precompiled.h +1 -1
  64. data/vendor/libgit2/src/win32/{thread.c → pthread.c} +80 -50
  65. data/vendor/libgit2/src/win32/pthread.h +92 -0
  66. data/vendor/libgit2/src/xdiff/xprepare.c +1 -2
  67. metadata +7 -8
  68. data/vendor/libgit2/src/unix/pthread.h +0 -54
  69. data/vendor/libgit2/src/win32/thread.h +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4b1489ad0847a3a4701d7f5f9ea3e6e78a9d556
4
- data.tar.gz: be07145f99c3be07bf0c970c70932e2ef4b7a94c
3
+ metadata.gz: bbcf49a26d55dbaaf0d89824638a58cf8897df0e
4
+ data.tar.gz: 5ce5dbfce098463431aad99034c49c58396d2216
5
5
  SHA512:
6
- metadata.gz: 2ff1cce3c75a0027c9003ce19021cd589a3fdffeaf2c69ccd5dd6614c77e80964256580a230c7e61fa1fd9dbe871fd79029c17d3f027f7f2d3eb6a7346f3633d
7
- data.tar.gz: c63797d882cf388ad42a9d83c054dfe4b1bd5091654c89433fe2fa43481d9b7122d659a3ed53de95241e74125f030c8e06f375216b8618e57effe5f19de1ef08
6
+ metadata.gz: 059bab3bb87c0bd0070cffef4b33140a667cf31cbf612cab3f2b89131251d8c1e47de635e88fcda80e2b3f8d572c906e3bddc875e3937bf49a5f471db1866687
7
+ data.tar.gz: 6e119cf6ccad1b2112885fe8b78f9bd93c46ffda7e9df8ec9bc6e2003710fc95400e25ef8bf9be1e8577dc5510ad4255e08390caf110c10a9b59d5843326e672
@@ -1045,10 +1045,13 @@ static VALUE rb_git_repo_read_header(VALUE self, VALUE hex)
1045
1045
  /**
1046
1046
  * call-seq:
1047
1047
  * repo.expand_oids([oid..], object_type = :any) -> hash
1048
+ * repo.expand_oids([oid..], object_type = [type..]) -> hash
1048
1049
  *
1049
1050
  * Expand a list of short oids to their full value, assuming they exist
1050
- * in the repository. If `object_type` is passed, OIDs are expected to be
1051
- * of the given type.
1051
+ * in the repository. If `object_type` is passed and is an array, it must
1052
+ * be the same length as the OIDs array. If it's a single type name, all
1053
+ * OIDs will be expected to resolve to that object type. OIDs that don't
1054
+ * match the expected object types will not be expanded.
1052
1055
  *
1053
1056
  * Returns a hash of `{ short_oid => full_oid }` for the short OIDs which
1054
1057
  * exist in the repository and match the expected object type. Missing OIDs
@@ -1058,59 +1061,64 @@ static VALUE rb_git_repo_expand_oids(int argc, VALUE *argv, VALUE self)
1058
1061
  {
1059
1062
  VALUE rb_result, rb_oids, rb_expected_type;
1060
1063
 
1061
- git_otype expected_type = GIT_OBJ_ANY;
1062
-
1063
1064
  git_repository *repo;
1064
- git_oid oid;
1065
1065
  git_odb *odb;
1066
- int i, error;
1066
+ git_odb_expand_id *expand;
1067
+ long i, expand_count;
1068
+ int error;
1067
1069
 
1068
1070
  Data_Get_Struct(self, git_repository, repo);
1069
-
1070
1071
  rb_scan_args(argc, argv, "11", &rb_oids, &rb_expected_type);
1071
1072
 
1072
1073
  Check_Type(rb_oids, T_ARRAY);
1073
- expected_type = rugged_otype_get(rb_expected_type);
1074
+ expand_count = RARRAY_LEN(rb_oids);
1075
+ expand = alloca(expand_count * sizeof(git_odb_expand_id));
1074
1076
 
1075
- error = git_repository_odb(&odb, repo);
1076
- rugged_exception_check(error);
1077
+ for (i = 0; i < expand_count; ++i) {
1078
+ VALUE rb_hex = rb_ary_entry(rb_oids, i);
1079
+ Check_Type(rb_hex, T_STRING);
1077
1080
 
1078
- rb_result = rb_hash_new();
1081
+ rugged_exception_check(
1082
+ git_oid_fromstrn(&expand[i].id, RSTRING_PTR(rb_hex), RSTRING_LEN(rb_hex))
1083
+ );
1084
+ expand[i].length = RSTRING_LEN(rb_hex);
1085
+ }
1079
1086
 
1080
- for (i = 0; i < RARRAY_LEN(rb_oids); ++i) {
1081
- VALUE hex_oid = rb_ary_entry(rb_oids, i);
1082
- git_oid found_oid;
1087
+ if (TYPE(rb_expected_type) == T_ARRAY) {
1088
+ if (RARRAY_LEN(rb_expected_type) != expand_count)
1089
+ rb_raise(rb_eRuntimeError,
1090
+ "the `object_type` array must be the same length as the `oids` array");
1083
1091
 
1084
- if (TYPE(hex_oid) != T_STRING) {
1085
- git_odb_free(odb);
1086
- rb_raise(rb_eTypeError, "Expected a SHA1 OID");
1092
+ for (i = 0; i < expand_count; ++i) {
1093
+ VALUE rb_type = rb_ary_entry(rb_expected_type, i);
1094
+ expand[i].type = rugged_otype_get(rb_type);
1087
1095
  }
1096
+ } else {
1097
+ git_otype expected_type = GIT_OBJ_ANY;
1088
1098
 
1089
- error = git_oid_fromstrn(&oid, RSTRING_PTR(hex_oid), RSTRING_LEN(hex_oid));
1090
- if (error < 0) {
1091
- git_odb_free(odb);
1092
- rugged_exception_check(error);
1093
- }
1099
+ if (!NIL_P(rb_expected_type))
1100
+ expected_type = rugged_otype_get(rb_expected_type);
1094
1101
 
1095
- error = git_odb_exists_prefix(&found_oid, odb, &oid, RSTRING_LEN(hex_oid));
1102
+ for (i = 0; i < expand_count; ++i)
1103
+ expand[i].type = expected_type;
1104
+ }
1096
1105
 
1097
- if (!error) {
1098
- if (expected_type != GIT_OBJ_ANY) {
1099
- size_t found_size;
1100
- git_otype found_type;
1106
+ error = git_repository_odb(&odb, repo);
1107
+ rugged_exception_check(error);
1101
1108
 
1102
- if (git_odb_read_header(&found_size, &found_type, odb, &found_oid) < 0)
1103
- continue;
1109
+ error = git_odb_expand_ids(odb, expand, (size_t)expand_count);
1110
+ git_odb_free(odb);
1111
+ rugged_exception_check(error);
1104
1112
 
1105
- if (found_type != expected_type)
1106
- continue;
1107
- }
1113
+ rb_result = rb_hash_new();
1108
1114
 
1109
- rb_hash_aset(rb_result, hex_oid, rugged_create_oid(&found_oid));
1115
+ for (i = 0; i < expand_count; ++i) {
1116
+ if (expand[i].length) {
1117
+ rb_hash_aset(rb_result,
1118
+ rb_ary_entry(rb_oids, i), rugged_create_oid(&expand[i].id));
1110
1119
  }
1111
1120
  }
1112
1121
 
1113
- git_odb_free(odb);
1114
1122
  return rb_result;
1115
1123
  }
1116
1124
 
@@ -1945,7 +1953,7 @@ void rugged_parse_checkout_options(git_checkout_options *opts, VALUE rb_options)
1945
1953
 
1946
1954
  rb_value = rb_hash_aref(rb_options, CSTR2SYM("progress"));
1947
1955
  if (!NIL_P(rb_value)) {
1948
- struct rugged_cb_payload *payload = malloc(sizeof(struct rugged_cb_payload));
1956
+ struct rugged_cb_payload *payload = xmalloc(sizeof(struct rugged_cb_payload));
1949
1957
  payload->rb_data = rb_value;
1950
1958
  payload->exception = 0;
1951
1959
 
@@ -1955,7 +1963,7 @@ void rugged_parse_checkout_options(git_checkout_options *opts, VALUE rb_options)
1955
1963
 
1956
1964
  rb_value = rb_hash_aref(rb_options, CSTR2SYM("notify"));
1957
1965
  if (!NIL_P(rb_value)) {
1958
- struct rugged_cb_payload *payload = malloc(sizeof(struct rugged_cb_payload));
1966
+ struct rugged_cb_payload *payload = xmalloc(sizeof(struct rugged_cb_payload));
1959
1967
  payload->rb_data = rb_value;
1960
1968
  payload->exception = 0;
1961
1969
 
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.24.6.1'
2
+ Version = VERSION = '0.25.0b1'
3
3
  end
@@ -40,7 +40,7 @@ OPTION( USE_ICONV "Link with and use iconv library" OFF )
40
40
  OPTION( USE_SSH "Link with libssh to enable SSH support" ON )
41
41
  OPTION( USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF )
42
42
  OPTION( VALGRIND "Configure build for valgrind" OFF )
43
- OPTION( CURL "Use curl for HTTP if available" ON)
43
+ OPTION( CURL "User curl for HTTP if available" ON)
44
44
  OPTION( DEBUG_POOL "Enable debug pool allocator" OFF )
45
45
 
46
46
  IF(DEBUG_POOL)
@@ -109,7 +109,7 @@ ELSE ()
109
109
  ENDIF()
110
110
 
111
111
  IF (HAVE_STRUCT_STAT_NSEC OR WIN32)
112
- OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" OFF )
112
+ OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" ON )
113
113
  ENDIF()
114
114
 
115
115
  # This variable will contain the libraries we need to put into
@@ -151,10 +151,6 @@ FUNCTION(TARGET_OS_LIBRARIES target)
151
151
  TARGET_LINK_LIBRARIES(${target} socket nsl)
152
152
  LIST(APPEND LIBGIT2_PC_LIBS "-lsocket" "-lnsl")
153
153
  SET(LIBGIT2_PC_LIBS ${LIBGIT2_PC_LIBS} PARENT_SCOPE)
154
- ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Haiku")
155
- TARGET_LINK_LIBRARIES(${target} network)
156
- LIST(APPEND LIBGIT2_PC_LIBS "-lnetwork")
157
- SET(LIBGIT2_PC_LIBS ${LIBGIT2_PC_LIBS} PARENT_SCOPE)
158
154
  ENDIF()
159
155
  CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" NEED_LIBRT)
160
156
  IF(NEED_LIBRT)
@@ -165,8 +161,6 @@ FUNCTION(TARGET_OS_LIBRARIES target)
165
161
 
166
162
  IF(THREADSAFE)
167
163
  TARGET_LINK_LIBRARIES(${target} ${CMAKE_THREAD_LIBS_INIT})
168
- LIST(APPEND LIBGIT2_PC_LIBS ${CMAKE_THREAD_LIBS_INIT})
169
- SET(LIBGIT2_PC_LIBS ${LIBGIT2_PC_LIBS} PARENT_SCOPE)
170
164
  ENDIF()
171
165
  ENDFUNCTION()
172
166
 
@@ -286,7 +280,6 @@ ELSE ()
286
280
  IF (CURL_FOUND)
287
281
  ADD_DEFINITIONS(-DGIT_CURL)
288
282
  INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
289
- LINK_DIRECTORIES(${CURL_LIBRARY_DIRS})
290
283
  LINK_LIBRARIES(${CURL_LIBRARIES})
291
284
  LIST(APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS})
292
285
  ENDIF()
@@ -419,7 +412,7 @@ IF (MSVC)
419
412
  # /MTd - Statically link the multithreaded debug version of the CRT
420
413
  # /MDd - Dynamically link the multithreaded debug version of the CRT
421
414
  # /RTC1 - Run time checks
422
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Zi /Od /D_DEBUG /RTC1 ${CRT_FLAG_DEBUG}")
415
+ SET(CMAKE_C_FLAGS_DEBUG "/Zi /Od /D_DEBUG /RTC1 ${CRT_FLAG_DEBUG}")
423
416
 
424
417
  # /DNDEBUG - Disables asserts
425
418
  # /MT - Statically link the multithreaded release version of the CRT
@@ -471,22 +464,20 @@ ELSE ()
471
464
  ENDIF()
472
465
 
473
466
  IF (WIN32 AND NOT CYGWIN)
474
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
467
+ SET(CMAKE_C_FLAGS_DEBUG "-D_DEBUG")
475
468
  ENDIF ()
476
469
 
477
- IF (MINGW OR MSYS) # MinGW and MSYS always do PIC and complain if we tell them to
470
+ IF (MINGW) # MinGW always does PIC and complains if we tell it to
478
471
  STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
479
- ELSEIF (BUILD_SHARED_LIBS)
480
- ADD_C_FLAG_IF_SUPPORTED(-fvisibility=hidden)
481
-
482
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
483
- ENDIF ()
484
-
485
- IF (MINGW)
486
472
  # MinGW >= 3.14 uses the C99-style stdio functions
487
473
  # automatically, but forks like mingw-w64 still want
488
474
  # us to define this in order to use them
489
475
  ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
476
+
477
+ ELSEIF (BUILD_SHARED_LIBS)
478
+ ADD_C_FLAG_IF_SUPPORTED(-fvisibility=hidden)
479
+
480
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
490
481
  ENDIF ()
491
482
 
492
483
  ADD_C_FLAG_IF_SUPPORTED(-Wdocumentation)
@@ -617,8 +608,6 @@ IF (SONAME)
617
608
  IF (LIBGIT2_FILENAME)
618
609
  ADD_DEFINITIONS(-DLIBGIT2_FILENAME=\"${LIBGIT2_FILENAME}\")
619
610
  SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})
620
- ELSEIF (DEFINED LIBGIT2_PREFIX)
621
- SET_TARGET_PROPERTIES(git2 PROPERTIES PREFIX "${LIBGIT2_PREFIX}")
622
611
  ENDIF()
623
612
  ENDIF()
624
613
  STRING(REPLACE ";" " " LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS}")
@@ -313,13 +313,6 @@ GIT_EXTERN(int) git_checkout_init_options(
313
313
  * Updates files in the index and the working tree to match the content of
314
314
  * the commit pointed at by HEAD.
315
315
  *
316
- * Note that this is _not_ the correct mechanism used to switch branches;
317
- * do not change your `HEAD` and then call this method, that would leave
318
- * you with checkout conflicts since your working directory would then
319
- * appear to be dirty. Instead, checkout the target of the branch and
320
- * then update `HEAD` using `git_repository_set_head` to point to the
321
- * branch you checked out.
322
- *
323
316
  * @param repo repository to check out (must be non-bare)
324
317
  * @param opts specifies checkout options (may be NULL)
325
318
  * @return 0 on success, GIT_EUNBORNBRANCH if HEAD points to a non
@@ -394,6 +394,52 @@ GIT_EXTERN(int) git_commit_amend(
394
394
  const char *message,
395
395
  const git_tree *tree);
396
396
 
397
+ /**
398
+ * Create a commit and write it into a buffer
399
+ *
400
+ * Create a commit as with `git_commit_create()` but instead of
401
+ * writing it to the objectdb, write the contents of the object into a
402
+ * buffer.
403
+ *
404
+ * @param out the buffer into which to write the commit object content
405
+ *
406
+ * @param repo Repository where the referenced tree and parents live
407
+ *
408
+ * @param author Signature with author and author time of commit
409
+ *
410
+ * @param committer Signature with committer and * commit time of commit
411
+ *
412
+ * @param message_encoding The encoding for the message in the
413
+ * commit, represented with a standard encoding name.
414
+ * E.g. "UTF-8". If NULL, no encoding header is written and
415
+ * UTF-8 is assumed.
416
+ *
417
+ * @param message Full message for this commit
418
+ *
419
+ * @param tree An instance of a `git_tree` object that will
420
+ * be used as the tree for the commit. This tree object must
421
+ * also be owned by the given `repo`.
422
+ *
423
+ * @param parent_count Number of parents for this commit
424
+ *
425
+ * @param parents Array of `parent_count` pointers to `git_commit`
426
+ * objects that will be used as the parents for this commit. This
427
+ * array may be NULL if `parent_count` is 0 (root commit). All the
428
+ * given commits must be owned by the `repo`.
429
+ *
430
+ * @return 0 or an error code
431
+ */
432
+ GIT_EXTERN(int) git_commit_create_buffer(
433
+ git_buf *out,
434
+ git_repository *repo,
435
+ const git_signature *author,
436
+ const git_signature *committer,
437
+ const char *message_encoding,
438
+ const char *message,
439
+ const git_tree *tree,
440
+ size_t parent_count,
441
+ const git_commit *parents[]);
442
+
397
443
  /** @} */
398
444
  GIT_END_DECL
399
445
  #endif
@@ -24,19 +24,10 @@
24
24
  GIT_BEGIN_DECL
25
25
  # include "inttypes.h"
26
26
  GIT_END_DECL
27
- /** This check is needed for importing this file in an iOS/OS X framework throws an error in Xcode otherwise.*/
28
- #elif !defined(__CLANG_INTTYPES_H)
27
+ #else
29
28
  # include <inttypes.h>
30
29
  #endif
31
30
 
32
- #ifdef DOCURIUM
33
- /*
34
- * This is so clang's doc parser acknowledges comments on functions
35
- * with size_t parameters.
36
- */
37
- typedef size_t size_t;
38
- #endif
39
-
40
31
  /** Declare a public function exported for application use. */
41
32
  #if __GNUC__ >= 4
42
33
  # define GIT_EXTERN(type) extern \
@@ -157,7 +148,6 @@ typedef enum {
157
148
  GIT_OPT_SET_SSL_CERT_LOCATIONS,
158
149
  GIT_OPT_SET_USER_AGENT,
159
150
  GIT_OPT_ENABLE_STRICT_OBJECT_CREATION,
160
- GIT_OPT_SET_SSL_CIPHERS,
161
151
  } git_libgit2_opt_t;
162
152
 
163
153
  /**
@@ -269,11 +259,6 @@ typedef enum {
269
259
  * > example, when this is enabled, the parent(s) and tree inputs
270
260
  * > will be validated when creating a new commit. This defaults
271
261
  * > to disabled.
272
- * * opts(GIT_OPT_SET_SSL_CIPHERS, const char *ciphers)
273
- *
274
- * > Set the SSL ciphers use for HTTPS connections.
275
- * >
276
- * > - `ciphers` is the list of ciphers that are eanbled.
277
262
  *
278
263
  * @param option Option key
279
264
  * @param ... value to set the option
@@ -10,6 +10,7 @@
10
10
  #include "common.h"
11
11
  #include "types.h"
12
12
  #include "oid.h"
13
+ #include "oidarray.h"
13
14
 
14
15
  /**
15
16
  * @file git2/odb.h
@@ -159,7 +160,8 @@ GIT_EXTERN(int) git_odb_read_header(size_t *len_out, git_otype *type_out, git_od
159
160
  GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id);
160
161
 
161
162
  /**
162
- * Determine if objects can be found in the object database from a short OID.
163
+ * Determine if an object can be found in the object database by an
164
+ * abbreviated object ID.
163
165
  *
164
166
  * @param out The full OID of the found object if just one is found.
165
167
  * @param db The database to be searched for the given object.
@@ -171,6 +173,50 @@ GIT_EXTERN(int) git_odb_exists(git_odb *db, const git_oid *id);
171
173
  GIT_EXTERN(int) git_odb_exists_prefix(
172
174
  git_oid *out, git_odb *db, const git_oid *short_id, size_t len);
173
175
 
176
+ /**
177
+ * The information about object IDs to query in `git_odb_expand_ids`,
178
+ * which will be populated upon return.
179
+ */
180
+ typedef struct git_odb_expand_id {
181
+ /** The object ID to expand */
182
+ git_oid id;
183
+
184
+ /**
185
+ * The length of the object ID (in nibbles, or packets of 4 bits; the
186
+ * number of hex characters)
187
+ * */
188
+ unsigned short length;
189
+
190
+ /**
191
+ * The (optional) type of the object to search for; leave as `0` or set
192
+ * to `GIT_OBJ_ANY` to query for any object matching the ID.
193
+ */
194
+ git_otype type;
195
+ } git_odb_expand_id;
196
+
197
+ /**
198
+ * Determine if one or more objects can be found in the object database
199
+ * by their abbreviated object ID and type. The given array will be
200
+ * updated in place: for each abbreviated ID that is unique in the
201
+ * database, and of the given type (if specified), the full object ID,
202
+ * object ID length (`GIT_OID_HEXSZ`) and type will be written back to
203
+ * the array. For IDs that are not found (or are ambiguous), the
204
+ * array entry will be zeroed.
205
+ *
206
+ * Note that since this function operates on multiple objects, the
207
+ * underlying database will not be asked to be reloaded if an object is
208
+ * not found (which is unlike other object database operations.)
209
+ *
210
+ * @param db The database to be searched for the given objects.
211
+ * @param ids An array of short object IDs to search for
212
+ * @param count The length of the `ids` array
213
+ * @return 0 on success or an error code on failure
214
+ */
215
+ GIT_EXTERN(int) git_odb_expand_ids(
216
+ git_odb *db,
217
+ git_odb_expand_id *ids,
218
+ size_t count);
219
+
174
220
  /**
175
221
  * Refresh the object database to load newly added files.
176
222
  *
@@ -7,10 +7,10 @@
7
7
  #ifndef INCLUDE_git_version_h__
8
8
  #define INCLUDE_git_version_h__
9
9
 
10
- #define LIBGIT2_VERSION "0.24.6"
10
+ #define LIBGIT2_VERSION "0.24.0"
11
11
  #define LIBGIT2_VER_MAJOR 0
12
12
  #define LIBGIT2_VER_MINOR 24
13
- #define LIBGIT2_VER_REVISION 6
13
+ #define LIBGIT2_VER_REVISION 0
14
14
  #define LIBGIT2_VER_PATCH 0
15
15
 
16
16
  #define LIBGIT2_SOVERSION 24
@@ -82,44 +82,4 @@ on_oom:
82
82
 
83
83
  #define git_array_valid_index(a, i) ((i) < (a).size)
84
84
 
85
- #define git_array_foreach(a, i, element) \
86
- for ((i) = 0; (i) < (a).size && ((element) = &(a).ptr[(i)]); (i)++)
87
-
88
-
89
- GIT_INLINE(int) git_array__search(
90
- size_t *out,
91
- void *array_ptr,
92
- size_t item_size,
93
- size_t array_len,
94
- int (*compare)(const void *, const void *),
95
- const void *key)
96
- {
97
- size_t lim;
98
- unsigned char *part, *array = array_ptr, *base = array_ptr;
99
- int cmp = -1;
100
-
101
- for (lim = array_len; lim != 0; lim >>= 1) {
102
- part = base + (lim >> 1) * item_size;
103
- cmp = (*compare)(key, part);
104
-
105
- if (cmp == 0) {
106
- base = part;
107
- break;
108
- }
109
- if (cmp > 0) { /* key > p; take right partition */
110
- base = part + 1 * item_size;
111
- lim--;
112
- } /* else take left partition */
113
- }
114
-
115
- if (out)
116
- *out = (base - array) / item_size;
117
-
118
- return (cmp == 0) ? 0 : GIT_ENOTFOUND;
119
- }
120
-
121
- #define git_array_search(out, a, cmp, key) \
122
- git_array__search(out, (a).ptr, sizeof(*(a).ptr), (a).size, \
123
- (cmp), (key))
124
-
125
85
  #endif