rugged 0.25.0b5 → 0.25.0b6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged_patch.c +77 -17
  3. data/lib/rugged/version.rb +1 -1
  4. data/vendor/libgit2/CMakeLists.txt +8 -6
  5. data/vendor/libgit2/include/git2/checkout.h +7 -0
  6. data/vendor/libgit2/include/git2/common.h +1 -0
  7. data/vendor/libgit2/include/git2/diff.h +54 -7
  8. data/vendor/libgit2/include/git2/errors.h +2 -1
  9. data/vendor/libgit2/include/git2/index.h +25 -0
  10. data/vendor/libgit2/include/git2/pack.h +4 -4
  11. data/vendor/libgit2/include/git2/repository.h +20 -1
  12. data/vendor/libgit2/include/git2/submodule.h +11 -3
  13. data/vendor/libgit2/include/git2/sys/odb_backend.h +11 -0
  14. data/vendor/libgit2/src/apply.c +369 -0
  15. data/vendor/libgit2/src/apply.h +21 -0
  16. data/vendor/libgit2/src/array.h +0 -1
  17. data/vendor/libgit2/src/blame_git.c +18 -8
  18. data/vendor/libgit2/src/buffer.c +252 -20
  19. data/vendor/libgit2/src/buffer.h +8 -0
  20. data/vendor/libgit2/src/checkout.c +7 -1
  21. data/vendor/libgit2/src/clone.c +0 -8
  22. data/vendor/libgit2/src/common.h +1 -1
  23. data/vendor/libgit2/src/crlf.c +1 -0
  24. data/vendor/libgit2/src/delta.c +238 -62
  25. data/vendor/libgit2/src/delta.h +79 -58
  26. data/vendor/libgit2/src/diff.c +32 -1547
  27. data/vendor/libgit2/src/diff.h +12 -122
  28. data/vendor/libgit2/src/diff_driver.c +1 -2
  29. data/vendor/libgit2/src/diff_file.c +3 -0
  30. data/vendor/libgit2/src/diff_generate.c +1611 -0
  31. data/vendor/libgit2/src/diff_generate.h +123 -0
  32. data/vendor/libgit2/src/diff_parse.c +105 -0
  33. data/vendor/libgit2/src/diff_print.c +259 -142
  34. data/vendor/libgit2/src/diff_stats.c +3 -2
  35. data/vendor/libgit2/src/diff_tform.c +1 -0
  36. data/vendor/libgit2/src/diff_tform.h +22 -0
  37. data/vendor/libgit2/src/diff_xdiff.c +9 -9
  38. data/vendor/libgit2/src/diff_xdiff.h +5 -5
  39. data/vendor/libgit2/src/fileops.c +13 -0
  40. data/vendor/libgit2/src/fileops.h +6 -0
  41. data/vendor/libgit2/src/global.c +9 -8
  42. data/vendor/libgit2/src/ignore.c +45 -16
  43. data/vendor/libgit2/src/index.c +161 -47
  44. data/vendor/libgit2/src/index.h +2 -0
  45. data/vendor/libgit2/src/merge.c +2 -0
  46. data/vendor/libgit2/src/mwindow.c +8 -19
  47. data/vendor/libgit2/src/mwindow.h +1 -2
  48. data/vendor/libgit2/src/odb.c +46 -10
  49. data/vendor/libgit2/src/odb_loose.c +19 -1
  50. data/vendor/libgit2/src/odb_pack.c +27 -4
  51. data/vendor/libgit2/src/pack-objects.c +106 -77
  52. data/vendor/libgit2/src/pack-objects.h +13 -12
  53. data/vendor/libgit2/src/pack.c +4 -3
  54. data/vendor/libgit2/src/pack.h +2 -0
  55. data/vendor/libgit2/src/patch.c +207 -0
  56. data/vendor/libgit2/src/patch.h +66 -0
  57. data/vendor/libgit2/src/{diff_patch.c → patch_generate.c} +171 -359
  58. data/vendor/libgit2/src/patch_generate.h +66 -0
  59. data/vendor/libgit2/src/patch_parse.c +1121 -0
  60. data/vendor/libgit2/src/patch_parse.h +54 -0
  61. data/vendor/libgit2/src/path.c +19 -0
  62. data/vendor/libgit2/src/path.h +6 -0
  63. data/vendor/libgit2/src/pool.h +5 -0
  64. data/vendor/libgit2/src/remote.c +15 -80
  65. data/vendor/libgit2/src/repository.c +227 -39
  66. data/vendor/libgit2/src/settings.c +11 -5
  67. data/vendor/libgit2/src/stash.c +1 -0
  68. data/vendor/libgit2/src/status.c +1 -0
  69. data/vendor/libgit2/src/stransport_stream.c +14 -9
  70. data/vendor/libgit2/src/submodule.c +16 -4
  71. data/vendor/libgit2/src/sysdir.c +41 -47
  72. data/vendor/libgit2/src/sysdir.h +0 -5
  73. data/vendor/libgit2/src/thread-utils.h +5 -51
  74. data/vendor/libgit2/src/transport.c +3 -5
  75. data/vendor/libgit2/src/transports/http.c +2 -3
  76. data/vendor/libgit2/src/transports/smart_pkt.c +1 -0
  77. data/vendor/libgit2/src/transports/smart_protocol.c +11 -0
  78. data/vendor/libgit2/src/transports/winhttp.c +16 -2
  79. data/vendor/libgit2/src/unix/pthread.h +54 -0
  80. data/vendor/libgit2/src/util.c +23 -5
  81. data/vendor/libgit2/src/util.h +10 -0
  82. data/vendor/libgit2/src/varint.c +44 -0
  83. data/vendor/libgit2/src/varint.h +15 -0
  84. data/vendor/libgit2/src/vector.c +42 -0
  85. data/vendor/libgit2/src/vector.h +3 -0
  86. data/vendor/libgit2/src/win32/precompiled.h +1 -1
  87. data/vendor/libgit2/src/win32/{pthread.c → thread.c} +50 -80
  88. data/vendor/libgit2/src/win32/thread.h +62 -0
  89. data/vendor/libgit2/src/zstream.c +36 -7
  90. data/vendor/libgit2/src/zstream.h +8 -1
  91. metadata +20 -9
  92. data/vendor/libgit2/src/delta-apply.c +0 -166
  93. data/vendor/libgit2/src/delta-apply.h +0 -62
  94. data/vendor/libgit2/src/diff_patch.h +0 -83
  95. data/vendor/libgit2/src/win32/pthread.h +0 -92
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05da8fbc24bdfb988ec9ca4c6bce210839abef82
4
- data.tar.gz: f4ccfe173a149fe48eb41931853d9f13e8cd98db
3
+ metadata.gz: af6c929ae8035ca49fdd7945f2e36eedff07c1a7
4
+ data.tar.gz: f05f796386fd1f812f4dce21b958c6d1a801dfa6
5
5
  SHA512:
