rugged 0.26.0b5 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged.c +24 -0
  3. data/ext/rugged/rugged.h +2 -0
  4. data/ext/rugged/rugged_signature.c +15 -2
  5. data/lib/rugged/version.rb +1 -1
  6. data/vendor/libgit2/CMakeLists.txt +9 -8
  7. data/vendor/libgit2/include/git2/common.h +29 -0
  8. data/vendor/libgit2/include/git2/errors.h +2 -0
  9. data/vendor/libgit2/include/git2/global.h +1 -1
  10. data/vendor/libgit2/include/git2/odb.h +2 -2
  11. data/vendor/libgit2/include/git2/odb_backend.h +1 -1
  12. data/vendor/libgit2/include/git2/remote.h +3 -3
  13. data/vendor/libgit2/include/git2/repository.h +2 -2
  14. data/vendor/libgit2/include/git2/sys/filter.h +11 -0
  15. data/vendor/libgit2/include/git2/sys/merge.h +5 -5
  16. data/vendor/libgit2/include/git2/sys/transport.h +10 -0
  17. data/vendor/libgit2/include/git2/transport.h +6 -6
  18. data/vendor/libgit2/include/git2/version.h +3 -3
  19. data/vendor/libgit2/include/git2/worktree.h +69 -10
  20. data/vendor/libgit2/libgit2.pc.in +2 -2
  21. data/vendor/libgit2/src/attr_file.c +6 -2
  22. data/vendor/libgit2/src/attrcache.c +7 -5
  23. data/vendor/libgit2/src/blame_git.c +12 -8
  24. data/vendor/libgit2/src/branch.c +17 -48
  25. data/vendor/libgit2/src/buffer.c +11 -12
  26. data/vendor/libgit2/src/buffer.h +2 -2
  27. data/vendor/libgit2/src/checkout.c +3 -6
  28. data/vendor/libgit2/src/config.c +42 -35
  29. data/vendor/libgit2/src/config_cache.c +1 -0
  30. data/vendor/libgit2/src/config_file.c +19 -11
  31. data/vendor/libgit2/src/config_file.h +1 -0
  32. data/vendor/libgit2/src/diff.c +35 -0
  33. data/vendor/libgit2/src/diff_parse.c +7 -1
  34. data/vendor/libgit2/src/filebuf.c +12 -1
  35. data/vendor/libgit2/src/filebuf.h +3 -1
  36. data/vendor/libgit2/src/fileops.c +83 -22
  37. data/vendor/libgit2/src/fileops.h +25 -0
  38. data/vendor/libgit2/src/filter.c +30 -14
  39. data/vendor/libgit2/src/global.c +1 -1
  40. data/vendor/libgit2/src/hash/hash_collisiondetect.h +1 -11
  41. data/vendor/libgit2/src/hash/sha1dc/sha1.c +894 -187
  42. data/vendor/libgit2/src/hash/sha1dc/sha1.h +69 -53
  43. data/vendor/libgit2/src/hash/sha1dc/ubc_check.c +13 -2
  44. data/vendor/libgit2/src/hash/sha1dc/ubc_check.h +20 -3
  45. data/vendor/libgit2/src/idxmap.c +1 -1
  46. data/vendor/libgit2/src/idxmap.h +1 -2
  47. data/vendor/libgit2/src/index.c +75 -42
  48. data/vendor/libgit2/src/indexer.c +31 -11
  49. data/vendor/libgit2/src/indexer.h +12 -0
  50. data/vendor/libgit2/src/merge.c +20 -0
  51. data/vendor/libgit2/src/merge_driver.c +29 -0
  52. data/vendor/libgit2/src/odb.c +96 -19
  53. data/vendor/libgit2/src/odb.h +25 -0
  54. data/vendor/libgit2/src/odb_loose.c +20 -6
  55. data/vendor/libgit2/src/odb_pack.c +1 -1
  56. data/vendor/libgit2/src/offmap.c +1 -1
  57. data/vendor/libgit2/src/offmap.h +1 -2
  58. data/vendor/libgit2/src/oidmap.c +1 -1
  59. data/vendor/libgit2/src/oidmap.h +1 -2
  60. data/vendor/libgit2/src/openssl_stream.c +11 -4
  61. data/vendor/libgit2/src/pack-objects.c +4 -0
  62. data/vendor/libgit2/src/pack-objects.h +1 -0
  63. data/vendor/libgit2/src/pack.c +5 -3
  64. data/vendor/libgit2/src/patch_generate.c +8 -79
  65. data/vendor/libgit2/src/patch_parse.c +5 -4
  66. data/vendor/libgit2/src/path.c +9 -7
  67. data/vendor/libgit2/src/posix.c +2 -0
  68. data/vendor/libgit2/src/posix.h +10 -0
  69. data/vendor/libgit2/src/rebase.c +12 -10
  70. data/vendor/libgit2/src/refdb_fs.c +33 -10
  71. data/vendor/libgit2/src/refs.c +89 -8
  72. data/vendor/libgit2/src/refs.h +14 -0
  73. data/vendor/libgit2/src/remote.c +9 -10
  74. data/vendor/libgit2/src/repository.c +178 -146
  75. data/vendor/libgit2/src/repository.h +25 -0
  76. data/vendor/libgit2/src/revparse.c +22 -3
  77. data/vendor/libgit2/src/revwalk.c +6 -3
  78. data/vendor/libgit2/src/settings.c +22 -1
  79. data/vendor/libgit2/src/signature.c +4 -1
  80. data/vendor/libgit2/src/socket_stream.c +2 -4
  81. data/vendor/libgit2/src/strmap.c +1 -1
  82. data/vendor/libgit2/src/strmap.h +1 -3
  83. data/vendor/libgit2/src/submodule.c +27 -7
  84. data/vendor/libgit2/src/sysdir.c +11 -0
  85. data/vendor/libgit2/src/sysdir.h +12 -0
  86. data/vendor/libgit2/src/transports/http.c +3 -0
  87. data/vendor/libgit2/src/transports/smart.c +6 -0
  88. data/vendor/libgit2/src/transports/smart_protocol.c +2 -1
  89. data/vendor/libgit2/src/transports/ssh.c +13 -1
  90. data/vendor/libgit2/src/transports/winhttp.c +1 -2
  91. data/vendor/libgit2/src/tree.c +13 -11
  92. data/vendor/libgit2/src/unix/posix.h +6 -1
  93. data/vendor/libgit2/src/varint.c +1 -1
  94. data/vendor/libgit2/src/win32/posix.h +3 -0
  95. data/vendor/libgit2/src/win32/posix_w32.c +334 -111
  96. data/vendor/libgit2/src/worktree.c +174 -48
  97. data/vendor/libgit2/src/worktree.h +1 -1
  98. metadata +77 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b927352d26a826277bd5f866ee6e8f0b5704379d
