rugged 0.23.3 → 0.24.0b0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/ext/rugged/rugged.c +24 -0
  4. data/ext/rugged/rugged_config.c +65 -0
  5. data/ext/rugged/rugged_remote.c +22 -2
  6. data/ext/rugged/rugged_repo.c +10 -5
  7. data/ext/rugged/rugged_tree.c +4 -1
  8. data/lib/rugged/version.rb +1 -1
  9. data/vendor/libgit2/CMakeLists.txt +47 -2
  10. data/vendor/libgit2/include/git2/config.h +18 -0
  11. data/vendor/libgit2/include/git2/diff.h +25 -2
  12. data/vendor/libgit2/include/git2/errors.h +0 -12
  13. data/vendor/libgit2/include/git2/index.h +11 -0
  14. data/vendor/libgit2/include/git2/remote.h +12 -1
  15. data/vendor/libgit2/include/git2/sys/config.h +14 -0
  16. data/vendor/libgit2/include/git2/sys/filter.h +4 -1
  17. data/vendor/libgit2/include/git2/sys/odb_backend.h +4 -0
  18. data/vendor/libgit2/include/git2/sys/refdb_backend.h +5 -4
  19. data/vendor/libgit2/include/git2/sys/transport.h +27 -0
  20. data/vendor/libgit2/include/git2/transport.h +25 -21
  21. data/vendor/libgit2/include/git2/version.h +2 -2
  22. data/vendor/libgit2/libgit2.pc.in +3 -2
  23. data/vendor/libgit2/src/branch.c +1 -12
  24. data/vendor/libgit2/src/checkout.c +29 -20
  25. data/vendor/libgit2/src/clone.c +2 -2
  26. data/vendor/libgit2/src/common.h +13 -4
  27. data/vendor/libgit2/src/config.c +36 -0
  28. data/vendor/libgit2/src/config.h +15 -0
  29. data/vendor/libgit2/src/config_file.c +124 -20
  30. data/vendor/libgit2/src/config_file.h +10 -0
  31. data/vendor/libgit2/src/curl_stream.c +7 -7
  32. data/vendor/libgit2/src/diff.c +89 -27
  33. data/vendor/libgit2/src/diff_print.c +1 -1
  34. data/vendor/libgit2/src/errors.c +75 -40
  35. data/vendor/libgit2/src/filebuf.c +81 -3
  36. data/vendor/libgit2/src/fileops.c +176 -75
  37. data/vendor/libgit2/src/fileops.h +7 -10
  38. data/vendor/libgit2/src/filter.c +5 -2
  39. data/vendor/libgit2/src/global.c +25 -9
  40. data/vendor/libgit2/src/global.h +1 -0
  41. data/vendor/libgit2/src/idxmap.h +92 -0
  42. data/vendor/libgit2/src/ignore.c +9 -7
  43. data/vendor/libgit2/src/index.c +246 -46
  44. data/vendor/libgit2/src/index.h +2 -0
  45. data/vendor/libgit2/src/iterator.c +377 -118
  46. data/vendor/libgit2/src/iterator.h +28 -20
  47. data/vendor/libgit2/src/merge.c +26 -13
  48. data/vendor/libgit2/src/notes.c +1 -1
  49. data/vendor/libgit2/src/odb.c +1 -2
  50. data/vendor/libgit2/src/odb_loose.c +2 -2
  51. data/vendor/libgit2/src/odb_mempack.c +6 -2
  52. data/vendor/libgit2/src/oidmap.h +2 -0
  53. data/vendor/libgit2/src/openssl_stream.c +9 -3
  54. data/vendor/libgit2/src/path.c +37 -2
  55. data/vendor/libgit2/src/path.h +12 -1
  56. data/vendor/libgit2/src/pathspec.c +12 -12
  57. data/vendor/libgit2/src/push.c +2 -1
  58. data/vendor/libgit2/src/push.h +1 -0
  59. data/vendor/libgit2/src/refdb.c +2 -6
  60. data/vendor/libgit2/src/refdb_fs.c +13 -3
  61. data/vendor/libgit2/src/remote.c +44 -15
  62. data/vendor/libgit2/src/repository.c +28 -12
  63. data/vendor/libgit2/src/stash.c +17 -12
  64. data/vendor/libgit2/src/stransport_stream.c +1 -1
  65. data/vendor/libgit2/src/submodule.c +234 -152
  66. data/vendor/libgit2/src/sysdir.c +22 -8
  67. data/vendor/libgit2/src/transaction.c +41 -0
  68. data/vendor/libgit2/src/transaction.h +14 -0
  69. data/vendor/libgit2/src/transports/cred.c +8 -0
  70. data/vendor/libgit2/src/transports/http.c +6 -0
  71. data/vendor/libgit2/src/transports/smart.c +95 -0
  72. data/vendor/libgit2/src/transports/smart.h +1 -0
  73. data/vendor/libgit2/src/transports/smart_pkt.c +9 -2
  74. data/vendor/libgit2/src/transports/ssh.c +5 -3
  75. data/vendor/libgit2/src/transports/winhttp.c +19 -1
  76. data/vendor/libgit2/src/unix/posix.h +14 -1
  77. data/vendor/libgit2/src/util.c +56 -13
  78. data/vendor/libgit2/src/util.h +13 -5
  79. data/vendor/libgit2/src/win32/path_w32.c +15 -8
  80. data/vendor/libgit2/src/win32/posix_w32.c +11 -2
  81. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +343 -0
  82. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +93 -0
  83. data/vendor/libgit2/src/win32/w32_stack.c +192 -0
  84. data/vendor/libgit2/src/win32/w32_stack.h +138 -0
  85. data/vendor/libgit2/src/win32/w32_util.c +29 -5
  86. data/vendor/libgit2/src/win32/w32_util.h +13 -3
  87. metadata +11 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4df2826e70f1fb3fb4b440f2fc459b0d9fca6511