6
- metadata.gz: fded37e739a17e90541e079ef3c1b8fdf0cdfa6e306c5e630e56ef50c49d04a464692f42660571761ad6c1631a46310d95d9e64df8ce1ced1d1a3c7f1e1c61db
7
- data.tar.gz: 06f8d28a06747f7e10f7b349ebd58b64e6f077cffdc97fe89785229d456bed9a15facad35df6507da70ead6f351b000cf4060cd98ef1583fb1e392b1a1ee2dd2
6
+ metadata.gz: 22902b9aad7497f1947a391c9ee0dd5d4780a268bf5edf8b3ce18bdbddc269e52b2c1d76a944acc0cc091ef4565dc0f5cb8aa4056fbccfa1d4df317d7ff03aab
7
+ data.tar.gz: 3654613b8a5f37afc667067a34ebdc898eca94b15b63c3714cb2d7166707cbd3a1f15b244f9899d12721d9dc3ce6f62b22e530e35a3c5701c6862fde908044aa
@@ -175,47 +175,107 @@ static VALUE rb_git_diff_patch_stat(VALUE self)
175
175
 
176
176
  /*
177
177
  * call-seq:
178
- * patch.lines -> int
178
+ * patch.lines(options = {}) -> int
179
179
  *
180
- * Returns the total number of lines in the patch.
180
+ * The following options can be passed in the +options+ Hash:
181
+ *
182
+ * :exclude_context ::
183
+ * Boolean value specifying that context line counts should be excluded from
184
+ * the returned total.
185
+ *
186
+ * :exclude_additions ::
187
+ * Boolean value specifying that addition line counts should be excluded from
188
+ * the returned total.
189
+ *
190
+ * :exclude_deletions ::
191
+ * Boolean value specifying that deletion line counts should be excluded from
192
+ * the returned total.
193
+ *
194
+ * Returns the total number of lines in the patch, depending on the options
195
+ * specified.
181
196
  */