4
- data.tar.gz: 3df1c9b13364f823dee2891e932e082e6bdd3bfd
3
+ metadata.gz: 00dc4be07e74ecacd93b283a4a08ab9898917efc
4
+ data.tar.gz: 78157063c06d0a8284540a7d9faff8019e85a44b
5
5
  SHA512:
6
- metadata.gz: 082321e079c24fe51c612390093fa5ebe7115cf42f155bd59a6e91beefe97502dc37921642e2f8b8752f2f9ccc4896aa1e5fd9b202ddbdb061147b995dc845f9
7
- data.tar.gz: 9d083d266fa2682af1c0bbc5349efbfe71a6be588276fd7918749488b029dcab3d33991bda61c4af29220c085ceeb66c6c83d0dbb0021494a9efbee7b4a10286
6
+ metadata.gz: ddf4ca9fac0689ac29b64069e15a58c98404ba88318ba8f878f523072794d00e5da83fbd88085ea333ff91c580aa3904fbcf03b832ee804bed65e54fc8d4b2ac
7
+ data.tar.gz: d35d87d0cbc0baee1d89daadb6cfacc9f90a12c4fae94a26f29c032c5eae81d84a2a147846e3308576058ea5ff64c68f27a500e7d1ffaa28c35c8e795f357627
@@ -368,6 +368,29 @@ static VALUE rb_git_cache_usage(VALUE self)
368
368
  return rb_ary_new3(2, LL2NUM(used), LL2NUM(max));
369
369
  }
370
370
 