4
- data.tar.gz: 69765b8342fc60b5e78244b6bd5316c4d2f0d8bc
3
+ metadata.gz: 9cbd379f155df87669ec3b453094bf4883ab30e5
4
+ data.tar.gz: 05db49343e6d30304224ac60e4c12ca3feea853f
5
5
  SHA512:
6
- metadata.gz: 981a484bf2d8fe7d7aa706304980809be6fdd2b179bbd8c01832bb7f8eac485487cfd1a608d104b798079169012d78738ded561824301278830b14846f70dc14
7
- data.tar.gz: c4d7f8b3670e499c6878586d4aa1564e8e2cbde7ebaf72e4548bc3be0ea4897231227a852645243f1cdd3a79154f5fc3fe47c334a85f25495ec08607bf648f34
6
+ metadata.gz: 3eca55c77bfdab68087f3ce9883485755f80968c77693828c9bb12c9bd54f0cd4544a62536e64b3bd16ac98640b37113194f693f08afcc7c8a5375987d4fddcf
7
+ data.tar.gz: 49e8e55c6cd7593e671f123099b8330076767eef59edde22a134262d1d594e137819c5917e500e5f843b90943f0af210998f7ea99b71d970a6a643c9ab4427fa
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2014 GitHub, Inc
3
+ Copyright (c) 2015 GitHub, Inc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -109,6 +109,29 @@ static VALUE rb_git_features(VALUE self)
109
109
  return ret_arr;
110
110
  }
111
111
 