182
- static VALUE rb_git_diff_patch_lines(VALUE self)
197
+ static VALUE rb_git_diff_patch_lines(int argc, VALUE *argv, VALUE self)
183
198
  {
184
199
  git_patch *patch;
185
- size_t context, adds, dels;
200
+ size_t context_lines, additions, deletions;
201
+ size_t total_out;
202
+ VALUE rb_options;
186
203
  Data_Get_Struct(self, git_patch, patch);
187
204
 
188
- git_patch_line_stats(&context, &adds, &dels, patch);
205
+ context_lines = 0;
206
+ additions = 0;
207
+ deletions = 0;
189
208
 
190
- return INT2FIX(context + adds + dels);
191
- }
209
+ git_patch_line_stats(&context_lines, &additions, &deletions, patch);
210
+
211
+ total_out = context_lines + additions + deletions;
212
+
213
+ rb_scan_args(argc, argv, "0:", &rb_options);
214
+ if (!NIL_P(rb_options)) {
215
+ if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_context")))) {
216
+ total_out -= context_lines;
217
+ }
218
+
219
+ if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_additions")))) {
220
+ total_out -= additions;
221
+ }
192
222
 
223
+ if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_deletions")))) {
224
+ total_out -= deletions;
225
+ }
226
+ }
227
+
228
+ return INT2FIX(total_out);
229
+ }
230
+ /*
231
+ * call-seq:
232
+ * patch.bytesize(options = {}) -> int
233
+ *
234
+ * The following options can be passed in the +options+ Hash:
235
+ *
236
+ * :exclude_context ::
237
+ * Boolean value specifying that context lines should be excluded when
238
+ * counting the number of bytes in the patch.
239
+ *
240
+ * :exclude_hunk_headers ::
241
+ * Boolean value specifying that hunk headers should be excluded when
242
+ * counting the number of bytes in the patch.
243
+ *
244
+ * :exclude_file_headers ::
245
+ * Boolean value specifying that file headers should be excluded when
246
+ * counting the number of bytes in the patch.
247
+ *
248
+ * Returns the number of bytes in the patch, depending on which options are
249
+ * specified.
250
+ */
193
251
  static VALUE rb_git_diff_patch_bytesize(int argc, VALUE *argv, VALUE self)
194
252
  {
195
253
  git_patch *patch;
196
254
  size_t bytesize;
197
255
  VALUE rb_options;
198
- int options[3];
256
+ int include_context, include_hunk_headers, include_file_headers;
199
257
  Data_Get_Struct(self, git_patch, patch);
200
258
 
201
- memset(options, 0, sizeof(options));
259
+ include_context = 1;
260
+ include_hunk_headers = 1;
261
+ include_file_headers = 1;
202
262
 
203
263
  rb_scan_args(argc, argv, "0:", &rb_options);
204
264
  if (!NIL_P(rb_options)) {
205
- if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("include_context")))) {
206
- options[0] = 1;
265
+ if (rb_hash_aref(rb_options, CSTR2SYM("include_context")) == Qfalse) {
266
+ include_context = 0;
207
267
  }
208
268
 
209
- if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("include_hunk_headers")))) {
210
- options[1] = 1;
269
+ if (rb_hash_aref(rb_options, CSTR2SYM("include_hunk_headers")) == Qfalse) {
270
+ include_hunk_headers = 0;
211
271
  }
212
272
 
213
- if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("include_file_headers")))) {
214
- options[2] = 1;
273
+ if (rb_hash_aref(rb_options, CSTR2SYM("include_file_headers")) == Qfalse) {
274
+ include_file_headers = 0;
215
275
  }
216
276
  }