371
+ /*
372
+ * call-seq:
373
+ * Rugged.signature_from_buffer(buffer[, encoding_name]) -> signature
374
+ *
375
+ * Parse the signature from the given buffer. If an encoding is given, the
376
+ * strings will be tagged with that encoding.
377
+ *
378
+ * commit.author #=> {:email=>"tanoku@gmail.com", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"}
379
+ */
380
+ static VALUE rb_git_signature_from_buffer(int argc, VALUE *argv, VALUE self)
381
+ {
382
+ VALUE rb_buffer, rb_encoding_name;
383
+ const char *buffer, *encoding_name = NULL;
384
+
385
+ rb_scan_args(argc, argv, "11", &rb_buffer, &rb_encoding_name);
386
+
387
+ buffer = StringValueCStr(rb_buffer);
388
+ if (!NIL_P(rb_encoding_name))
389
+ encoding_name = StringValueCStr(rb_encoding_name);
390
+
391
+ return rugged_signature_from_buffer(buffer, encoding_name);
392
+ }
393
+
371
394
  VALUE rugged_strarray_to_rb_ary(git_strarray *str_array)
372
395
  {
373
396
  VALUE rb_array = rb_ary_new2(str_array->count);
@@ -520,6 +543,7 @@ void Init_rugged(void)
520
543
  rb_define_module_function(rb_mRugged, "minimize_oid", rb_git_minimize_oid, -1);
521
544
  rb_define_module_function(rb_mRugged, "prettify_message", rb_git_prettify_message, -1);
522
545
  rb_define_module_function(rb_mRugged, "__cache_usage__", rb_git_cache_usage, 0);
546
+ rb_define_module_function(rb_mRugged, "signature_from_buffer", rb_git_signature_from_buffer, -1);
523
547
 
524
548
  Init_rugged_reference();
525
549
  Init_rugged_reference_collection();
@@ -96,6 +96,8 @@ git_object *rugged_object_get(git_repository *repo, VALUE object_value, git_otyp
96
96
  int rugged_oid_get(git_oid *oid, git_repository *repo, VALUE p);
97
97
  const char * rugged_refname_from_string_or_ref(VALUE rb_name_or_ref);
98
98
 
99
+ VALUE rugged_signature_from_buffer(const char *buffer, const char *encoding_name);
100
+
99
101
  void rugged_rb_ary_to_strarray(VALUE rb_array, git_strarray *str_array);
100
102
  VALUE rugged_strarray_to_rb_ary(git_strarray *str_array);
101
103
 
@@ -35,6 +35,19 @@ VALUE rugged_signature_new(const git_signature *sig, const char *encoding_name)
35
35
  return rb_sig;
36
36
  }
37
37
 
38
+ VALUE rugged_signature_from_buffer(const char *buffer, const char *encoding_name)
39
+ {
40
+ git_signature *sig;
41
+ VALUE rb_ret;
42
+
43
+ rugged_exception_check(git_signature_from_buffer(&sig, buffer));
44
+
45
+ rb_ret = rugged_signature_new(sig, encoding_name);
46
+ git_signature_free(sig);
47
+
48
+ return rb_ret;
49
+ }
50
+
38
51
  git_signature *rugged_signature_get(VALUE rb_sig, git_repository *repo)
39
52
  {
40
53
  int error;
@@ -50,8 +63,8 @@ git_signature *rugged_signature_get(VALUE rb_sig, git_repository *repo)
50
63
 
51
64
  Check_Type(rb_sig, T_HASH);
52
65
 
53
- rb_name = rb_hash_aref(rb_sig, CSTR2SYM("name"));
54
- rb_email = rb_hash_aref(rb_sig, CSTR2SYM("email"));
66
+ rb_name = rb_hash_fetch(rb_sig, CSTR2SYM("name"));
67
+ rb_email = rb_hash_fetch(rb_sig, CSTR2SYM("email"));
55
68
  rb_time = rb_hash_aref(rb_sig, CSTR2SYM("time"));
56
69
  rb_time_offset = rb_hash_aref(rb_sig, CSTR2SYM("time_offset"));
57
70
 
@@ -4,5 +4,5 @@
4
4
  # For full terms see the included LICENSE file.
5
5
 
6
6
  module Rugged
7
- Version = VERSION = '0.26.0b5'
7
+ Version = VERSION = '0.26.0'
8
8
  end
@@ -238,6 +238,7 @@ ENDIF()
238
238
 
239
239
  IF (WIN32 AND WINHTTP)
240
240
  ADD_DEFINITIONS(-DGIT_WINHTTP)
241
+ ADD_DEFINITIONS(-DGIT_HTTPS)
241
242
 
242
243
  # Since MinGW does not come with headers or an import library for winhttp,
243
244
  # we have to include a private header and generate our own import library
@@ -295,6 +296,9 @@ ENDIF()
295
296
  # Specify sha1 implementation
296
297
  IF (USE_SHA1DC)
297
298
  ADD_DEFINITIONS(-DGIT_SHA1_COLLISIONDETECT)
299
+ ADD_DEFINITIONS(-DSHA1DC_NO_STANDARD_INCLUDES=1)
300
+ ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\")
301
+ ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\")
298
302
  FILE(GLOB SRC_SHA1 src/hash/hash_collisiondetect.c src/hash/sha1dc/*)
299
303
  ELSEIF (WIN32 AND NOT MINGW)
300
304
  ADD_DEFINITIONS(-DGIT_SHA1_WIN32)
@@ -464,9 +468,6 @@ IF (MSVC)
464
468
  SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
465
469
 
466
470
  SET(WIN_RC "src/win32/git2.rc")
467
-
468
- # Precompiled headers
469
-
470
471
  ELSE ()
471
472
  SET(CMAKE_C_FLAGS "-D_GNU_SOURCE ${CMAKE_C_FLAGS}")
472
473
 
@@ -477,9 +478,7 @@ ELSE ()
477
478
  SET(CMAKE_C_FLAGS "-std=c99 -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS ${CMAKE_C_FLAGS}")
478
479
  ENDIF()
479
480
 
480
- IF (WIN32 AND NOT CYGWIN)
481
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
482
- ENDIF ()
481
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O0")
483
482
 
484
483
  IF (MINGW OR MSYS) # MinGW and MSYS always do PIC and complain if we tell them to
485
484
  STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
@@ -546,11 +545,13 @@ ENDIF()
546
545
 
547
546
  IF (SECURITY_FOUND)
548
547
  ADD_DEFINITIONS(-DGIT_SECURE_TRANSPORT)
548
+ ADD_DEFINITIONS(-DGIT_HTTPS)
549
549
  INCLUDE_DIRECTORIES(${SECURITY_INCLUDE_DIR})
550
550
  ENDIF ()
551
551
 
552
552
  IF (OPENSSL_FOUND)
553
553
  ADD_DEFINITIONS(-DGIT_OPENSSL)
554
+ ADD_DEFINITIONS(-DGIT_HTTPS)
554
555
  INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
555
556
  SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES})
556
557
  ENDIF()
@@ -703,9 +704,9 @@ IF (BUILD_CLAR)
703
704
 
704
705
  ENABLE_TESTING()
705
706
  IF (WINHTTP OR OPENSSL_FOUND OR SECURITY_FOUND)
706
- ADD_TEST(libgit2_clar libgit2_clar -ionline)
707
+ ADD_TEST(libgit2_clar libgit2_clar -ionline -xclone::local::git_style_unc_paths -xclone::local::standard_unc_paths_are_written_git_style)
707
708
  ELSE ()
708
- ADD_TEST(libgit2_clar libgit2_clar -v)
709
+ ADD_TEST(libgit2_clar libgit2_clar -v -xclone::local::git_style_unc_paths -xclone::local::standard_unc_paths_are_written_git_style)
709
710
  ENDIF ()
710
711
 
711
712
  # Add a test target which runs the cred callback tests, to be
@@ -179,6 +179,10 @@ typedef enum {
179
179
  GIT_OPT_SET_SSL_CIPHERS,
180
180
  GIT_OPT_GET_USER_AGENT,
181
181
  GIT_OPT_ENABLE_OFS_DELTA,
182
+ GIT_OPT_ENABLE_FSYNC_GITDIR,
183
+ GIT_OPT_GET_WINDOWS_SHAREMODE,
184
+ GIT_OPT_SET_WINDOWS_SHAREMODE,
185
+ GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION,
182
186
  } git_libgit2_opt_t;
183
187
 
184
188
  /**
@@ -283,6 +287,17 @@ typedef enum {
283
287
  * > - `user_agent` is the value that will be delivered as the
284
288
  * > User-Agent header on HTTP requests.
285
289
  *
290
+ * * opts(GIT_OPT_SET_WINDOWS_SHAREMODE, unsigned long value)
291
+ *
292
+ * > Set the share mode used when opening files on Windows.
293
+ * > For more information, see the documentation for CreateFile.
294
+ * > The default is: FILE_SHARE_READ | FILE_SHARE_WRITE. This is
295
+ * > ignored and unused on non-Windows platforms.
296
+ *
297
+ * * opts(GIT_OPT_GET_WINDOWS_SHAREMODE, unsigned long *value)
298
+ *
299
+ * > Get the share mode used when opening files on Windows.
300
+ *
286
301
  * * opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, int enabled)
287
302
  *
288
303
  * > Enable strict input validation when creating new objects
@@ -316,6 +331,20 @@ typedef enum {
316
331
  * > Packfiles containing offset deltas can still be read.
317
332
  * > This defaults to enabled.
318
333
  *
334
+ * * opts(GIT_OPT_ENABLE_FSYNC_GITDIR, int enabled)
335
+ *
336
+ * > Enable synchronized writes of files in the gitdir using `fsync`
337
+ * > (or the platform equivalent) to ensure that new object data
338
+ * > is written to permanent storage, not simply cached. This
339
+ * > defaults to disabled.
340
+ *
341
+ * opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, int enabled)
342
+ *
343
+ * > Enable strict verification of object hashsums when reading
344
+ * > objects from disk. This may impact performance due to an
345
+ * > additional checksum calculation on each object. This defaults
346
+ * > to enabled.
347
+ *
319
348
  * @param option Option key
320
349
  * @param ... value to set the option
321
350
  * @return 0 on success, <0 on failure
@@ -53,6 +53,8 @@ typedef enum {
53
53
 
54
54
  GIT_PASSTHROUGH = -30, /**< Internal only */
55
55
  GIT_ITEROVER = -31, /**< Signals end of iteration with iterator */
56
+ GIT_RETRY = -32, /**< Internal only */
57
+ GIT_EMISMATCH = -33, /**< Hashsum mismatch in object */
56
58
  } git_error_code;
57
59
 
58
60
  /**
@@ -14,7 +14,7 @@ GIT_BEGIN_DECL
14
14
  /**
15
15
  * Init the global state
16
16
  *
17
- * This function must the called before any other libgit2 function in
17
+ * This function must be called before any other libgit2 function in
18
18
  * order to set up global state and threading.
19
19
  *
20
20
  * This function may be called multiple times - it will return the number
@@ -488,7 +488,7 @@ GIT_EXTERN(git_otype) git_odb_object_type(git_odb_object *object);
488
488
  * The backends are checked in relative ordering, based on the
489
489
  * value of the `priority` parameter.
490
490
  *
491
- * Read <odb_backends.h> for more information.
491
+ * Read <sys/odb_backend.h> for more information.
492
492
  *
493
493
  * @param odb database to add the backend to
494
494
  * @param backend pointer to a git_odb_backend instance
@@ -509,7 +509,7 @@ GIT_EXTERN(int) git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int
509
509
  *
510
510
  * Writing is disabled on alternate backends.
511
511
  *
512
- * Read <odb_backends.h> for more information.
512
+ * Read <sys/odb_backend.h> for more information.
513
513
  *
514
514
  * @param odb database to add the backend to
515
515
  * @param backend pointer to a git_odb_backend instance
@@ -39,7 +39,7 @@ GIT_EXTERN(int) git_odb_backend_pack(git_odb_backend **out, const char *objects_
39
39
  * @param out location to store the odb backend pointer
40
40
  * @param objects_dir the Git repository's objects directory
41
41
  * @param compression_level zlib compression level to use
42
- * @param do_fsync whether to do an fsync() after writing (currently ignored)
42
+ * @param do_fsync whether to do an fsync() after writing
43
43
  * @param dir_mode permissions to use creating a directory or 0 for defaults
44
44
  * @param file_mode permissions to use creating a file or 0 for defaults
45
45
  *
@@ -715,8 +715,8 @@ GIT_EXTERN(int) git_remote_prune(git_remote *remote, const git_remote_callbacks
715
715
  * Peform all the steps from a push.
716
716
  *
717
717
  * @param remote the remote to push to
718
- * @param refspecs the refspecs to use for pushing. If none are
719
- * passed, the configured refspecs will be used
718
+ * @param refspecs the refspecs to use for pushing. If NULL or an empty
719
+ * array, the configured refspecs will be used
720
720
  * @param opts options to use for this push
721
721
  */
722
722
  GIT_EXTERN(int) git_remote_push(git_remote *remote,
@@ -796,7 +796,7 @@ GIT_EXTERN(int) git_remote_is_valid_name(const char *remote_name);
796
796
  * for the remote will be removed.
797
797
  *
798
798
  * @param repo the repository in which to act
799
- * @param name the name of the remove to delete
799
+ * @param name the name of the remote to delete
800
800
  * @return 0 on success, or an error code.
801
801
  */
802
802
  GIT_EXTERN(int) git_remote_delete(git_repository *repo, const char *name);
@@ -433,12 +433,12 @@ typedef enum {
433
433
  * item. It will thereby honor things like the repository's
434
434
  * common directory, gitdir, etc. In case a file path cannot
435
435
  * exist for a given item (e.g. the working directory of a bare
436
- * repository), an error is returned.
436
+ * repository), GIT_ENOTFOUND is returned.
437
437
  *
438
438
  * @param out Buffer to store the path at
439
439
  * @param repo Repository to get path for
440
440
  * @param item The repository item for which to retrieve the path
441
- * @return 0 on success, otherwise a negative value
441
+ * @return 0, GIT_ENOTFOUND if the path cannot exist or an error code
442
442
  */
443
443
  GIT_EXTERN(int) git_repository_item_path(git_buf *out, git_repository *repo, git_repository_item_t item);
444
444
 
@@ -271,6 +271,17 @@ struct git_filter {
271
271
  };
272
272
 
273
273
  #define GIT_FILTER_VERSION 1
274
+ #define GIT_FILTER_INIT {GIT_FILTER_VERSION}
275
+
276
+ /**
277
+ * Initializes a `git_filter` with default values. Equivalent to
278
+ * creating an instance with GIT_FILTER_INIT.
279
+ *
280
+ * @param filter the `git_filter` struct to initialize.
281
+ * @param version Version the struct; pass `GIT_FILTER_VERSION`
282
+ * @return Zero on success; -1 on failure.
283
+ */
284
+ GIT_EXTERN(int) git_filter_init(git_filter *filter, unsigned int version);
274
285
 
275
286
  /**
276
287
  * Register a filter under a given name with a given priority.
@@ -36,23 +36,23 @@ GIT_EXTERN(git_merge_driver *) git_merge_driver_lookup(const char *name);
36
36
  typedef struct git_merge_driver_source git_merge_driver_source;
37
37
 
38
38
  /** Get the repository that the source data is coming from. */
39
- GIT_EXTERN(git_repository *) git_merge_driver_source_repo(
39
+ GIT_EXTERN(const git_repository *) git_merge_driver_source_repo(
40
40
  const git_merge_driver_source *src);
41
41
 
42
42
  /** Gets the ancestor of the file to merge. */
43
- GIT_EXTERN(git_index_entry *) git_merge_driver_source_ancestor(
43
+ GIT_EXTERN(const git_index_entry *) git_merge_driver_source_ancestor(
44
44
  const git_merge_driver_source *src);
45
45
 
46
46
  /** Gets the ours side of the file to merge. */
47
- GIT_EXTERN(git_index_entry *) git_merge_driver_source_ours(
47
+ GIT_EXTERN(const git_index_entry *) git_merge_driver_source_ours(
48
48
  const git_merge_driver_source *src);
49
49
 
50
50
  /** Gets the theirs side of the file to merge. */
51
- GIT_EXTERN(git_index_entry *) git_merge_driver_source_theirs(
51
+ GIT_EXTERN(const git_index_entry *) git_merge_driver_source_theirs(
52
52
  const git_merge_driver_source *src);
53
53
 
54
54
  /** Gets the merge file options that the merge was invoked with */
55
- GIT_EXTERN(git_merge_file_options *) git_merge_driver_source_file_options(
55
+ GIT_EXTERN(const git_merge_file_options *) git_merge_driver_source_file_options(
56
56
  const git_merge_driver_source *src);
57
57
 
58
58
 
@@ -241,6 +241,16 @@ GIT_EXTERN(int) git_transport_smart_certificate_check(git_transport *transport,
241
241
  */
242
242
  GIT_EXTERN(int) git_transport_smart_credentials(git_cred **out, git_transport *transport, const char *user, int methods);
243
243
 
244
+ /**
245
+ * Get a copy of the proxy options
246
+ *
247
+ * The url is copied and must be freed by the caller.
248
+ *
249
+ * @param out options struct to fill
250
+ * @param transport the transport to extract the data from.
251
+ */
252
+ GIT_EXTERN(int) git_transport_smart_proxy_options(git_proxy_options *out, git_transport *transport);
253
+
244
254
  /*
245
255
  *** End of base transport interface ***
246
256
  *** Begin interface for subtransports for the smart transport ***
@@ -321,13 +321,13 @@ GIT_EXTERN(void) git_cred_free(git_cred *cred);
321
321
  /**
322
322
  * Signature of a function which acquires a credential object.
323
323
  *
324
- * - cred: The newly created credential object.
325
- * - url: The resource for which we are demanding a credential.
326
- * - username_from_url: The username that was embedded in a "user\@host"
324
+ * @param cred The newly created credential object.
325
+ * @param url The resource for which we are demanding a credential.
326
+ * @param username_from_url The username that was embedded in a "user\@host"
327
327
  * remote url, or NULL if not included.
328
- * - allowed_types: A bitmask stating which cred types are OK to return.
329
- * - payload: The payload provided when specifying this callback.
330
- * - returns 0 for success, < 0 to indicate an error, > 0 to indicate
328
+ * @param allowed_types A bitmask stating which cred types are OK to return.
329
+ * @param payload The payload provided when specifying this callback.
330
+ * @return 0 for success, < 0 to indicate an error, > 0 to indicate
331
331
  * no credential was acquired
332
332
  */
333
333
  typedef int (*git_cred_acquire_cb)(
@@ -7,12 +7,12 @@
7
7
  #ifndef INCLUDE_git_version_h__
8
8
  #define INCLUDE_git_version_h__
9
9
 
10
- #define LIBGIT2_VERSION "0.25.0"
10
+ #define LIBGIT2_VERSION "0.26.0"
11
11
  #define LIBGIT2_VER_MAJOR 0
12
- #define LIBGIT2_VER_MINOR 25
12
+ #define LIBGIT2_VER_MINOR 26
13
13
  #define LIBGIT2_VER_REVISION 0
14
14
  #define LIBGIT2_VER_PATCH 0
15
15
 
16
- #define LIBGIT2_SOVERSION 25
16
+ #define LIBGIT2_SOVERSION 26
17
17
 
18
18
  #endif
@@ -43,6 +43,18 @@ GIT_EXTERN(int) git_worktree_list(git_strarray *out, git_repository *repo);
43
43
  */
44
44
  GIT_EXTERN(int) git_worktree_lookup(git_worktree **out, git_repository *repo, const char *name);
45
45
 
46
+ /**
47
+ * Open a worktree of a given repository
48
+ *
49
+ * If a repository is not the main tree but a worktree, this
50
+ * function will look up the worktree inside the parent
51
+ * repository and create a new `git_worktree` structure.
52
+ *
53
+ * @param out Out-pointer for the newly allocated worktree
54
+ * @param repo Repository to look up worktree for
55
+ */
56
+ GIT_EXTERN(int) git_worktree_open_from_repository(git_worktree **out, git_repository *repo);
57
+
46
58
  /**
47
59
  * Free a previously allocated worktree
48
60
  *
@@ -62,6 +74,27 @@ GIT_EXTERN(void) git_worktree_free(git_worktree *wt);
62
74
  */
63
75
  GIT_EXTERN(int) git_worktree_validate(const git_worktree *wt);
64
76
 
77
+ typedef struct git_worktree_add_options {
78
+ unsigned int version;
79
+
80
+ int lock; /**< lock newly created worktree */
81
+ } git_worktree_add_options;
82
+
83
+ #define GIT_WORKTREE_ADD_OPTIONS_VERSION 1
84
+ #define GIT_WORKTREE_ADD_OPTIONS_INIT {GIT_WORKTREE_ADD_OPTIONS_VERSION,0}
85
+
86
+ /**
87
+ * Initializes a `git_worktree_add_options` with default vaules.
88
+ * Equivalent to creating an instance with
89
+ * GIT_WORKTREE_ADD_OPTIONS_INIT.
90
+ *
91
+ * @param opts the struct to initialize
92
+ * @param version Verison of struct; pass `GIT_WORKTREE_ADD_OPTIONS_VERSION`
93
+ * @return Zero on success; -1 on failure.
94
+ */
95
+ int git_worktree_add_init_options(git_worktree_add_options *opts,
96
+ unsigned int version);
97
+
65
98
  /**
66
99
  * Add a new working tree
67
100
  *
@@ -73,9 +106,12 @@ GIT_EXTERN(int) git_worktree_validate(const git_worktree *wt);
73
106
  * @param repo Repository to create working tree for
74
107
  * @param name Name of the working tree
75
108
  * @param path Path to create working tree at
109
+ * @param opts Options to modify default behavior. May be NULL
76
110
  * @return 0 or an error code
77
111
  */
78
- GIT_EXTERN(int) git_worktree_add(git_worktree **out, git_repository *repo, const char *name, const char *path);
112
+ GIT_EXTERN(int) git_worktree_add(git_worktree **out, git_repository *repo,
113
+ const char *name, const char *path,
114
+ const git_worktree_add_options *opts);
79
115
 
80
116
  /**
81
117
  * Lock worktree if not already locked
@@ -125,23 +161,44 @@ typedef enum {
125
161
  GIT_WORKTREE_PRUNE_WORKING_TREE = 1u << 2,
126
162
  } git_worktree_prune_t;
127
163
 
164
+ typedef struct git_worktree_prune_options {
165
+ unsigned int version;
166
+
167
+ uint32_t flags;
168
+ } git_worktree_prune_options;
169
+
170
+ #define GIT_WORKTREE_PRUNE_OPTIONS_VERSION 1
171
+ #define GIT_WORKTREE_PRUNE_OPTIONS_INIT {GIT_WORKTREE_PRUNE_OPTIONS_VERSION,0}
172
+
173
+ /**
174
+ * Initializes a `git_worktree_prune_options` with default vaules.
175
+ * Equivalent to creating an instance with
176
+ * GIT_WORKTREE_PRUNE_OPTIONS_INIT.
177
+ *
178
+ * @param opts the struct to initialize
179
+ * @param version Verison of struct; pass `GIT_WORKTREE_PRUNE_OPTIONS_VERSION`
180
+ * @return Zero on success; -1 on failure.
181
+ */
182
+ GIT_EXTERN(int) git_worktree_prune_init_options(
183
+ git_worktree_prune_options *opts,
184
+ unsigned int version);
185
+
128
186
  /**
129
- * Is the worktree prunable with the given set of flags?
187
+ * Is the worktree prunable with the given options?
130
188
  *
131
189
  * A worktree is not prunable in the following scenarios:
132
190
  *
133
191
  * - the worktree is linking to a valid on-disk worktree. The
134
- * GIT_WORKTREE_PRUNE_VALID flag will cause this check to be
135
- * ignored.
136
- * - the worktree is not valid but locked. The
137
- * GIT_WORKRTEE_PRUNE_LOCKED flag will cause this check to be
138
- * ignored.
192
+ * `valid` member will cause this check to be ignored.
193
+ * - the worktree is locked. The `locked` flag will cause this
194
+ * check to be ignored.
139
195
  *
140
196
  * If the worktree is not valid and not locked or if the above
141
197
  * flags have been passed in, this function will return a
142
198
  * positive value.
143
199
  */
144
- GIT_EXTERN(int) git_worktree_is_prunable(git_worktree *wt, unsigned flags);
200
+ GIT_EXTERN(int) git_worktree_is_prunable(git_worktree *wt,
201
+ git_worktree_prune_options *opts);
145
202
 
146
203
  /**
147
204
  * Prune working tree
@@ -151,10 +208,12 @@ GIT_EXTERN(int) git_worktree_is_prunable(git_worktree *wt, unsigned flags);
151
208
  * `git_worktree_is_prunable` succeeds.
152
209
  *
153
210
  * @param wt Worktree to prune
154
- * @param flags git_worktree_prune_t flags
211
+ * @param opts Specifies which checks to override. See
212
+ * `git_worktree_is_prunable`. May be NULL
155
213
  * @return 0 or an error code
156
214
  */
157
- GIT_EXTERN(int) git_worktree_prune(git_worktree *wt, unsigned flags);
215
+ GIT_EXTERN(int) git_worktree_prune(git_worktree *wt,
216
+ git_worktree_prune_options *opts);
158
217
 
159
218
  /** @} */
160
219
  GIT_END_DECL