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
@@ -38,6 +38,21 @@ typedef enum {
38
38
  GIT_ITERATOR_INCLUDE_CONFLICTS = (1u << 5),
39
39
  } git_iterator_flag_t;
40
40
 
41
+ typedef struct {
42
+ const char *start;
43
+ const char *end;
44
+
45
+ /* paths to include in the iterator (literal). if set, any paths not
46
+ * listed here will be excluded from iteration.
47
+ */
48
+ git_strarray pathlist;
49
+
50
+ /* flags, from above */
51
+ unsigned int flags;
52
+ } git_iterator_options;
53
+
54
+ #define GIT_ITERATOR_OPTIONS_INIT {0}
55
+
41
56
  typedef struct {
42
57
  int (*current)(const git_index_entry **, git_iterator *);
43
58
  int (*advance)(const git_index_entry **, git_iterator *);
@@ -54,6 +69,10 @@ struct git_iterator {
54
69
  git_repository *repo;
55
70
  char *start;
56
71
  char *end;
72
+ git_vector pathlist;
73
+ size_t pathlist_walk_idx;
74
+ int (*strcomp)(const char *a, const char *b);
75
+ int (*strncomp)(const char *a, const char *b, size_t n);
57
76
  int (*prefixcomp)(const char *str, const char *prefix);
58
77
  size_t stat_calls;
59
78
  unsigned int flags;
@@ -61,9 +80,7 @@ struct git_iterator {
61
80
 
62
81
  extern int git_iterator_for_nothing(
63
82
  git_iterator **out,
64
- git_iterator_flag_t flags,
65
- const char *start,
66
- const char *end);
83
+ git_iterator_options *options);
67
84
 
68
85
  /* tree iterators will match the ignore_case value from the index of the
69
86
  * repository, unless you override with a non-zero flag value
@@ -71,9 +88,7 @@ extern int git_iterator_for_nothing(
71
88
  extern int git_iterator_for_tree(
72
89
  git_iterator **out,
73
90
  git_tree *tree,
74
- git_iterator_flag_t flags,
75
- const char *start,
76
- const char *end);
91
+ git_iterator_options *options);
77
92
 
78
93
  /* index iterators will take the ignore_case value from the index; the
79
94
  * ignore_case flags are not used
@@ -81,9 +96,7 @@ extern int git_iterator_for_tree(
81
96
  extern int git_iterator_for_index(
82
97
  git_iterator **out,
83
98
  git_index *index,
84
- git_iterator_flag_t flags,
85
- const char *start,
86
- const char *end);
99
+ git_iterator_options *options);
87
100
 
88
101
  extern int git_iterator_for_workdir_ext(
89
102
  git_iterator **out,
@@ -91,9 +104,7 @@ extern int git_iterator_for_workdir_ext(
91
104
  const char *repo_workdir,
92
105
  git_index *index,
93
106
  git_tree *tree,
94
- git_iterator_flag_t flags,
95
- const char *start,
96
- const char *end);
107
+ git_iterator_options *options);
97
108
 
98
109
  /* workdir iterators will match the ignore_case value from the index of the
99
110
  * repository, unless you override with a non-zero flag value
@@ -103,11 +114,9 @@ GIT_INLINE(int) git_iterator_for_workdir(
103
114
  git_repository *repo,
104
115
  git_index *index,
105
116
  git_tree *tree,
106
- git_iterator_flag_t flags,
107
- const char *start,
108
- const char *end)
117
+ git_iterator_options *options)
109
118
  {
110
- return git_iterator_for_workdir_ext(out, repo, NULL, index, tree, flags, start, end);
119
+ return git_iterator_for_workdir_ext(out, repo, NULL, index, tree, options);
111
120
  }
112
121
 
113
122
  /* for filesystem iterators, you have to explicitly pass in the ignore_case
@@ -116,9 +125,7 @@ GIT_INLINE(int) git_iterator_for_workdir(
116
125
  extern int git_iterator_for_filesystem(
117
126
  git_iterator **out,
118
127
  const char *root,
119
- git_iterator_flag_t flags,
120
- const char *start,
121
- const char *end);
128
+ git_iterator_options *options);
122
129
 
123
130
  extern void git_iterator_free(git_iterator *iter);
124
131
 
@@ -271,7 +278,8 @@ extern git_index *git_iterator_get_index(git_iterator *iter);
271
278
  typedef enum {
272
279
  GIT_ITERATOR_STATUS_NORMAL = 0,
273
280
  GIT_ITERATOR_STATUS_IGNORED = 1,
274
- GIT_ITERATOR_STATUS_EMPTY = 2
281
+ GIT_ITERATOR_STATUS_EMPTY = 2,
282
+ GIT_ITERATOR_STATUS_FILTERED = 3
275
283
  } git_iterator_status_t;
276
284
 
277
285
  /* Advance over a directory and check if it contains no files or just
@@ -1639,10 +1639,14 @@ on_error:
1639
1639
 
1640
1640
  static git_iterator *iterator_given_or_empty(git_iterator **empty, git_iterator *given)
1641
1641
  {
1642
+ git_iterator_options opts = GIT_ITERATOR_OPTIONS_INIT;
1643
+
1642
1644
  if (given)
1643
1645
  return given;
1644
1646
 
1645
- if (git_iterator_for_nothing(empty, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL) < 0)
1647
+ opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
1648
+
1649
+ if (git_iterator_for_nothing(empty, &opts) < 0)
1646
1650
  return NULL;
1647
1651
 
1648
1652
  return *empty;
@@ -1724,14 +1728,17 @@ int git_merge_trees(
1724
1728
  const git_merge_options *merge_opts)
1725
1729
  {
1726
1730
  git_iterator *ancestor_iter = NULL, *our_iter = NULL, *their_iter = NULL;
1731
+ git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
1727
1732
  int error;
1728
1733
 
1729
- if ((error = git_iterator_for_tree(&ancestor_iter, (git_tree *)ancestor_tree,
1730
- GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 ||
1731
- (error = git_iterator_for_tree(&our_iter, (git_tree *)our_tree,
1732
- GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 ||
1733
- (error = git_iterator_for_tree(&their_iter, (git_tree *)their_tree,
1734
- GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0)
1734
+ iter_opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
1735
+
1736
+ if ((error = git_iterator_for_tree(
1737
+ &ancestor_iter, (git_tree *)ancestor_tree, &iter_opts)) < 0 ||
1738
+ (error = git_iterator_for_tree(
1739
+ &our_iter, (git_tree *)our_tree, &iter_opts)) < 0 ||
1740
+ (error = git_iterator_for_tree(
1741
+ &their_iter, (git_tree *)their_tree, &iter_opts)) < 0)
1735
1742
  goto done;
1736
1743
 
1737
1744
  error = git_merge__iterators(
@@ -2263,6 +2270,7 @@ static int merge_check_index(size_t *conflicts, git_repository *repo, git_index
2263
2270
  git_tree *head_tree = NULL;
2264
2271
  git_index *index_repo = NULL;
2265
2272
  git_iterator *iter_repo = NULL, *iter_new = NULL;
2273
+ git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
2266
2274
  git_diff *staged_diff_list = NULL, *index_diff_list = NULL;
2267
2275
  git_diff_delta *delta;
2268
2276
  git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
@@ -2292,11 +2300,12 @@ static int merge_check_index(size_t *conflicts, git_repository *repo, git_index
2292
2300
  goto done;
2293
2301
  }
2294
2302
 
2295
- opts.pathspec.count = staged_paths.length;
2296
- opts.pathspec.strings = (char **)staged_paths.contents;
2303
+ iter_opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
2304
+ iter_opts.pathlist.strings = (char **)staged_paths.contents;
2305
+ iter_opts.pathlist.count = staged_paths.length;
2297
2306
 
2298
- if ((error = git_iterator_for_index(&iter_repo, index_repo, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 ||
2299
- (error = git_iterator_for_index(&iter_new, index_new, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 ||
2307
+ if ((error = git_iterator_for_index(&iter_repo, index_repo, &iter_opts)) < 0 ||
2308
+ (error = git_iterator_for_index(&iter_new, index_new, &iter_opts)) < 0 ||
2300
2309
  (error = git_diff__from_iterators(&index_diff_list, repo, iter_repo, iter_new, &opts)) < 0)
2301
2310
  goto done;
2302
2311
 
@@ -2340,6 +2349,7 @@ static int merge_check_workdir(size_t *conflicts, git_repository *repo, git_inde
2340
2349
  * will be applied by the merge (including conflicts). Ensure that there
2341
2350
  * are no changes in the workdir to these paths.
2342
2351
  */
2352
+ opts.flags |= GIT_DIFF_DISABLE_PATHSPEC_MATCH;
2343
2353
  opts.pathspec.count = merged_paths->length;
2344
2354
  opts.pathspec.strings = (char **)merged_paths->contents;
2345
2355
 
@@ -2358,6 +2368,7 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
2358
2368
  {
2359
2369
  git_tree *head_tree = NULL;
2360
2370
  git_iterator *iter_head = NULL, *iter_new = NULL;
2371
+ git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
2361
2372
  git_diff *merged_list = NULL;
2362
2373
  git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
2363
2374
  git_diff_delta *delta;
@@ -2366,9 +2377,11 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
2366
2377
  const git_index_entry *e;
2367
2378
  int error = 0;
2368
2379
 
2380
+ iter_opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE;
2381
+
2369
2382
  if ((error = git_repository_head_tree(&head_tree, repo)) < 0 ||
2370
- (error = git_iterator_for_tree(&iter_head, head_tree, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 ||
2371
- (error = git_iterator_for_index(&iter_new, index_new, GIT_ITERATOR_DONT_IGNORE_CASE, NULL, NULL)) < 0 ||
2383
+ (error = git_iterator_for_tree(&iter_head, head_tree, &iter_opts)) < 0 ||
2384
+ (error = git_iterator_for_index(&iter_new, index_new, &iter_opts)) < 0 ||
2372
2385
  (error = git_diff__from_iterators(&merged_list, repo, iter_head, iter_new, &opts)) < 0)
2373
2386
  goto done;
2374
2387
 
@@ -663,7 +663,7 @@ int git_note_iterator_new(
663
663
  if (error < 0)
664
664
  goto cleanup;
665
665
 
666
- if ((error = git_iterator_for_tree(it, tree, 0, NULL, NULL)) < 0)
666
+ if ((error = git_iterator_for_tree(it, tree, NULL)) < 0)
667
667
  git_iterator_free(*it);
668
668
 
669
669
  cleanup:
@@ -600,8 +600,7 @@ static void odb_free(git_odb *db)
600
600
  backend_internal *internal = git_vector_get(&db->backends, i);
601
601
  git_odb_backend *backend = internal->backend;
602
602
 
603
- if (backend->free) backend->free(backend);
604
- else git__free(backend);
603
+ backend->free(backend);
605
604
 
606
605
  git__free(internal);
607
606
  }
@@ -84,9 +84,9 @@ static int object_file_name(
84
84
 
85
85
  static int object_mkdir(const git_buf *name, const loose_backend *be)
86
86
  {
87
- return git_futils_mkdir(
87
+ return git_futils_mkdir_relative(
88
88
  name->ptr + be->objects_dirlen, be->objects_dir, be->object_dir_mode,
89
- GIT_MKDIR_PATH | GIT_MKDIR_SKIP_LAST | GIT_MKDIR_VERIFY_DIR);
89
+ GIT_MKDIR_PATH | GIT_MKDIR_SKIP_LAST | GIT_MKDIR_VERIFY_DIR, NULL);
90
90
  }
91
91
 
92
92
  static size_t get_binary_object_header(obj_hdr *hdr, git_buf *obj)
@@ -154,12 +154,16 @@ void git_mempack_reset(git_odb_backend *_backend)
154
154
  });
155
155
 
156
156
  git_array_clear(db->commits);
157
+
158
+ git_oidmap_clear(db->objects);
157
159
  }
158
160
 
159
161
  static void impl__free(git_odb_backend *_backend)
160
162
  {
161
- git_mempack_reset(_backend);
162
- git__free(_backend);
163
+ struct memory_packer_db *db = (struct memory_packer_db *)_backend;
164
+
165
+ git_oidmap_free(db->objects);
166
+ git__free(db);
163
167
  }
164
168
 
165
169
  int git_mempack_new(git_odb_backend **out)
@@ -49,4 +49,6 @@ GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
49
49
 
50
50
  #define git_oidmap_size(h) kh_size(h)
51
51
 
52
+ #define git_oidmap_clear(h) kh_clear(oid, h)
53
+
52
54
  #endif
@@ -302,6 +302,7 @@ cert_fail_name:
302
302
  typedef struct {
303
303
  git_stream parent;
304
304
  git_stream *io;
305
+ bool connected;
305
306
  char *host;
306
307
  SSL *ssl;
307
308
  git_cert_x509 cert_info;
@@ -318,6 +319,8 @@ int openssl_connect(git_stream *stream)
318
319
  if ((ret = git_stream_connect(st->io)) < 0)
319
320
  return ret;
320
321
 
322
+ st->connected = true;
323
+
321
324
  bio = BIO_new(&git_stream_bio_method);
322
325
  GITERR_CHECK_ALLOC(bio);
323
326
  bio->ptr = st->io;
@@ -360,11 +363,12 @@ int openssl_certificate(git_cert **out, git_stream *stream)
360
363
  return -1;
361
364
  }
362
365
 
363
- st->cert_info.cert_type = GIT_CERT_X509;
366
+ st->cert_info.parent.cert_type = GIT_CERT_X509;
364
367
  st->cert_info.data = encoded_cert;
365
368
  st->cert_info.len = len;
366
369
 
367
- *out = (git_cert *)&st->cert_info;
370
+ *out = &st->cert_info.parent;
371
+
368
372
  return 0;
369
373
  }
370
374
 
@@ -405,9 +409,11 @@ int openssl_close(git_stream *stream)
405
409
  openssl_stream *st = (openssl_stream *) stream;
406
410
  int ret;
407
411
 
408
- if ((ret = ssl_teardown(st->ssl)) < 0)
412
+ if (st->connected && (ret = ssl_teardown(st->ssl)) < 0)
409
413
  return -1;
410
414
 
415
+ st->connected = false;
416
+
411
417
  return git_stream_close(st->io);
412
418
  }
413
419
 
@@ -526,6 +526,17 @@ bool git_path_isfile(const char *path)
526
526
  return S_ISREG(st.st_mode) != 0;
527
527
  }