217
277
 
218
- bytesize = git_patch_size(patch, options[0], options[1], options[2]);
278
+ bytesize = git_patch_size(patch, include_context, include_hunk_headers, include_file_headers);
219
279
 
220
280
  return INT2FIX(bytesize);
221
281
  }
@@ -264,7 +324,7 @@ void Init_rugged_patch(void)
264
324
  rb_define_singleton_method(rb_cRuggedPatch, "from_strings", rb_git_patch_from_strings, -1);
265
325
 
266
326
  rb_define_method(rb_cRuggedPatch, "stat", rb_git_diff_patch_stat, 0);
267
- rb_define_method(rb_cRuggedPatch, "lines", rb_git_diff_patch_lines, 0);
327
+ rb_define_method(rb_cRuggedPatch, "lines", rb_git_diff_patch_lines, -1);
268
328
  rb_define_method(rb_cRuggedPatch, "bytesize", rb_git_diff_patch_bytesize, -1);
269
329
 
270
330
  rb_define_method(rb_cRuggedPatch, "delta", rb_git_diff_patch_delta, 0);
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.25.0b5'
2
+ Version = VERSION = '0.25.0b6'
3
3
  end
@@ -473,19 +473,21 @@ ELSE ()
473
473
  SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
474
474
  ENDIF ()
475
475
 
476
- IF (MINGW) # MinGW always does PIC and complains if we tell it to
476
+ IF (MINGW OR MSYS) # MinGW and MSYS always do PIC and complain if we tell them to
477
477
  STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
478
- # MinGW >= 3.14 uses the C99-style stdio functions
479
- # automatically, but forks like mingw-w64 still want
480
- # us to define this in order to use them
481
- ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
482
-
483
478
  ELSEIF (BUILD_SHARED_LIBS)
484
479
  ADD_C_FLAG_IF_SUPPORTED(-fvisibility=hidden)
485
480
 
486
481
  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
487
482
  ENDIF ()
488
483
 
484
+ IF (MINGW)
485
+ # MinGW >= 3.14 uses the C99-style stdio functions
486
+ # automatically, but forks like mingw-w64 still want
487
+ # us to define this in order to use them
488
+ ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
489
+ ENDIF ()
490
+
489
491
  ADD_C_FLAG_IF_SUPPORTED(-Wdocumentation)
490
492
  ADD_C_FLAG_IF_SUPPORTED(-Wno-missing-field-initializers)
491
493
  ADD_C_FLAG_IF_SUPPORTED(-Wstrict-aliasing=2)
@@ -313,6 +313,13 @@ 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
+ *
316
323
  * @param repo repository to check out (must be non-bare)
317
324
  * @param opts specifies checkout options (may be NULL)
318
325
  * @return 0 on success, GIT_EUNBORNBRANCH if HEAD points to a non
@@ -158,6 +158,7 @@ typedef enum {
158
158
  GIT_OPT_SET_USER_AGENT,
159
159
  GIT_OPT_ENABLE_STRICT_OBJECT_CREATION,
160
160
  GIT_OPT_SET_SSL_CIPHERS,
161
+ GIT_OPT_GET_USER_AGENT,
161
162
  } git_libgit2_opt_t;
162
163
 
163
164
  /**
@@ -264,7 +264,7 @@ typedef enum {
264
264
  * link, a submodule commit id, or even a tree (although that only if you
265
265
  * are tracking type changes or ignored/untracked directories).
266
266
  *
267
- * The `oid` is the `git_oid` of the item. If the entry represents an
267
+ * The `id` is the `git_oid` of the item. If the entry represents an
268
268
  * absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
269
269
  * then the oid will be zeroes.
270
270
  *
@@ -277,6 +277,11 @@ typedef enum {
277
277
  *
278
278
  * `mode` is, roughly, the stat() `st_mode` value for the item. This will
279
279
  * be restricted to one of the `git_filemode_t` values.
280
+ *
281
+ * The `id_abbrev` represents the known length of the `id` field, when
282
+ * converted to a hex string. It is generally `GIT_OID_HEXSZ`, unless this
283
+ * delta was created from reading a patch file, in which case it may be
284
+ * abbreviated to something reasonable, like 7 characters.
280
285
  */