112
+ /*
113
+ * call-seq:
114
+ * Rugged.valid_full_oid?(oid) -> true or false
115
+ *
116
+ * Checks to see if a string contains a full 40-character sha1.
117
+ *
118
+ * Rugged.valid_full_oid?('d8786bfc97485e8d7b19b21fb88c8ef1f199fc3f')
119
+ * #=> true
120
+ */
121
+ static VALUE rb_git_valid_full_oid(VALUE self, VALUE hex)
122
+ {
123
+ git_oid oid;
124
+ int errorcode;
125
+
126
+ Check_Type(hex, T_STRING);
127
+ errorcode = git_oid_fromstr(&oid, StringValueCStr(hex));
128
+ if (errorcode < 0) {
129
+ return Qfalse;
130
+ } else {
131
+ return Qtrue;
132
+ }
133
+ }
134
+
112
135
  /*
113
136
  * call-seq:
114
137
  * Rugged.hex_to_raw(oid) -> raw_buffer
@@ -421,6 +444,7 @@ void Init_rugged(void)
421
444
 
422
445
  rb_define_module_function(rb_mRugged, "libgit2_version", rb_git_libgit2_version, 0);
423
446
  rb_define_module_function(rb_mRugged, "features", rb_git_features, 0);
447
+ rb_define_module_function(rb_mRugged, "valid_full_oid?", rb_git_valid_full_oid, 1);
424
448
  rb_define_module_function(rb_mRugged, "hex_to_raw", rb_git_hex_to_raw, 1);
425
449
  rb_define_module_function(rb_mRugged, "raw_to_hex", rb_git_raw_to_hex, 1);
426
450
  rb_define_module_function(rb_mRugged, "minimize_oid", rb_git_minimize_oid, -1);
@@ -306,6 +306,69 @@ static VALUE rb_git_config_open_default(VALUE klass)
306
306
  return rugged_config_new(klass, Qnil, cfg);
307
307
  }
308
308
 
309
+ /*
310
+ * call-seq:
311
+ * config.snapshot -> snapshot
312
+ *
313
+ * Create a snapshot of the configuration.
314
+ *
315
+ * Provides a consistent, read-only view of the configuration for
316
+ * looking up complex values from a configuration.
317
+ */
318
+ static VALUE rb_git_config_snapshot(VALUE self)
319
+ {
320
+ git_config *config, *snapshot;
321
+
322
+ Data_Get_Struct(self, git_config, config);
323
+
324
+ rugged_exception_check(
325
+ git_config_snapshot(&snapshot, config)
326
+ );
327
+
328
+ return rugged_config_new(rb_obj_class(self), Qnil, snapshot);
329
+ }
330
+
331
+ /*
332
+ * call-seq:
333
+ * config.transaction { |config| }
334
+ *
335
+ * Perform configuration changes in a transaction.
336
+ *
337
+ * Locks the configuration, executes the given block and stores
338
+ * any changes that were made to the configuration. If the block
339
+ * throws an exception, all changes are rolled back automatically.
340
+ *
341
+ * During the execution of the block, configuration changes don't
342
+ * get stored to disk immediately, so reading from the configuration
343
+ * will continue to return the values that were stored in the configuration
344
+ * when the transaction was started.
345
+ */
346
+ static VALUE rb_git_config_transaction(VALUE self)
347
+ {
348
+ git_config *config;
349
+ git_transaction *tx;
350
+ VALUE rb_result;
351
+ int error = 0, exception = 0;
352
+
353
+ Data_Get_Struct(self, git_config, config);
354
+
355
+ git_config_lock(&tx, config);
356
+
357
+ rb_result = rb_protect(rb_yield, self, &exception);
358
+
359
+ if (!exception)
360
+ error = git_transaction_commit(tx);
361
+
362
+ git_transaction_free(tx);
363
+
364
+ if (exception)
365
+ rb_jump_tag(exception);
366
+ else if (error)
367
+ rugged_exception_check(error);
368
+
369
+ return rb_result;
370
+ }
371
+
309
372
  void Init_rugged_config(void)