528
528
 
529
+ bool git_path_islink(const char *path)
530
+ {
531
+ struct stat st;
532
+
533
+ assert(path);
534
+ if (p_lstat(path, &st) < 0)
535
+ return false;
536
+
537
+ return S_ISLNK(st.st_mode) != 0;
538
+ }
539
+
529
540
  #ifdef GIT_WIN32
530
541
 
531
542
  bool git_path_is_empty_dir(const char *path)
@@ -1166,7 +1177,11 @@ static int diriter_update_paths(git_path_diriter *diriter)
1166
1177
  diriter->path[path_len-1] = L'\0';
1167
1178
 
1168
1179
  git_buf_truncate(&diriter->path_utf8, diriter->parent_utf8_len);
1169
- git_buf_putc(&diriter->path_utf8, '/');
1180
+
1181
+ if (diriter->parent_utf8_len > 0 &&
1182
+ diriter->path_utf8.ptr[diriter->parent_utf8_len-1] != '/')
1183
+ git_buf_putc(&diriter->path_utf8, '/');
1184
+
1170
1185
  git_buf_put_w(&diriter->path_utf8, diriter->current.cFileName, filename_len);
1171
1186
 
1172
1187
  if (git_buf_oom(&diriter->path_utf8))
@@ -1315,7 +1330,11 @@ int git_path_diriter_next(git_path_diriter *diriter)
1315
1330
  #endif
