rugged 0.25.0b2 → 0.25.0b3

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 (99) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/ext/rugged/extconf.rb +3 -1
  4. data/ext/rugged/rugged.c +1 -1
  5. data/ext/rugged/rugged.h +1 -1
  6. data/ext/rugged/rugged_blob.c +29 -38
  7. data/ext/rugged/rugged_commit.c +215 -78
  8. data/ext/rugged/rugged_rebase.c +18 -11
  9. data/ext/rugged/rugged_remote.c +2 -2
  10. data/ext/rugged/rugged_tree.c +132 -0
  11. data/lib/rugged/version.rb +1 -1
  12. data/vendor/libgit2/CMakeLists.txt +11 -3
  13. data/vendor/libgit2/include/git2.h +1 -0
  14. data/vendor/libgit2/include/git2/blob.h +39 -28
  15. data/vendor/libgit2/include/git2/commit.h +30 -0
  16. data/vendor/libgit2/include/git2/common.h +16 -1
  17. data/vendor/libgit2/include/git2/merge.h +10 -1
  18. data/vendor/libgit2/include/git2/proxy.h +92 -0
  19. data/vendor/libgit2/include/git2/refs.h +11 -0
  20. data/vendor/libgit2/include/git2/remote.h +17 -4
  21. data/vendor/libgit2/include/git2/signature.h +13 -0
  22. data/vendor/libgit2/include/git2/sys/merge.h +177 -0
  23. data/vendor/libgit2/include/git2/sys/remote.h +16 -0
  24. data/vendor/libgit2/include/git2/sys/stream.h +2 -1
  25. data/vendor/libgit2/include/git2/sys/transport.h +3 -1
  26. data/vendor/libgit2/include/git2/tag.h +9 -0
  27. data/vendor/libgit2/include/git2/tree.h +55 -0
  28. data/vendor/libgit2/src/annotated_commit.c +99 -80
  29. data/vendor/libgit2/src/annotated_commit.h +5 -2
  30. data/vendor/libgit2/src/array.h +40 -0
  31. data/vendor/libgit2/src/blame.c +8 -3
  32. data/vendor/libgit2/src/blame_git.c +2 -1
  33. data/vendor/libgit2/src/blob.c +71 -39
  34. data/vendor/libgit2/src/branch.c +2 -1
  35. data/vendor/libgit2/src/checkout.c +66 -42
  36. data/vendor/libgit2/src/commit.c +67 -3
  37. data/vendor/libgit2/src/config_cache.c +2 -1
  38. data/vendor/libgit2/src/config_file.c +32 -27
  39. data/vendor/libgit2/src/curl_stream.c +89 -6
  40. data/vendor/libgit2/src/delta-apply.c +36 -5
  41. data/vendor/libgit2/src/delta-apply.h +12 -0
  42. data/vendor/libgit2/src/describe.c +3 -2
  43. data/vendor/libgit2/src/diff.c +13 -20
  44. data/vendor/libgit2/src/diff_tform.c +5 -3
  45. data/vendor/libgit2/src/filebuf.c +12 -2
  46. data/vendor/libgit2/src/filebuf.h +1 -0
  47. data/vendor/libgit2/src/fnmatch.c +18 -5
  48. data/vendor/libgit2/src/global.c +18 -0
  49. data/vendor/libgit2/src/global.h +1 -0
  50. data/vendor/libgit2/src/ignore.c +11 -3
  51. data/vendor/libgit2/src/index.c +11 -5
  52. data/vendor/libgit2/src/indexer.c +11 -7
  53. data/vendor/libgit2/src/iterator.c +1575 -1468
  54. data/vendor/libgit2/src/iterator.h +52 -69
  55. data/vendor/libgit2/src/merge.c +160 -63
  56. data/vendor/libgit2/src/merge.h +61 -2
  57. data/vendor/libgit2/src/merge_driver.c +397 -0
  58. data/vendor/libgit2/src/merge_driver.h +60 -0
  59. data/vendor/libgit2/src/merge_file.c +11 -49
  60. data/vendor/libgit2/src/netops.c +12 -10
  61. data/vendor/libgit2/src/object.c +3 -6
  62. data/vendor/libgit2/src/object_api.c +19 -1
  63. data/vendor/libgit2/src/odb_loose.c +1 -1
  64. data/vendor/libgit2/src/openssl_stream.c +16 -3
  65. data/vendor/libgit2/src/pack-objects.c +3 -1
  66. data/vendor/libgit2/src/pack.c +5 -9
  67. data/vendor/libgit2/src/path.c +14 -0
  68. data/vendor/libgit2/src/path.h +12 -0
  69. data/vendor/libgit2/src/pathspec.c +1 -1
  70. data/vendor/libgit2/src/posix.c +7 -0
  71. data/vendor/libgit2/src/posix.h +1 -0
  72. data/vendor/libgit2/src/proxy.c +32 -0
  73. data/vendor/libgit2/src/proxy.h +14 -0
  74. data/vendor/libgit2/src/push.c +7 -7
  75. data/vendor/libgit2/src/rebase.c +61 -31
  76. data/vendor/libgit2/src/refdb_fs.c +1 -0
  77. data/vendor/libgit2/src/refs.c +16 -1
  78. data/vendor/libgit2/src/remote.c +20 -6
  79. data/vendor/libgit2/src/repository.c +1 -1
  80. data/vendor/libgit2/src/reset.c +1 -1
  81. data/vendor/libgit2/src/settings.c +23 -1
  82. data/vendor/libgit2/src/signature.c +26 -1
  83. data/vendor/libgit2/src/stransport_stream.c +5 -2
  84. data/vendor/libgit2/src/stream.h +2 -2
  85. data/vendor/libgit2/src/submodule.c +3 -2
  86. data/vendor/libgit2/src/tag.c +8 -2
  87. data/vendor/libgit2/src/transports/http.c +32 -9
  88. data/vendor/libgit2/src/transports/local.c +4 -1
  89. data/vendor/libgit2/src/transports/smart.c +6 -0
  90. data/vendor/libgit2/src/transports/smart.h +1 -0
  91. data/vendor/libgit2/src/transports/smart_protocol.c +61 -17
  92. data/vendor/libgit2/src/transports/winhttp.c +130 -11
  93. data/vendor/libgit2/src/tree.c +329 -98
  94. data/vendor/libgit2/src/tree.h +4 -5
  95. data/vendor/libgit2/src/unix/map.c +5 -0
  96. data/vendor/libgit2/src/win32/map.c +24 -5
  97. data/vendor/libgit2/src/xdiff/xprepare.c +2 -1
  98. metadata +10 -4
  99. data/vendor/libgit2/Makefile.embed +0 -60
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+ #ifndef INCLUDE_merge_driver_h__
8
+ #define INCLUDE_merge_driver_h__
9
+
10
+ #include "git2/merge.h"
11
+ #include "git2/index.h"
12
+ #include "git2/sys/merge.h"
13
+
14
+ struct git_merge_driver_source {
15
+ git_repository *repo;
16
+ const char *default_driver;
17
+ const git_merge_file_options *file_opts;
18
+
19
+ const git_index_entry *ancestor;
20
+ const git_index_entry *ours;
21
+ const git_index_entry *theirs;
22
+ };
23
+
24
+ typedef struct git_merge_driver__builtin {
25
+ git_merge_driver base;
26
+ git_merge_file_favor_t favor;
27
+ } git_merge_driver__builtin;
28
+
29
+ extern int git_merge_driver_global_init(void);
30
+
31
+ extern int git_merge_driver_for_path(
32
+ char **name_out,
33
+ git_merge_driver **driver_out,
34
+ git_repository *repo,
35
+ const char *path);
36
+
37
+ /* Merge driver configuration */
38
+ extern int git_merge_driver_for_source(
39
+ const char **name_out,
40
+ git_merge_driver **driver_out,
41
+ const git_merge_driver_source *src);
42
+
43
+ extern int git_merge_driver__builtin_apply(
44
+ git_merge_driver *self,
45
+ const char **path_out,
46
+ uint32_t *mode_out,
47
+ git_buf *merged_out,
48
+ const char *filter_name,
49
+ const git_merge_driver_source *src);
50
+
51
+ /* Merge driver for text files, performs a standard three-way merge */
52
+ extern git_merge_driver__builtin git_merge_driver__text;
53
+
54
+ /* Merge driver for union-style merging */
55
+ extern git_merge_driver__builtin git_merge_driver__union;
56
+
57
+ /* Merge driver for unmergeable (binary) files: always produces conflicts */
58
+ extern git_merge_driver git_merge_driver__binary;
59
+
60
+ #endif
@@ -11,6 +11,7 @@
11
11
  #include "fileops.h"