281
286
  typedef struct {
282
287
  git_oid id;
@@ -284,6 +289,7 @@ typedef struct {
284
289
  git_off_t size;
285
290
  uint32_t flags;
286
291
  uint16_t mode;
292
+ uint16_t id_abbrev;
287
293
  } git_diff_file;
288
294
 
289
295
  /**
@@ -448,6 +454,8 @@ typedef int (*git_diff_file_cb)(
448
454
  float progress,
449
455
  void *payload);
450
456
 
457
+ #define GIT_DIFF_HUNK_HEADER_SIZE 128
458
+
451
459
  /**
452
460
  * When producing a binary diff, the binary data returned will be
453
461
  * either the deflated full ("literal") contents of the file, or
@@ -499,12 +507,12 @@ typedef int(*git_diff_binary_cb)(
499
507
  * Structure describing a hunk of a diff.
500
508
  */
501
509
  typedef struct {
502
- int old_start; /**< Starting line number in old_file */
503
- int old_lines; /**< Number of lines in old_file */
504
- int new_start; /**< Starting line number in new_file */
505
- int new_lines; /**< Number of lines in new_file */
506
- size_t header_len; /**< Number of bytes in header text */
507
- char header[128]; /**< Header text, NUL-byte terminated */
510
+ int old_start; /** Starting line number in old_file */
511
+ int old_lines; /** Number of lines in old_file */
512
+ int new_start; /** Starting line number in new_file */
513
+ int new_lines; /** Number of lines in new_file */
514
+ size_t header_len; /** Number of bytes in header text */
515
+ char header[GIT_DIFF_HUNK_HEADER_SIZE]; /** Header text, NUL-byte terminated */
508
516
  } git_diff_hunk;
509
517
 
510
518
  /**
@@ -1046,6 +1054,21 @@ GIT_EXTERN(int) git_diff_print(
1046
1054
  git_diff_line_cb print_cb,
1047
1055
  void *payload);
1048
1056
 
1057
+ /**
1058
+ * Produce the complete formatted text output from a diff into a
1059
+ * buffer.
1060
+ *
1061
+ * @param out A pointer to a user-allocated git_buf that will
1062
+ * contain the diff text
1063
+ * @param diff A git_diff generated by one of the above functions.
1064
+ * @param format A git_diff_format_t value to pick the text format.
1065
+ * @return 0 on success or error code
1066
+ */
1067
+ GIT_EXTERN(int) git_diff_to_buf(
1068
+ git_buf *out,
1069
+ git_diff *diff,
1070
+ git_diff_format_t format);
1071
+
1049
1072
  /**@}*/
1050
1073
 
1051
1074
 
@@ -1166,6 +1189,30 @@ GIT_EXTERN(int) git_diff_buffers(
1166
1189
  git_diff_line_cb line_cb,
1167
1190
  void *payload);
1168
1191
 
1192
+ /**
1193
+ * Read the contents of a git patch file into a `git_diff` object.
1194
+ *
1195
+ * The diff object produced is similar to the one that would be
1196
+ * produced if you actually produced it computationally by comparing
1197
+ * two trees, however there may be subtle differences. For example,
1198
+ * a patch file likely contains abbreviated object IDs, so the
1199
+ * object IDs in a `git_diff_delta` produced by this function will
1200
+ * also be abbreviated.
1201
+ *
1202
+ * This function will only read patch files created by a git
1203
+ * implementation, it will not read unified diffs produced by
1204
+ * the `diff` program, nor any other types of patch files.
1205
+ *
1206
+ * @param out A pointer to a git_diff pointer that will be allocated.
1207
+ * @param content The contents of a patch file
1208
+ * @param content_len The length of the patch file contents
1209
+ * @return 0 or an error code
1210
+ */
1211
+ GIT_EXTERN(int) git_diff_from_buffer(
1212
+ git_diff **out,
1213
+ const char *content,
1214
+ size_t content_len);
1215
+
1169
1216
  /**
1170
1217
  * This is an opaque structure which is allocated by `git_diff_get_stats`.
1171
1218
  * You are responsible for releasing the object memory when done, using the
@@ -98,7 +98,8 @@ typedef enum {
98
98
  GITERR_CHERRYPICK,
99
99
  GITERR_DESCRIBE,
100
100
  GITERR_REBASE,
101
- GITERR_FILESYSTEM
101
+ GITERR_FILESYSTEM,
102
+ GITERR_PATCH,
102
103
  } git_error_t;
103
104
 
104
105
  /**
@@ -251,6 +251,31 @@ GIT_EXTERN(int) git_index_caps(const git_index *index);
251
251
  */
252
252
  GIT_EXTERN(int) git_index_set_caps(git_index *index, int caps);
253
253
 
254
+ /**
255
+ * Get index on-disk version.
256
+ *
257
+ * Valid return values are 2, 3, or 4. If 3 is returned, an index
258
+ * with version 2 may be written instead, if the extension data in
259
+ * version 3 is not necessary.
260
+ *
261
+ * @param index An existing index object
262
+ * @return the index version
263
+ */
264
+ GIT_EXTERN(unsigned int) git_index_version(git_index *index);
265
+
266
+ /**
267
+ * Set index on-disk version.
268
+ *
269
+ * Valid values are 2, 3, or 4. If 2 is given, git_index_write may
270
+ * write an index with version 3 instead, if necessary to accurately
271
+ * represent the index.
272
+ *
273
+ * @param index An existing index object
274
+ * @param version The new version number
275
+ * @return 0 on success, -1 on failure
276
+ */
277
+ GIT_EXTERN(int) git_index_set_version(git_index *index, unsigned int version);
278
+
254
279
  /**
255
280
  * Update the contents of an existing index object in memory by reading
256
281
  * from the hard disk.
@@ -196,7 +196,7 @@ GIT_EXTERN(int) git_packbuilder_foreach(git_packbuilder *pb, git_packbuilder_for
196
196
  * @param pb the packbuilder
197
197
  * @return the number of objects in the packfile
198
198
  */
199
- GIT_EXTERN(uint32_t) git_packbuilder_object_count(git_packbuilder *pb);
199
+ GIT_EXTERN(size_t) git_packbuilder_object_count(git_packbuilder *pb);
200
200
 
201
201
  /**
202
202
  * Get the number of objects the packbuilder has already written out
@@ -204,13 +204,13 @@ GIT_EXTERN(uint32_t) git_packbuilder_object_count(git_packbuilder *pb);
204
204
  * @param pb the packbuilder
205
205
  * @return the number of objects which have already been written
206
206
  */
207
- GIT_EXTERN(uint32_t) git_packbuilder_written(git_packbuilder *pb);
207
+ GIT_EXTERN(size_t) git_packbuilder_written(git_packbuilder *pb);
208
208
 
209
209
  /** Packbuilder progress notification function */
210
210
  typedef int (*git_packbuilder_progress)(
211
211
  int stage,
212
- unsigned int current,
213
- unsigned int total,
212
+ uint32_t current,
213
+ uint32_t total,
214
214
  void *payload);
215
215
 
216
216
  /**
@@ -95,11 +95,29 @@ GIT_EXTERN(int) git_repository_discover(
95
95
  * * GIT_REPOSITORY_OPEN_BARE - Open repository as a bare repo regardless
96
96
  * of core.bare config, and defer loading config file for faster setup.
97
97
  * Unlike `git_repository_open_bare`, this can follow gitlinks.
98
+ * * GIT_REPOSITORY_OPEN_NO_DOTGIT - Do not check for a repository by
99
+ * appending /.git to the start_path; only open the repository if
100
+ * start_path itself points to the git directory.
101
+ * * GIT_REPOSITORY_OPEN_FROM_ENV - Find and open a git repository,
102
+ * respecting the environment variables used by the git command-line
103
+ * tools. If set, `git_repository_open_ext` will ignore the other
104
+ * flags and the `ceiling_dirs` argument, and will allow a NULL `path`
105
+ * to use `GIT_DIR` or search from the current directory. The search
106
+ * for a repository will respect $GIT_CEILING_DIRECTORIES and
107
+ * $GIT_DISCOVERY_ACROSS_FILESYSTEM. The opened repository will
108
+ * respect $GIT_INDEX_FILE, $GIT_NAMESPACE, $GIT_OBJECT_DIRECTORY, and
109
+ * $GIT_ALTERNATE_OBJECT_DIRECTORIES. In the future, this flag will
110
+ * also cause `git_repository_open_ext` to respect $GIT_WORK_TREE and
111
+ * $GIT_COMMON_DIR; currently, `git_repository_open_ext` with this
112
+ * flag will error out if either $GIT_WORK_TREE or $GIT_COMMON_DIR is
113
+ * set.
98
114
  */
99
115
  typedef enum {
100
116
  GIT_REPOSITORY_OPEN_NO_SEARCH = (1 << 0),
101
117
  GIT_REPOSITORY_OPEN_CROSS_FS = (1 << 1),
102
118
  GIT_REPOSITORY_OPEN_BARE = (1 << 2),
119
+ GIT_REPOSITORY_OPEN_NO_DOTGIT = (1 << 3),
120
+ GIT_REPOSITORY_OPEN_FROM_ENV = (1 << 4),
103
121
  } git_repository_open_flag_t;
104
122
 
105
123
  /**
@@ -110,7 +128,8 @@ typedef enum {
110
128
  * see if a repo at this path could be opened.
111
129
  * @param path Path to open as git repository. If the flags
112
130
  * permit "searching", then this can be a path to a subdirectory
113
- * inside the working directory of the repository.
131
+ * inside the working directory of the repository. May be NULL if
132
+ * flags is GIT_REPOSITORY_OPEN_FROM_ENV.
114
133
  * @param flags A combination of the GIT_REPOSITORY_OPEN flags above.
115
134
  * @param ceiling_dirs A GIT_PATH_LIST_SEPARATOR delimited list of path
116
135
  * prefixes at which the search for a containing repository should
@@ -154,13 +154,19 @@ typedef struct git_submodule_update_options {
154
154
  * in the working directory for the newly cloned repository.
155
155
  */
156
156
  unsigned int clone_checkout_strategy;
157
+
158
+ /**
159
+ * Allow fetching from the submodule's default remote if the target
160
+ * commit isn't found. Enabled by default.
161
+ */
162
+ int allow_fetch;
157
163
  } git_submodule_update_options;
158
164
 
159
165
  #define GIT_SUBMODULE_UPDATE_OPTIONS_VERSION 1
160
166
  #define GIT_SUBMODULE_UPDATE_OPTIONS_INIT \
161
- { GIT_CHECKOUT_OPTIONS_VERSION, \
167
+ { GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, \
162
168
  { GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE }, \
163
- GIT_FETCH_OPTIONS_INIT, GIT_CHECKOUT_SAFE }
169
+ GIT_FETCH_OPTIONS_INIT, GIT_CHECKOUT_SAFE, 1 }
164
170
 
165
171
  /**
166
172
  * Initializes a `git_submodule_update_options` with default values.
@@ -176,7 +182,9 @@ GIT_EXTERN(int) git_submodule_update_init_options(
176
182
  /**
177
183
  * Update a submodule. This will clone a missing submodule and
178
184
  * checkout the subrepository to the commit specified in the index of
179
- * containing repository.
185
+ * the containing repository. If the submodule repository doesn't contain
186
+ * the target commit (e.g. because fetchRecurseSubmodules isn't set), then
187
+ * the submodule is fetched using the fetch options supplied in options.
180
188
  *
181
189
  * @param submodule Submodule object
182
190
  * @param init If the submodule is not initialized, setting this flag to true