1316
1331
 
1317
1332
  git_buf_truncate(&diriter->path, diriter->parent_len);
1318
- git_buf_putc(&diriter->path, '/');
1333
+
1334
+ if (diriter->parent_len > 0 &&
1335
+ diriter->path.ptr[diriter->parent_len-1] != '/')
1336
+ git_buf_putc(&diriter->path, '/');
1337
+
1319
1338
  git_buf_put(&diriter->path, filename, filename_len);
1320
1339
 
1321
1340
  if (git_buf_oom(&diriter->path))
@@ -1676,3 +1695,19 @@ bool git_path_isvalid(
1676
1695
 
1677
1696
  return verify_component(repo, start, (c - start), flags);
1678
1697
  }
1698
+
1699
+ int git_path_normalize_slashes(git_buf *out, const char *path)
1700
+ {
1701
+ int error;
1702
+ char *p;
1703
+
1704
+ if ((error = git_buf_puts(out, path)) < 0)
1705
+ return error;
1706
+
1707
+ for (p = out->ptr; *p; p++) {
1708
+ if (*p == '\\')
1709
+ *p = '/';
1710
+ }
1711
+
1712
+ return 0;
1713
+ }
@@ -72,7 +72,7 @@ extern const char *git_path_topdir(const char *path);
72
72
  * This will return a number >= 0 which is the offset to the start of the