12
12
  #include "index.h"
13
13
  #include "diff_xdiff.h"
14
+ #include "merge.h"
14
15
 
15
16
  #include "git2/repository.h"
16
17
  #include "git2/object.h"
@@ -26,52 +27,6 @@
26
27
 
27
28
  #define GIT_MERGE_FILE_SIDE_EXISTS(X) ((X)->mode != 0)
28
29
 
29
- GIT_INLINE(const char *) merge_file_best_path(
30
- const git_merge_file_input *ancestor,
31
- const git_merge_file_input *ours,
32
- const git_merge_file_input *theirs)
33
- {
34
- if (!ancestor) {
35
- if (ours && theirs && strcmp(ours->path, theirs->path) == 0)
36
- return ours->path;
37
-
38
- return NULL;
39
- }
40
-
41
- if (ours && strcmp(ancestor->path, ours->path) == 0)
42
- return theirs ? theirs->path : NULL;
43
- else if(theirs && strcmp(ancestor->path, theirs->path) == 0)
44
- return ours ? ours->path : NULL;
45
-
46
- return NULL;
47
- }
48
-
49
- GIT_INLINE(int) merge_file_best_mode(
50
- const git_merge_file_input *ancestor,
51
- const git_merge_file_input *ours,
52
- const git_merge_file_input *theirs)
53
- {
54
- /*
55
- * If ancestor didn't exist and either ours or theirs is executable,
56
- * assume executable. Otherwise, if any mode changed from the ancestor,
57
- * use that one.
58
- */
59
- if (!ancestor) {
60
- if ((ours && ours->mode == GIT_FILEMODE_BLOB_EXECUTABLE) ||
61
- (theirs && theirs->mode == GIT_FILEMODE_BLOB_EXECUTABLE))
62
- return GIT_FILEMODE_BLOB_EXECUTABLE;
63
-
64
- return GIT_FILEMODE_BLOB;
65
- } else if (ours && theirs) {
66
- if (ancestor->mode == ours->mode)
67
- return theirs->mode;
68
-
69
- return ours->mode;
70
- }
71
-
72
- return 0;
73
- }
74
-
75
30
  int git_merge_file__input_from_index(
76
31
  git_merge_file_input *input_out,
77
32
  git_odb_object **odb_object_out,
@@ -177,8 +132,12 @@ static int merge_file__xdiff(
177
132
  goto done;
178
133
  }
179
134
 
180
- if ((path = merge_file_best_path(ancestor, ours, theirs)) != NULL &&
181
- (out->path = strdup(path)) == NULL) {
135
+ path = git_merge_file__best_path(
136
+ ancestor ? ancestor->path : NULL,
137
+ ours->path,
138
+ theirs->path);
139
+
140
+ if (path != NULL && (out->path = git__strdup(path)) == NULL) {
182
141
  error = -1;
183
142
  goto done;
184
143
  }
@@ -186,7 +145,10 @@ static int merge_file__xdiff(
186
145
  out->automergeable = (xdl_result == 0);
187
146
  out->ptr = (const char *)mmbuffer.ptr;
188
147
  out->len = mmbuffer.size;
189
- out->mode = merge_file_best_mode(ancestor, ours, theirs);
148
+ out->mode = git_merge_file__best_mode(
149
+ ancestor ? ancestor->mode : 0,
150
+ ours->mode,
151
+ theirs->mode);
190
152
 
191
153
  done:
192
154
  if (error < 0)
@@ -257,16 +257,18 @@ int gitno_extract_url_parts(
257
257
  *port = git__strdup(default_port);
258
258
  GITERR_CHECK_ALLOC(*port);
259
259
 
260
- if (u.field_set & (1 << UF_PATH)) {
261
- *path = git__substrdup(_path, u.field_data[UF_PATH].len);
262
- GITERR_CHECK_ALLOC(*path);
263
- } else {
264
- git__free(*port);
265
- *port = NULL;
266
- git__free(*host);
267
- *host = NULL;
268
- giterr_set(GITERR_NET, "invalid url, missing path");
269
- return GIT_EINVALIDSPEC;
260
+ if (path) {
261
+ if (u.field_set & (1 << UF_PATH)) {
262
+ *path = git__substrdup(_path, u.field_data[UF_PATH].len);
263
+ GITERR_CHECK_ALLOC(*path);
264
+ } else {
265
+ git__free(*port);
266
+ *port = NULL;
267
+ git__free(*host);
268
+ *host = NULL;
269
+ giterr_set(GITERR_NET, "invalid url, missing path");
270
+ return GIT_EINVALIDSPEC;
271
+ }
270
272
  }
271
273
 
272
274
  if (u.field_set & (1 << UF_USERINFO)) {
@@ -12,6 +12,7 @@
12
12
  #include "commit.h"
13
13
  #include "tree.h"
14
14
  #include "blob.h"
15
+ #include "oid.h"
15
16
  #include "tag.h"
16
17
 
17
18
  bool git_object__strict_input_validation = true;
@@ -166,13 +167,9 @@ int git_object_lookup_prefix(
166
167
  error = git_odb_read(&odb_obj, odb, id);
167
168
  }
168
169
  } else {
169
- git_oid short_oid;
170
+ git_oid short_oid = {{ 0 }};
170
171
 
171
- /* We copy the first len*4 bits from id and fill the remaining with 0s */
172
- memcpy(short_oid.id, id->id, (len + 1) / 2);
173
- if (len % 2)
174
- short_oid.id[len / 2] &= 0xF0;
175
- memset(short_oid.id + (len + 1) / 2, 0, (GIT_OID_HEXSZ - len) / 2);
172
+ git_oid__cpy_prefix(&short_oid, id, len);
176
173
 
177
174
  /* If len < GIT_OID_HEXSZ (a strict short oid was given), we have
178
175
  * 2 options :
@@ -15,7 +15,7 @@
15
15
  #include "tag.h"
16
16
 
17
17
  /**
18
- * Blob
18
+ * Commit
19
19
  */
20
20
  int git_commit_lookup(git_commit **out, git_repository *repo, const git_oid *id)
21
21
  {
@@ -42,6 +42,10 @@ git_repository *git_commit_owner(const git_commit *obj)
42
42
  return git_object_owner((const git_object *)obj);
43
43
  }
44
44
 
45
+ int git_commit_dup(git_commit **out, git_commit *obj)
46
+ {
47
+ return git_object_dup((git_object **)out, (git_object *)obj);
48
+ }
45
49
 
46
50
  /**
47
51
  * Tree
@@ -71,6 +75,10 @@ git_repository *git_tree_owner(const git_tree *obj)
71
75
  return git_object_owner((const git_object *)obj);
72
76
  }
73
77
 
78
+ int git_tree_dup(git_tree **out, git_tree *obj)
79
+ {
80
+ return git_object_dup((git_object **)out, (git_object *)obj);
81
+ }
74
82
 
75
83
  /**
76
84
  * Tag
@@ -100,6 +108,11 @@ git_repository *git_tag_owner(const git_tag *obj)
100
108
  return git_object_owner((const git_object *)obj);
101
109
  }
102
110
 
111
+ int git_tag_dup(git_tag **out, git_tag *obj)
112
+ {
113
+ return git_object_dup((git_object **)out, (git_object *)obj);
114
+ }
115
+
103
116
  /**
104
117
  * Blob
105
118
  */
@@ -127,3 +140,8 @@ git_repository *git_blob_owner(const git_blob *obj)
127
140
  {
128
141
  return git_object_owner((const git_object *)obj);
129
142
  }
143
+
144
+ int git_blob_dup(git_blob **out, git_blob *obj)
145
+ {
146
+ return git_object_dup((git_object **)out, (git_object *)obj);
147
+ }
@@ -91,7 +91,7 @@ static int object_mkdir(const git_buf *name, const loose_backend *be)
91
91
 
92
92
  static size_t get_binary_object_header(obj_hdr *hdr, git_buf *obj)
93
93
  {
94
- unsigned char c;
94
+ unsigned long c;
95
95
  unsigned char *data = (unsigned char *)obj->ptr;
96
96
  size_t shift, size, used = 0;
97
97
 
@@ -34,6 +34,8 @@
34
34
 
35
35
  SSL_CTX *git__ssl_ctx;
36
36
 
37
+ #define GIT_SSL_DEFAULT_CIPHERS "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES128-SHA256:DHE-DSS-AES256-SHA256:DHE-DSS-AES128-SHA:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA"
38
+
37
39
  #ifdef GIT_THREADS
38
40
 
39
41
  static git_mutex *openssl_locks;
@@ -85,6 +87,7 @@ int git_openssl_stream_global_init(void)
85
87
  {
86
88
  #ifdef GIT_OPENSSL
87
89
  long ssl_opts = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3;
90
+ const char *ciphers = git_libgit2__ssl_ciphers();
88
91
 
89
92
  /* Older OpenSSL and MacOS OpenSSL doesn't have this */
90
93
  #ifdef SSL_OP_NO_COMPRESSION
@@ -108,6 +111,16 @@ int git_openssl_stream_global_init(void)
108
111
  git__ssl_ctx = NULL;
109
112
  return -1;
110
113
  }
114
+
115
+ if (!ciphers) {
116
+ ciphers = GIT_SSL_DEFAULT_CIPHERS;
117
+ }
118
+
119
+ if(!SSL_CTX_set_cipher_list(git__ssl_ctx, ciphers)) {
120
+ SSL_CTX_free(git__ssl_ctx);
121
+ git__ssl_ctx = NULL;
122
+ return -1;
123
+ }
111
124
  #endif
112
125
 
113
126
  git__on_shutdown(shutdown_ssl);
@@ -483,11 +496,11 @@ int openssl_certificate(git_cert **out, git_stream *stream)
483
496
  return 0;
484
497
  }
485
498
 
486
- static int openssl_set_proxy(git_stream *stream, const char *proxy_url)
499
+ static int openssl_set_proxy(git_stream *stream, const git_proxy_options *proxy_opts)
487
500
  {
488
501
  openssl_stream *st = (openssl_stream *) stream;
489
502
 
490
- return git_stream_set_proxy(st->io, proxy_url);
503
+ return git_stream_set_proxy(st->io, proxy_opts);
491
504
  }
492
505
 
493
506
  ssize_t openssl_write(git_stream *stream, const char *data, size_t len, int flags)
@@ -510,7 +523,7 @@ ssize_t openssl_read(git_stream *stream, void *data, size_t len)
510
523
  int ret;
511
524
 
512
525
  if ((ret = SSL_read(st->ssl, data, len)) <= 0)
513
- ssl_set_error(st->ssl, ret);
526
+ return ssl_set_error(st->ssl, ret);
514
527
 
515
528
  return ret;
516
529
  }
@@ -848,8 +848,10 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
848
848
 
849
849
  git_packbuilder__cache_unlock(pb);
850
850
 
851
- if (overflow)
851
+ if (overflow) {
852
+ git__free(delta_buf);
852
853
  return -1;
854
+ }
853
855
 
854
856
  trg_object->delta_data = git__realloc(delta_buf, delta_size);
855
857
  GITERR_CHECK_ALLOC(trg_object->delta_data);
@@ -494,21 +494,19 @@ int git_packfile_resolve_header(
494
494
  int error;
495
495
 
496
496
  error = git_packfile_unpack_header(&size, &type, &p->mwf, &w_curs, &curpos);
497
- git_mwindow_close(&w_curs);
498
497
  if (error < 0)
499
498
  return error;
500
499
 
501
500
  if (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
502
501
  size_t base_size;
503
- git_rawobj delta;
502
+ git_packfile_stream stream;
503
+
504
504
  base_offset = get_delta_base(p, &w_curs, &curpos, type, offset);
505
505
  git_mwindow_close(&w_curs);
506
- error = packfile_unpack_compressed(&delta, p, &w_curs, &curpos, size, type);
507
- git_mwindow_close(&w_curs);
508
- if (error < 0)
506
+ if ((error = git_packfile_stream_open(&stream, p, curpos)) < 0)
509
507
  return error;
510
- error = git__delta_read_header(delta.data, delta.len, &base_size, size_p);
511
- git__free(delta.data);
508
+ error = git__delta_read_header_fromstream(&base_size, size_p, &stream);
509
+ git_packfile_stream_free(&stream);
512
510
  if (error < 0)
513
511
  return error;
514
512
  } else
@@ -517,7 +515,6 @@ int git_packfile_resolve_header(
517
515
  while (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
518
516
  curpos = base_offset;
519
517
  error = git_packfile_unpack_header(&size, &type, &p->mwf, &w_curs, &curpos);
520
- git_mwindow_close(&w_curs);
521
518
  if (error < 0)
522
519
  return error;
523
520
  if (type != GIT_OBJ_OFS_DELTA && type != GIT_OBJ_REF_DELTA)
@@ -585,7 +582,6 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
585
582
  elem->base_key = obj_offset;
586
583
 
587
584
  error = git_packfile_unpack_header(&size, &type, &p->mwf, &w_curs, &curpos);
588
- git_mwindow_close(&w_curs);
589
585
 
590
586
  if (error < 0)
591
587
  goto on_error;
@@ -810,6 +810,20 @@ int git_path_cmp(
810
810
  return (c1 < c2) ? -1 : (c1 > c2) ? 1 : 0;
811
811
  }
812
812
 
813
+ size_t git_path_common_dirlen(const char *one, const char *two)
814
+ {
815
+ const char *p, *q, *dirsep = NULL;
816
+
817
+ for (p = one, q = two; *p && *q; p++, q++) {
818
+ if (*p == '/' && *q == '/')
819
+ dirsep = p;
820
+ else if (*p != *q)
821
+ break;
822
+ }
823
+
824
+ return dirsep ? (dirsep - one) + 1 : 0;
825
+ }
826
+
813
827
  int git_path_make_relative(git_buf *path, const char *parent)
814
828
  {
815
829
  const char *p, *q, *p_dirsep, *q_dirsep;
@@ -202,6 +202,18 @@ extern bool git_path_contains(git_buf *dir, const char *item);
202
202
  */
203
203
  extern bool git_path_contains_dir(git_buf *parent, const char *subdir);
204
204
 
205
+ /**
206
+ * Determine the common directory length between two paths, including
207
+ * the final path separator. For example, given paths 'a/b/c/1.txt
208
+ * and 'a/b/c/d/2.txt', the common directory is 'a/b/c/', and this
209
+ * will return the length of the string 'a/b/c/', which is 6.
210
+ *
211
+ * @param one The first path
212
+ * @param two The second path
213
+ * @return The length of the common directory
214
+ */
215
+ extern size_t git_path_common_dirlen(const char *one, const char *two);
216
+
205
217
  /**
206
218
  * Make the path relative to the given parent path.
207
219
  *
@@ -418,7 +418,7 @@ static int pathspec_match_from_iterator(
418
418
  GITERR_CHECK_ALLOC(m);
419
419
  }
420
420
 
421
- if ((error = git_iterator_reset(iter, ps->prefix, ps->prefix)) < 0)
421
+ if ((error = git_iterator_reset_range(iter, ps->prefix, ps->prefix)) < 0)
422
422
  goto done;
423
423
 
424
424
  if (git_iterator_type(iter) == GIT_ITERATOR_TYPE_WORKDIR &&
@@ -224,6 +224,13 @@ int git__page_size(size_t *page_size)
224
224
  return 0;
225
225
  }
226
226
 
227
+ int git__mmap_alignment(size_t *alignment)
228
+ {
229
+ /* dummy; here we don't need any alignment anyway */
230
+ *alignment = 4096;
231
+ return 0;
232
+ }
233
+
227
234
 
228
235
  int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset)
229
236
  {
@@ -109,6 +109,7 @@ extern int p_getcwd(char *buffer_out, size_t size);
109
109
  extern int p_rename(const char *from, const char *to);
110
110
 
111
111
  extern int git__page_size(size_t *page_size);
112
+ extern int git__mmap_alignment(size_t *page_size);
112
113
 
113
114
  /**
114
115
  * Platform-dependent methods