310
373
  {
311
374
  /*
@@ -330,4 +393,6 @@ void Init_rugged_config(void)
330
393
  rb_define_method(rb_cRuggedConfig, "each", rb_git_config_each_pair, 0);
331
394
  rb_define_method(rb_cRuggedConfig, "to_hash", rb_git_config_to_hash, 0);
332
395
 
396
+ rb_define_method(rb_cRuggedConfig, "snapshot", rb_git_config_snapshot, 0);
397
+ rb_define_method(rb_cRuggedConfig, "transaction", rb_git_config_transaction, 0);
333
398
  }
@@ -181,6 +181,19 @@ void rugged_remote_init_callbacks_and_payload_from_options(
181
181
  }
182
182
  }
183
183
 
184
+ static int parse_prune_type(VALUE rb_prune_type)
185
+ {
186
+ if (rb_prune_type == Qtrue) {
187
+ return GIT_FETCH_PRUNE;
188
+ } else if (rb_prune_type == Qfalse) {
189
+ return GIT_FETCH_NO_PRUNE;
190
+ } else if (rb_prune_type == Qnil) {
191
+ return GIT_FETCH_PRUNE_UNSPECIFIED;
192
+ } else {
193
+ rb_raise(rb_eTypeError, "wrong argument type for :prune (expected true, false or nil)");
194
+ }
195
+ }
196
+
184
197
  static void rb_git_remote__free(git_remote *remote)
185
198
  {
186
199
  git_remote_free(remote);
@@ -264,7 +277,7 @@ static VALUE rb_git_remote_ls(int argc, VALUE *argv, VALUE self)
264
277
 
265
278
  rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload);
266
279
 
267
- if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks)) ||
280
+ if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks, NULL)) ||
268
281
  (error = git_remote_ls(&heads, &heads_len, remote)))
269
282
  goto cleanup;
270
283
 
@@ -458,7 +471,7 @@ static VALUE rb_git_remote_check_connection(int argc, VALUE *argv, VALUE self)
458
471
 
459
472
  rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload);
460
473
 
461
- error = git_remote_connect(remote, direction, &callbacks);
474
+ error = git_remote_connect(remote, direction, &callbacks, NULL);
462
475
  git_remote_disconnect(remote);
463
476
 
464
477
  if (payload.exception)
@@ -502,6 +515,10 @@ static VALUE rb_git_remote_check_connection(int argc, VALUE *argv, VALUE self)
502
515
  * :message ::
503
516
  * The message to insert into the reflogs. Defaults to "fetch".
504
517
  *
518
+ * :prune ::
519
+ * Specifies the prune mode for the fetch. +true+ remove any remote-tracking references that
520
+ * no longer exist, +false+ do not prune, +nil+ use configured settings Defaults to "nil".
521
+ *
505
522
  * Example:
506
523
  *
507
524
  * remote = Rugged::Remote.lookup(@repo, 'origin')
@@ -536,6 +553,9 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
536
553
  VALUE rb_val = rb_hash_aref(rb_options, CSTR2SYM("message"));
537
554
  if (!NIL_P(rb_val))
538
555
  log_message = StringValueCStr(rb_val);
556
+
557
+ VALUE rb_prune_type = rb_hash_aref(rb_options, CSTR2SYM("prune"));
558
+ opts.prune = parse_prune_type(rb_prune_type);
539
559
  }
540
560
 
541
561
  error = git_remote_fetch(remote, &refspecs, &opts, log_message);
@@ -215,7 +215,11 @@ static void rugged_repo_new_with_backend(git_repository **repo, VALUE rb_path, V
215
215
  if (error) goto cleanup;
216
216
 
217
217
  error = git_odb_add_backend(odb, odb_backend, 1);
218
- if (error) goto cleanup;
218
+ if (error) {
219
+ assert(odb_backend->free);
220
+ odb_backend->free(odb_backend);
221
+ goto cleanup;
222
+ }
219
223
 
220
224
  error = git_repository_wrap_odb(repo, odb);
221
225
  if (error) goto cleanup;
@@ -224,7 +228,11 @@ static void rugged_repo_new_with_backend(git_repository **repo, VALUE rb_path, V
224
228
  if (error) goto cleanup;
225
229
 
226
230
  error = backend->refdb_backend(&refdb_backend, backend, path);
227
- if (error) goto cleanup;
231
+ if (error) {
232
+ assert(refdb_backend->free);
233
+ refdb_backend->free(refdb_backend);
234
+ goto cleanup;
235
+ }
228
236
 
229
237
  error = git_refdb_set_backend(refdb, refdb_backend);
230
238
  if (error) goto cleanup;
@@ -248,9 +256,6 @@ cleanup:
248
256
  git_odb_free(odb);
249
257
  git_refdb_free(refdb);
250
258
 
251
- if (odb_backend != NULL) odb_backend->free(odb_backend);
252
- if (refdb_backend != NULL) refdb_backend->free(refdb_backend);
253
-
254
259
  rugged_exception_check(error);
255
260
  }
256
261
 
@@ -815,8 +815,11 @@ static VALUE rb_git_treebuilder_remove(VALUE self, VALUE path)
815
815
  Check_Type(path, T_STRING);
816
816
 
817
817
  error = git_treebuilder_remove(builder, StringValueCStr(path));
818
- if (error == GIT_ENOTFOUND)
818
+ if (error == GIT_ENOTFOUND) {
819
819
  return Qfalse;
820
+ } else if (error == GIT_ERROR && giterr_last()->klass == GITERR_TREE) {
821
+ return Qfalse;
822
+ }
820
823
 
821
824
  rugged_exception_check(error);
822
825
  return Qtrue;
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.23.3'
2
+ Version = VERSION = '0.24.0b0'
3
3
  end
@@ -19,6 +19,7 @@ CMAKE_POLICY(SET CMP0015 NEW)
19
19
  SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
20
20
 
21
21
  INCLUDE(CheckLibraryExists)
22
+ INCLUDE(CheckFunctionExists)
22
23
  INCLUDE(AddCFlagIfSupported)
23
24
  INCLUDE(FindPkgConfig)
24
25
 
@@ -59,6 +60,10 @@ IF(MSVC)
59
60
  # are linking statically
60
61
  OPTION( STATIC_CRT "Link the static CRT libraries" ON )
61
62
 
63
+ # If you want to embed a copy of libssh2 into libgit2, pass a
64
+ # path to libssh2
65
+ OPTION( EMBED_SSH_PATH "Path to libssh2 to embed (Windows)" OFF )
66
+
62
67
  ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
63
68
  ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
64
69
  ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
@@ -95,6 +100,23 @@ SET(BIN_INSTALL_DIR bin CACHE PATH "Where to install binaries to.")
95
100
  SET(LIB_INSTALL_DIR lib CACHE PATH "Where to install libraries to.")
96
101
  SET(INCLUDE_INSTALL_DIR include CACHE PATH "Where to install headers to.")
97
102
 
103
+ # Set a couple variables to be substituted inside the .pc file.
104
+ # We can't just use LIB_INSTALL_DIR in the .pc file, as passing them as absolue
105
+ # or relative paths is both valid and supported by cmake.
106
+ SET (PKGCONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
107
+
108
+ IF(IS_ABSOLUTE ${LIB_INSTALL_DIR})
109
+ SET (PKGCONFIG_LIBDIR ${LIB_INSTALL_DIR})
110
+ ELSE(IS_ABSOLUTE ${LIB_INSTALL_DIR})
111
+ SET (PKGCONFIG_LIBDIR "\${prefix}/${LIB_INSTALL_DIR}")
112
+ ENDIF (IS_ABSOLUTE ${LIB_INSTALL_DIR})
113
+
114
+ IF(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
115
+ SET (PKGCONFIG_INCLUDEDIR ${INCLUDE_INSTALL_DIR})
116
+ ELSE(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
117
+ SET (PKGCONFIG_INCLUDEDIR "\${prefix}/${INCLUDE_INSTALL_DIR}")
118
+ ENDIF(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
119
+
98
120
  FUNCTION(TARGET_OS_LIBRARIES target)
99
121
  IF(WIN32)
100
122
  TARGET_LINK_LIBRARIES(${target} ws2_32)
@@ -172,6 +194,13 @@ IF (COREFOUNDATION_FOUND)
172
194
  ENDIF()
173
195
 
174
196
 
197
+ IF (WIN32 AND EMBED_SSH_PATH)
198
+ FILE(GLOB SRC_SSH "${EMBED_SSH_PATH}/src/*.c")
199
+ INCLUDE_DIRECTORIES("${EMBED_SSH_PATH}/include")
200
+ FILE(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"")
201
+ ADD_DEFINITIONS(-DGIT_SSH)
202
+ ENDIF()
203
+
175
204
  IF (WIN32 AND WINHTTP)
176
205
  ADD_DEFINITIONS(-DGIT_WINHTTP)
177
206
  INCLUDE_DIRECTORIES(deps/http-parser)
@@ -346,6 +375,7 @@ IF (MSVC)
346
375
 
347
376
  IF (MSVC_CRTDBG)
348
377
  SET(CRT_FLAG_DEBUG "${CRT_FLAG_DEBUG} /DGIT_MSVC_CRTDBG")
378
+ SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}" "Dbghelp.lib")
349
379
  ENDIF()
350
380
 
351
381
  # /Zi - Create debugging information
@@ -440,6 +470,21 @@ ELSE ()
440
470
  ENDIF ()
441
471
  ENDIF()
442
472
 
473
+ CHECK_FUNCTION_EXISTS(futimens HAVE_FUTIMENS)
474
+ IF (HAVE_FUTIMENS)
475
+ ADD_DEFINITIONS(-DHAVE_FUTIMENS)
476
+ ENDIF ()
477
+
478
+ CHECK_FUNCTION_EXISTS(qsort_r HAVE_QSORT_R)
479
+ IF (HAVE_QSORT_R)
480
+ ADD_DEFINITIONS(-DHAVE_QSORT_R)
481
+ ENDIF ()
482
+
483
+ CHECK_FUNCTION_EXISTS(qsort_s HAVE_QSORT_S)
484
+ IF (HAVE_QSORT_S)
485
+ ADD_DEFINITIONS(-DHAVE_QSORT_S)
486
+ ENDIF ()
487
+
443
488
  IF( NOT CMAKE_CONFIGURATION_TYPES )
444
489
  # Build Debug by default
445
490
  IF (NOT CMAKE_BUILD_TYPE)
@@ -500,7 +545,7 @@ ELSE()
500
545
  ENDIF()
501
546
 
502
547
  # Compile and link libgit2
503
- ADD_LIBRARY(git2 ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1} ${WIN_RC})
548
+ ADD_LIBRARY(git2 ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SSH} ${SRC_SHA1} ${WIN_RC})
504
549
  TARGET_LINK_LIBRARIES(git2 ${SECURITY_DIRS})
505
550
  TARGET_LINK_LIBRARIES(git2 ${COREFOUNDATION_DIRS})
506
551
  TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES})
@@ -570,7 +615,7 @@ IF (BUILD_CLAR)
570
615
  ${CLAR_PATH}/clar.c
571
616
  PROPERTIES OBJECT_DEPENDS ${CLAR_PATH}/clar.suite)
572
617
 
573
- ADD_EXECUTABLE(libgit2_clar ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_CLAR} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1})
618
+ ADD_EXECUTABLE(libgit2_clar ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_CLAR} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SSH} ${SRC_SHA1})
574
619
 
575
620
  TARGET_LINK_LIBRARIES(libgit2_clar ${COREFOUNDATION_DIRS})
576
621
  TARGET_LINK_LIBRARIES(libgit2_clar ${SECURITY_DIRS})
@@ -691,6 +691,24 @@ GIT_EXTERN(int) git_config_backend_foreach_match(
691
691
  void *payload);
692
692
 
693
693
 
694
+ /**
695
+ * Lock the backend with the highest priority
696
+ *
697
+ * Locking disallows anybody else from writing to that backend. Any
698
+ * updates made after locking will not be visible to a reader until
699
+ * the file is unlocked.
700
+ *
701
+ * You can apply the changes by calling `git_transaction_commit()`
702
+ * before freeing the transaction. Either of these actions will unlock
703
+ * the config.
704
+ *
705
+ * @param tx the resulting transaction, use this to commit or undo the
706
+ * changes
707
+ * @param cfg the configuration in which to lock
708
+ * @return 0 or an error code
709
+ */
710
+ GIT_EXTERN(int) git_config_lock(git_transaction **tx, git_config *cfg);
711
+
694
712
  /** @} */
695
713
  GIT_END_DECL
696
714
  #endif
@@ -129,8 +129,12 @@ typedef enum {
129
129
  */
130
130
  GIT_DIFF_INCLUDE_CASECHANGE = (1u << 11),
131
131
 
132
- /** If the pathspec is set in the diff options, this flags means to
133
- * apply it as an exact match instead of as an fnmatch pattern.
132
+ /** If the pathspec is set in the diff options, this flags indicates
133
+ * that the paths will be treated as literal paths instead of
134
+ * fnmatch patterns. Each path in the list must either be a full
135
+ * path to a file or a directory. (A trailing slash indicates that
136
+ * the path will _only_ match a directory). If a directory is
137
+ * specified, all children will be included.
134
138
  */
135
139
  GIT_DIFF_DISABLE_PATHSPEC_MATCH = (1u << 12),
136
140
 
@@ -835,6 +839,25 @@ GIT_EXTERN(int) git_diff_tree_to_workdir_with_index(
835
839
  git_tree *old_tree,
836
840
  const git_diff_options *opts); /**< can be NULL for defaults */
837
841
 
842
+ /**
843
+ * Create a diff with the difference between two index objects.
844
+ *
845
+ * The first index will be used for the "old_file" side of the delta and the
846
+ * second index will be used for the "new_file" side of the delta.
847
+ *
848
+ * @param diff Output pointer to a git_diff pointer to be allocated.
849
+ * @param repo The repository containing the indexes.
850
+ * @param old_index A git_index object to diff from.
851
+ * @param new_index A git_index object to diff to.
852
+ * @param opts Structure with options to influence diff or NULL for defaults.
853
+ */
854
+ GIT_EXTERN(int) git_diff_index_to_index(
855
+ git_diff **diff,
856
+ git_repository *repo,
857
+ git_index *old_index,
858
+ git_index *new_index,
859
+ const git_diff_options *opts); /**< can be NULL for defaults */
860
+
838
861
  /**
839
862
  * Merge one diff into another.
840
863
  *
@@ -113,18 +113,6 @@ GIT_EXTERN(const git_error *) giterr_last(void);
113
113
  */
114
114
  GIT_EXTERN(void) giterr_clear(void);
115
115
 
116
- /**
117
- * Get the last error data and clear it.
118
- *
119
- * This copies the last error into the given `git_error` struct
120
- * and returns 0 if the copy was successful, leaving the error
121
- * cleared as if `giterr_clear` had been called.
122
- *
123
- * If there was no existing error in the library, -1 will be returned
124
- * and the contents of `cpy` will be left unmodified.
125
- */
126
- GIT_EXTERN(int) giterr_detach(git_error *cpy);
127
-
128
116
  /**
129
117
  * Set the error message string for this thread.
130
118
  *
@@ -643,6 +643,17 @@ GIT_EXTERN(int) git_index_update_all(
643
643
  */
644
644
  GIT_EXTERN(int) git_index_find(size_t *at_pos, git_index *index, const char *path);
645
645
 
646
+ /**
647
+ * Find the first position of any entries matching a prefix. To find the first position
648
+ * of a path inside a given folder, suffix the prefix with a '/'.
649
+ *
650
+ * @param at_pos the address to which the position of the index entry is written (optional)
651
+ * @param index an existing index object
652
+ * @param prefix the prefix to search for
653
+ * @return 0 with valid value in at_pos; an error code otherwise
654
+ */
655
+ GIT_EXTERN(int) git_index_find_prefix(size_t *at_pos, git_index *index, const char *prefix);
656
+
646
657
  /**@}*/
647
658
 
648
659
  /** @name Conflict Index Entry Functions