73
73
  * path, if the path is rooted (i.e. "/rooted/path" returns 0 and
74
74
  * "c:/windows/rooted/path" returns 2). If the path is not rooted, this
75
- * returns < 0.
75
+ * returns -1.
76
76
  */
77
77
  extern int git_path_root(const char *path);
78
78
 
@@ -168,6 +168,12 @@ extern bool git_path_isdir(const char *path);
168
168
  */
169
169
  extern bool git_path_isfile(const char *path);
170
170
 
171
+ /**
172
+ * Check if the given path points to a symbolic link.
173
+ * @return true or false
174
+ */
175
+ extern bool git_path_islink(const char *path);
176
+
171
177
  /**
172
178
  * Check if the given path is a directory, and is empty.
173
179
  */
@@ -591,4 +597,9 @@ extern bool git_path_isvalid(
591
597
  const char *path,
592
598
  unsigned int flags);
593
599
 
600
+ /**
601
+ * Convert any backslashes into slashes
602
+ */
603
+ int git_path_normalize_slashes(git_buf *out, const char *path);
604
+
594
605
  #endif
@@ -524,16 +524,16 @@ int git_pathspec_match_workdir(
524
524
  uint32_t flags,
525
525
  git_pathspec *ps)
526
526
  {
527
- int error = 0;
528
527
  git_iterator *iter;
528
+ git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
529
+ int error = 0;
529
530
 
530
531
  assert(repo);
531
532
 
532
- if (!(error = git_iterator_for_workdir(
533
- &iter, repo, NULL, NULL, pathspec_match_iter_flags(flags), NULL, NULL))) {
533
+ iter_opts.flags = pathspec_match_iter_flags(flags);
534
534
 
535
+ if (!(error = git_iterator_for_workdir(&iter, repo, NULL, NULL, &iter_opts))) {
535
536
  error = pathspec_match_from_iterator(out, iter, flags, ps);
536
-
537
537
  git_iterator_free(iter);
538
538
  }
539
539
 
@@ -546,16 +546,16 @@ int git_pathspec_match_index(
546
546
  uint32_t flags,
547
547
  git_pathspec *ps)
548
548
  {
549
- int error = 0;
550
549
  git_iterator *iter;
550
+ git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
551
+ int error = 0;
551
552
 
552
553
  assert(index);
553
554
 
554
- if (!(error = git_iterator_for_index(
555
- &iter, index, pathspec_match_iter_flags(flags), NULL, NULL))) {
555
+ iter_opts.flags = pathspec_match_iter_flags(flags);
556
556
 
557
+ if (!(error = git_iterator_for_index(&iter, index, &iter_opts))) {
557
558
  error = pathspec_match_from_iterator(out, iter, flags, ps);
558
-
559
559
  git_iterator_free(iter);
560
560
  }
561
561
 
@@ -568,16 +568,16 @@ int git_pathspec_match_tree(
568
568
  uint32_t flags,
569
569
  git_pathspec *ps)
570
570
  {
571
- int error = 0;
572
571
  git_iterator *iter;
572
+ git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
573
+ int error = 0;
573
574
 
574
575
  assert(tree);
575
576
 
576
- if (!(error = git_iterator_for_tree(
577
- &iter, tree, pathspec_match_iter_flags(flags), NULL, NULL))) {
577
+ iter_opts.flags = pathspec_match_iter_flags(flags);
578
578
 
579
+ if (!(error = git_iterator_for_tree(&iter, tree, &iter_opts))) {
579
580
  error = pathspec_match_from_iterator(out, iter, flags, ps);
580
-
581
581
  git_iterator_free(iter);
582
582
  }
583
583