rugged 0.25.1.1 → 0.26.0b1

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 (108) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/include/git2/common.h +10 -0
  4. data/vendor/libgit2/include/git2/merge.h +2 -1
  5. data/vendor/libgit2/include/git2/oid.h +4 -5
  6. data/vendor/libgit2/include/git2/submodule.h +2 -11
  7. data/vendor/libgit2/include/git2/sys/repository.h +29 -0
  8. data/vendor/libgit2/include/git2/tree.h +13 -0
  9. data/vendor/libgit2/src/apply.c +2 -2
  10. data/vendor/libgit2/src/attr_file.c +5 -5
  11. data/vendor/libgit2/src/attrcache.c +9 -7
  12. data/vendor/libgit2/src/blob.c +3 -3
  13. data/vendor/libgit2/src/branch.c +10 -10
  14. data/vendor/libgit2/src/buffer.c +4 -4
  15. data/vendor/libgit2/src/cache.c +1 -1
  16. data/vendor/libgit2/src/checkout.c +29 -25
  17. data/vendor/libgit2/src/cherrypick.c +2 -2
  18. data/vendor/libgit2/src/commit.c +2 -2
  19. data/vendor/libgit2/src/commit_list.c +2 -2
  20. data/vendor/libgit2/src/common.h +1 -1
  21. data/vendor/libgit2/src/config.c +12 -12
  22. data/vendor/libgit2/src/config_file.c +9 -9
  23. data/vendor/libgit2/src/crlf.c +1 -1
  24. data/vendor/libgit2/src/delta.c +4 -4
  25. data/vendor/libgit2/src/describe.c +11 -11
  26. data/vendor/libgit2/src/diff_driver.c +1 -1
  27. data/vendor/libgit2/src/diff_file.c +1 -1
  28. data/vendor/libgit2/src/diff_generate.c +2 -2
  29. data/vendor/libgit2/src/diff_print.c +5 -5
  30. data/vendor/libgit2/src/diff_tform.c +1 -1
  31. data/vendor/libgit2/src/diff_xdiff.c +2 -2
  32. data/vendor/libgit2/src/fetch.c +1 -1
  33. data/vendor/libgit2/src/fetchhead.c +8 -8
  34. data/vendor/libgit2/src/filebuf.c +9 -9
  35. data/vendor/libgit2/src/fileops.c +27 -27
  36. data/vendor/libgit2/src/filter.c +4 -4
  37. data/vendor/libgit2/src/hashsig.c +2 -2
  38. data/vendor/libgit2/src/ignore.c +4 -4
  39. data/vendor/libgit2/src/index.c +15 -15
  40. data/vendor/libgit2/src/indexer.c +39 -6
  41. data/vendor/libgit2/src/integer.h +6 -6
  42. data/vendor/libgit2/src/merge.c +12 -12
  43. data/vendor/libgit2/src/merge_file.c +1 -1
  44. data/vendor/libgit2/src/mwindow.c +1 -1
  45. data/vendor/libgit2/src/netops.c +4 -4
  46. data/vendor/libgit2/src/notes.c +3 -3
  47. data/vendor/libgit2/src/object.c +5 -5
  48. data/vendor/libgit2/src/odb.c +12 -12
  49. data/vendor/libgit2/src/odb_loose.c +6 -6
  50. data/vendor/libgit2/src/oid.c +5 -5
  51. data/vendor/libgit2/src/openssl_stream.c +3 -3
  52. data/vendor/libgit2/src/pack-objects.c +6 -6
  53. data/vendor/libgit2/src/pack.c +19 -10
  54. data/vendor/libgit2/src/pack.h +1 -0
  55. data/vendor/libgit2/src/patch_generate.c +5 -3
  56. data/vendor/libgit2/src/path.c +15 -15
  57. data/vendor/libgit2/src/pathspec.c +2 -2
  58. data/vendor/libgit2/src/posix.c +1 -1
  59. data/vendor/libgit2/src/push.c +6 -6
  60. data/vendor/libgit2/src/rebase.c +12 -12
  61. data/vendor/libgit2/src/refdb.c +1 -1
  62. data/vendor/libgit2/src/refdb_fs.c +12 -12
  63. data/vendor/libgit2/src/reflog.c +2 -2
  64. data/vendor/libgit2/src/refs.c +34 -17
  65. data/vendor/libgit2/src/refs.h +3 -0
  66. data/vendor/libgit2/src/remote.c +3 -3
  67. data/vendor/libgit2/src/repository.c +46 -13
  68. data/vendor/libgit2/src/repository.h +2 -1
  69. data/vendor/libgit2/src/reset.c +1 -1
  70. data/vendor/libgit2/src/revert.c +2 -2
  71. data/vendor/libgit2/src/revparse.c +5 -5
  72. data/vendor/libgit2/src/revwalk.c +3 -3
  73. data/vendor/libgit2/src/settings.c +6 -1
  74. data/vendor/libgit2/src/sha1_lookup.c +1 -1
  75. data/vendor/libgit2/src/signature.c +1 -1
  76. data/vendor/libgit2/src/socket_stream.c +5 -5
  77. data/vendor/libgit2/src/sortedcache.c +5 -5
  78. data/vendor/libgit2/src/stash.c +6 -6
  79. data/vendor/libgit2/src/status.c +4 -4
  80. data/vendor/libgit2/src/submodule.c +159 -110
  81. data/vendor/libgit2/src/submodule.h +3 -0
  82. data/vendor/libgit2/src/sysdir.c +2 -2
  83. data/vendor/libgit2/src/tag.c +14 -14
  84. data/vendor/libgit2/src/trace.c +1 -1
  85. data/vendor/libgit2/src/transport.c +1 -1
  86. data/vendor/libgit2/src/transports/auth_negotiate.c +4 -4
  87. data/vendor/libgit2/src/transports/cred.c +1 -1
  88. data/vendor/libgit2/src/transports/git.c +3 -3
  89. data/vendor/libgit2/src/transports/http.c +6 -6
  90. data/vendor/libgit2/src/transports/local.c +2 -2
  91. data/vendor/libgit2/src/transports/smart.c +5 -5
  92. data/vendor/libgit2/src/transports/smart_pkt.c +4 -4
  93. data/vendor/libgit2/src/transports/smart_protocol.c +1 -1
  94. data/vendor/libgit2/src/transports/ssh.c +9 -9
  95. data/vendor/libgit2/src/transports/winhttp.c +155 -118
  96. data/vendor/libgit2/src/tree-cache.c +2 -2
  97. data/vendor/libgit2/src/tree.c +35 -20
  98. data/vendor/libgit2/src/unix/map.c +1 -1
  99. data/vendor/libgit2/src/util.c +3 -3
  100. data/vendor/libgit2/src/vector.c +3 -0
  101. data/vendor/libgit2/src/win32/dir.c +3 -3
  102. data/vendor/libgit2/src/win32/findfile.c +1 -1
  103. data/vendor/libgit2/src/win32/map.c +6 -6
  104. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -2
  105. data/vendor/libgit2/src/win32/w32_util.c +1 -1
  106. data/vendor/libgit2/src/win32/w32_util.h +1 -1
  107. data/vendor/libgit2/src/zstream.c +1 -1
  108. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8896b74252b35510af887c426c515e6abe35e6c4
4
- data.tar.gz: 8306ac916e4e642ba76a01de227fb2ea97e3540e
3
+ metadata.gz: b1dd3ce63e4c8e41cc6b04950f6c4fa362e0fa1a
4
+ data.tar.gz: 8c814affe49194cf47e62db78b6a9a5ce8aceac2
5
5
  SHA512:
6
- metadata.gz: 47ccd1925cde215bfe6c650cd84c1916c98fe122b31cd363d852d144b696182310939feac2cb66e15b98d6008d13ece94d154d4b75c194959720291353a1f455
7
- data.tar.gz: d5a2615583cac6794e30c26d01041b1c0fa0605ccfef5f581e0099fc5ae94ac1e4c941cae432edfa8c4b4e2d8aa8841e7a29c6b4f91c0bdb9c09fac8aaad220b
6
+ metadata.gz: 5f16ed52fe780c821490e08db1143e9cd0ab75707e735a7913df2ac84f7e00299a10b1d438733358a5949890fbedf90df169e0761c07516091589e4daf78343e
7
+ data.tar.gz: c41dd20c1066a54ba80f30d60353eba731075cc3aa1793817409b7781b8609307172a3643defa465205113c1032b18cfb5ad66fd1c3e5415a7dd550acaabd1c2
@@ -4,5 +4,5 @@
4
4
  # For full terms see the included LICENSE file.
5
5
 
6
6
  module Rugged
7
- Version = VERSION = '0.25.1.1'
7
+ Version = VERSION = '0.26.0b1'
8
8
  end
@@ -175,6 +175,7 @@ typedef enum {
175
175
  GIT_OPT_SET_SSL_CERT_LOCATIONS,
176
176
  GIT_OPT_SET_USER_AGENT,
177
177
  GIT_OPT_ENABLE_STRICT_OBJECT_CREATION,
178
+ GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION,
178
179
  GIT_OPT_SET_SSL_CIPHERS,
179
180
  GIT_OPT_GET_USER_AGENT,
180
181
  } git_libgit2_opt_t;
@@ -289,6 +290,15 @@ typedef enum {
289
290
  * > will be validated when creating a new commit. This defaults
290
291
  * > to enabled.
291
292
  *
293
+ * * opts(GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION, int enabled)
294
+ *
295
+ * > Validate the target of a symbolic ref when creating it. For
296
+ * > example, `foobar` is not a valid ref, therefore `foobar` is
297
+ * > not a valid target for a symbolic ref by default, whereas
298
+ * > `refs/heads/foobar` is. Disabling this bypasses validation
299
+ * > so that an arbitrary strings such as `foobar` can be used
300
+ * > for a symbolic ref target. This defaults to enabled.
301
+ *
292
302
  * * opts(GIT_OPT_SET_SSL_CIPHERS, const char *ciphers)
293
303
  *
294
304
  * > Set the SSL ciphers use for HTTPS connections.
@@ -290,7 +290,8 @@ typedef struct {
290
290
  } git_merge_options;
291
291
 
292
292
  #define GIT_MERGE_OPTIONS_VERSION 1
293
- #define GIT_MERGE_OPTIONS_INIT {GIT_MERGE_OPTIONS_VERSION}
293
+ #define GIT_MERGE_OPTIONS_INIT { \
294
+ GIT_MERGE_OPTIONS_VERSION, GIT_MERGE_FIND_RENAMES }
294
295
 
295
296
  /**
296
297
  * Initializes a `git_merge_options` with default values. Equivalent to
@@ -50,17 +50,16 @@ GIT_EXTERN(int) git_oid_fromstr(git_oid *out, const char *str);
50
50
  * Parse a hex formatted null-terminated string into a git_oid.
51
51
  *
52
52
  * @param out oid structure the result is written into.
53
- * @param str input hex string; must be at least 4 characters
54
- * long and null-terminated.
53
+ * @param str input hex string; must be null-terminated.
55
54
  * @return 0 or an error code
56
55
  */
57
56
  GIT_EXTERN(int) git_oid_fromstrp(git_oid *out, const char *str);
58
57
 
59
58
  /**
60
- * Parse N characters of a hex formatted object id into a git_oid
59
+ * Parse N characters of a hex formatted object id into a git_oid.
61
60
  *
62
- * If N is odd, N-1 characters will be parsed instead.
63
- * The remaining space in the git_oid will be set to zero.
61
+ * If N is odd, the last byte's high nibble will be read in and the
62
+ * low nibble set to zero.
64
63
  *
65
64
  * @param out oid structure the result is written into.
66
65
  * @param str input hex string of at least size `length`
@@ -134,9 +134,7 @@ typedef struct git_submodule_update_options {
134
134
  * checkout, set the `checkout_strategy` to
135
135
  * `GIT_CHECKOUT_NONE`. Generally you will want the use
136
136
  * GIT_CHECKOUT_SAFE to update files in the working
137
- * directory. Use the `clone_checkout_strategy` field
138
- * to set the checkout strategy that will be used in
139
- * the case where update needs to clone the repository.
137
+ * directory.
140
138
  */
141
139
  git_checkout_options checkout_opts;
142
140
 
@@ -148,13 +146,6 @@ typedef struct git_submodule_update_options {
148
146
  */
149
147
  git_fetch_options fetch_opts;
150
148
 
151
- /**
152
- * The checkout strategy to use when the sub repository needs to
153
- * be cloned. Use GIT_CHECKOUT_SAFE to create all files
154
- * in the working directory for the newly cloned repository.
155
- */
156
- unsigned int clone_checkout_strategy;
157
-
158
149
  /**
159
150
  * Allow fetching from the submodule's default remote if the target
160
151
  * commit isn't found. Enabled by default.
@@ -166,7 +157,7 @@ typedef struct git_submodule_update_options {
166
157
  #define GIT_SUBMODULE_UPDATE_OPTIONS_INIT \
167
158
  { GIT_SUBMODULE_UPDATE_OPTIONS_VERSION, \
168
159
  { GIT_CHECKOUT_OPTIONS_VERSION, GIT_CHECKOUT_SAFE }, \
169
- GIT_FETCH_OPTIONS_INIT, GIT_CHECKOUT_SAFE, 1 }
160
+ GIT_FETCH_OPTIONS_INIT, 1 }
170
161
 
171
162
  /**
172
163
  * Initializes a `git_submodule_update_options` with default values.
@@ -135,6 +135,35 @@ GIT_EXTERN(void) git_repository_set_index(git_repository *repo, git_index *index
135
135
  */
136
136
  GIT_EXTERN(int) git_repository_set_bare(git_repository *repo);
137
137
 
138
+ /**
139
+ * Load and cache all submodules.
140
+ *
141
+ * Because the `.gitmodules` file is unstructured, loading submodules is an
142
+ * O(N) operation. Any operation (such as `git_rebase_init`) that requires
143
+ * accessing all submodules is O(N^2) in the number of submodules, if it
144
+ * has to look each one up individually. This function loads all submodules
145
+ * and caches them so that subsequent calls to `git_submodule_lookup` are O(1).
146
+ *
147
+ * @param repo the repository whose submodules will be cached.
148
+ */
149
+ GIT_EXTERN(int) git_repository_submodule_cache_all(
150
+ git_repository *repo);
151
+
152
+ /**
153
+ * Clear the submodule cache.
154
+ *
155
+ * Clear the submodule cache populated by `git_repository_submodule_cache_all`.
156
+ * If there is no cache, do nothing.
157
+ *
158
+ * The cache incorporates data from the repository's configuration, as well
159
+ * as the state of the working tree, the index, and HEAD. So any time any
160
+ * of these has changed, the cache might become invalid.
161
+ *
162
+ * @param repo the repository whose submodule cache will be cleared
163
+ */
164
+ GIT_EXTERN(int) git_repository_submodule_cache_clear(
165
+ git_repository *repo);
166
+
138
167
  /** @} */
139
168
  GIT_END_DECL
140
169
  #endif
@@ -375,6 +375,19 @@ GIT_EXTERN(void) git_treebuilder_filter(
375
375
  GIT_EXTERN(int) git_treebuilder_write(
376
376
  git_oid *id, git_treebuilder *bld);
377
377
 
378
+ /**
379
+ * Write the contents of the tree builder as a tree object
380
+ * using a shared git_buf.
381
+ *
382
+ * @see git_treebuilder_write
383
+ *
384
+ * @param oid Pointer to store the OID of the newly written tree
385
+ * @param bld Tree builder to write
386
+ * @param tree Shared buffer for writing the tree. Will be grown as necessary.
387
+ * @return 0 or an error code
388
+ */
389
+ GIT_EXTERN(int) git_treebuilder_write_with_buffer(
390
+ git_oid *oid, git_treebuilder *bld, git_buf *tree);
378
391
 
379
392
  /** Callback for the tree traversal method */
380
393
  typedef int (*git_treewalk_cb)(
@@ -173,7 +173,7 @@ static int apply_hunk(
173
173
  git_diff_line *line = git_array_get(patch->lines, linenum);
174
174
 
175
175
  if (!line) {
176
- error = apply_err("Preimage does not contain line %"PRIuZ, linenum);
176
+ error = apply_err("preimage does not contain line %"PRIuZ, linenum);
177
177
  goto done;
178
178
  }
179
179
 
@@ -193,7 +193,7 @@ static int apply_hunk(
193
193
  line_num = hunk->hunk.new_start ? hunk->hunk.new_start - 1 : 0;
194
194
 
195
195
  if (!find_hunk_linenum(&line_num, image, &preimage, line_num)) {
196
- error = apply_err("Hunk at line %d did not apply",
196
+ error = apply_err("hunk at line %d did not apply",
197
197
  hunk->hunk.new_start);
198
198
  goto done;
199
199
  }
@@ -30,7 +30,7 @@ int git_attr_file__new(
30
30
  GITERR_CHECK_ALLOC(attrs);
31
31
 
32
32
  if (git_mutex_init(&attrs->lock) < 0) {
33
- giterr_set(GITERR_OS, "Failed to initialize lock");
33
+ giterr_set(GITERR_OS, "failed to initialize lock");
34
34
  git__free(attrs);
35
35
  return -1;
36
36
  }
@@ -49,7 +49,7 @@ int git_attr_file__clear_rules(git_attr_file *file, bool need_lock)
49
49
  git_attr_rule *rule;
50
50
 
51
51
  if (need_lock && git_mutex_lock(&file->lock) < 0) {
52
- giterr_set(GITERR_OS, "Failed to lock attribute file");
52
+ giterr_set(GITERR_OS, "failed to lock attribute file");
53
53
  return -1;
54
54
  }
55
55
 
@@ -140,7 +140,7 @@ int git_attr_file__load(
140
140
  break;
141
141
  }
142
142
  default:
143
- giterr_set(GITERR_INVALID, "Unknown file source %d", source);
143
+ giterr_set(GITERR_INVALID, "unknown file source %d", source);
144
144
  return -1;
145
145
  }
146
146
 
@@ -212,7 +212,7 @@ int git_attr_file__out_of_date(
212
212
  }
213
213
 
214
214
  default:
215
- giterr_set(GITERR_INVALID, "Invalid file type %d", file->source);
215
+ giterr_set(GITERR_INVALID, "invalid file type %d", file->source);
216
216
  return -1;
217
217
  }
218
218
  }
@@ -238,7 +238,7 @@ int git_attr_file__parse_buffer(
238
238
  context = attrs->entry->path;
239
239
 
240
240
  if (git_mutex_lock(&attrs->lock) < 0) {
241
- giterr_set(GITERR_OS, "Failed to lock attribute file");
241
+ giterr_set(GITERR_OS, "failed to lock attribute file");
242
242
  return -1;
243
243
  }
244
244
 
@@ -12,7 +12,7 @@ GIT_INLINE(int) attr_cache_lock(git_attr_cache *cache)
12
12
  GIT_UNUSED(cache); /* avoid warning if threading is off */
13
13
 
14
14
  if (git_mutex_lock(&cache->lock) < 0) {
15
- giterr_set(GITERR_OS, "Unable to get attr cache lock");
15
+ giterr_set(GITERR_OS, "unable to get attr cache lock");
16
16
  return -1;
17
17
  }
18
18
  return 0;
@@ -121,20 +121,22 @@ static int attr_cache_remove(git_attr_cache *cache, git_attr_file *file)
121
121
  {
122
122
  int error = 0;
123
123
  git_attr_file_entry *entry;
124
+ git_attr_file *old = NULL;
124
125
 
125
126
  if (!file)
126
127
  return 0;
128
+
127
129
  if ((error = attr_cache_lock(cache)) < 0)
128
130
  return error;
129
131
 
130
132
  if ((entry = attr_cache_lookup_entry(cache, file->entry->path)) != NULL)
131
- file = git__compare_and_swap(&entry->file[file->source], file, NULL);
133
+ old = git__compare_and_swap(&entry->file[file->source], file, NULL);
132
134
 
133
135
  attr_cache_unlock(cache);
134
136
 
135
- if (file) {
136
- GIT_REFCOUNT_OWN(file, NULL);
137
- git_attr_file__free(file);
137
+ if (old) {
138
+ GIT_REFCOUNT_OWN(old, NULL);
139
+ git_attr_file__free(old);
138
140
  }
139
141
 
140
142
  return error;
@@ -365,7 +367,7 @@ int git_attr_cache__do_init(git_repository *repo)
365
367
 
366
368
  /* set up lock */
367
369
  if (git_mutex_init(&cache->lock) < 0) {
368
- giterr_set(GITERR_OS, "Unable to initialize lock for attr cache");
370
+ giterr_set(GITERR_OS, "unable to initialize lock for attr cache");
369
371
  git__free(cache);
370
372
  return -1;
371
373
  }
@@ -430,7 +432,7 @@ int git_attr_cache__insert_macro(git_repository *repo, git_attr_rule *macro)
430
432
  return 0;
431
433
 
432
434
  if (git_mutex_lock(&cache->lock) < 0) {
433
- giterr_set(GITERR_OS, "Unable to get attr cache lock");
435
+ giterr_set(GITERR_OS, "unable to get attr cache lock");
434
436
  error = -1;
435
437
  } else {
436
438
  git_strmap_insert(macros, macro->match.pattern, macro, error);
@@ -96,7 +96,7 @@ static int write_file_stream(
96
96
  p_close(fd);
97
97
 
98
98
  if (written != file_size || read_len < 0) {
99
- giterr_set(GITERR_OS, "Failed to read file into stream");
99
+ giterr_set(GITERR_OS, "failed to read file into stream");
100
100
  error = -1;
101
101
  }
102
102
 
@@ -142,7 +142,7 @@ static int write_symlink(
142
142
 
143
143
  read_len = p_readlink(path, link_data, link_size);
144
144
  if (read_len != (ssize_t)link_size) {
145
- giterr_set(GITERR_OS, "Failed to create blob. Can't read symlink '%s'", path);
145
+ giterr_set(GITERR_OS, "failed to create blob: cannot read symlink '%s'", path);
146
146
  git__free(link_data);
147
147
  return -1;
148
148
  }
@@ -186,7 +186,7 @@ int git_blob__create_from_paths(
186
186
  goto done;
187
187
 
188
188
  if (S_ISDIR(st.st_mode)) {
189
- giterr_set(GITERR_ODB, "cannot create blob from '%s'; it is a directory", content_path);
189
+ giterr_set(GITERR_ODB, "cannot create blob from '%s': it is a directory", content_path);
190
190
  error = GIT_EDIRECTORY;
191
191
  goto done;
192
192
  }
@@ -33,7 +33,7 @@ static int retrieve_branch_reference(
33
33
  /* OOM */;
34
34
  else if ((error = git_reference_lookup(&branch, repo, ref_name.ptr)) < 0)
35
35
  giterr_set(
36
- GITERR_REFERENCE, "Cannot locate %s branch '%s'",
36
+ GITERR_REFERENCE, "cannot locate %s branch '%s'",
37
37
  is_remote ? "remote-tracking" : "local", branch_name);
38
38
 
39
39
  *branch_reference_out = branch; /* will be NULL on error */
@@ -46,7 +46,7 @@ static int not_a_local_branch(const char *reference_name)
46
46
  {
47
47
  giterr_set(
48
48
  GITERR_INVALID,
49
- "Reference '%s' is not a local branch.", reference_name);
49
+ "reference '%s' is not a local branch.", reference_name);
50
50
  return -1;
51
51
  }
52
52
 
@@ -80,7 +80,7 @@ static int create_branch(
80
80
  }
81
81
 
82
82
  if (is_unmovable_head && force) {
83
- giterr_set(GITERR_REFERENCE, "Cannot force update branch '%s' as it is "
83
+ giterr_set(GITERR_REFERENCE, "cannot force update branch '%s' as it is "
84
84
  "the current HEAD of the repository.", branch_name);
85
85
  error = -1;
86
86
  goto cleanup;
@@ -135,7 +135,7 @@ int git_branch_delete(git_reference *branch)
135
135
  assert(branch);
136
136
 
137
137
  if (!git_reference_is_branch(branch) && !git_reference_is_remote(branch)) {
138
- giterr_set(GITERR_INVALID, "Reference '%s' is not a valid branch.",
138
+ giterr_set(GITERR_INVALID, "reference '%s' is not a valid branch.",
139
139
  git_reference_name(branch));
140
140
  return GIT_ENOTFOUND;
141
141
  }
@@ -144,7 +144,7 @@ int git_branch_delete(git_reference *branch)
144
144
  return is_head;
145
145
 
146
146
  if (is_head) {
147
- giterr_set(GITERR_REFERENCE, "Cannot delete branch '%s' as it is "
147
+ giterr_set(GITERR_REFERENCE, "cannot delete branch '%s' as it is "
148
148
  "the current HEAD of the repository.", git_reference_name(branch));
149
149
  return -1;
150
150
  }
@@ -306,7 +306,7 @@ int git_branch_name(
306
306
  branch_name += strlen(GIT_REFS_REMOTES_DIR);
307
307
  } else {
308
308
  giterr_set(GITERR_INVALID,
309
- "Reference '%s' is neither a local nor a remote branch.", ref->name);
309
+ "reference '%s' is neither a local nor a remote branch.", ref->name);
310
310
  return -1;
311
311
  }
312
312
  *out = branch_name;
@@ -436,7 +436,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
436
436
 
437
437
  /* Verify that this is a remote branch */
438
438
  if (!git_reference__is_remote(refname)) {
439
- giterr_set(GITERR_INVALID, "Reference '%s' is not a remote branch.",
439
+ giterr_set(GITERR_INVALID, "reference '%s' is not a remote branch.",
440
440
  refname);
441
441
  error = GIT_ERROR;
442
442
  goto cleanup;
@@ -463,7 +463,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
463
463
  git_remote_free(remote);
464
464
 
465
465
  giterr_set(GITERR_REFERENCE,
466
- "Reference '%s' is ambiguous", refname);
466
+ "reference '%s' is ambiguous", refname);
467
467
  error = GIT_EAMBIGUOUS;
468
468
  goto cleanup;
469
469
  }
@@ -477,7 +477,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
477
477
  error = git_buf_puts(buf, remote_name);
478
478
  } else {
479
479
  giterr_set(GITERR_REFERENCE,
480
- "Could not determine remote for '%s'", refname);
480
+ "could not determine remote for '%s'", refname);
481
481
  error = GIT_ENOTFOUND;
482
482
  }
483
483
 
@@ -566,7 +566,7 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
566
566
  local = 0;
567
567
  else {
568
568
  giterr_set(GITERR_REFERENCE,
569
- "Cannot set upstream for branch '%s'", shortname);
569
+ "cannot set upstream for branch '%s'", shortname);
570
570
  return GIT_ENOTFOUND;
571
571
  }
572
572
 
@@ -962,14 +962,14 @@ int git_buf_unquote(git_buf *buf)
962
962
  case '0': case '1': case '2': case '3':
963
963
  if (j == buf->size-3) {
964
964
  giterr_set(GITERR_INVALID,
965
- "Truncated quoted character \\%c", ch);
965
+ "truncated quoted character \\%c", ch);
966
966
  return -1;
967
967
  }
968
968
 
969
969
  if (buf->ptr[j+1] < '0' || buf->ptr[j+1] > '7' ||
970
970
  buf->ptr[j+2] < '0' || buf->ptr[j+2] > '7') {
971
971
  giterr_set(GITERR_INVALID,
972
- "Truncated quoted character \\%c%c%c",
972
+ "truncated quoted character \\%c%c%c",
973
973
  buf->ptr[j], buf->ptr[j+1], buf->ptr[j+2]);
974
974
  return -1;
975
975
  }
@@ -981,7 +981,7 @@ int git_buf_unquote(git_buf *buf)
981
981
  break;
982
982
 
983
983
  default:
984
- giterr_set(GITERR_INVALID, "Invalid quoted character \\%c", ch);
984
+ giterr_set(GITERR_INVALID, "invalid quoted character \\%c", ch);
985
985
  return -1;
986
986
  }
987
987
  }
@@ -995,6 +995,6 @@ int git_buf_unquote(git_buf *buf)
995
995
  return 0;
996
996
 
997
997
  invalid:
998
- giterr_set(GITERR_INVALID, "Invalid quoted line");
998
+ giterr_set(GITERR_INVALID, "invalid quoted line");
999
999
  return -1;
1000
1000
  }
@@ -70,7 +70,7 @@ int git_cache_init(git_cache *cache)
70
70
  cache->map = git_oidmap_alloc();
71
71
  GITERR_CHECK_ALLOC(cache->map);
72
72
  if (git_rwlock_init(&cache->lock)) {
73
- giterr_set(GITERR_OS, "Failed to initialize cache rwlock");
73
+ giterr_set(GITERR_OS, "failed to initialize cache rwlock");
74
74
  return -1;
75
75
  }
76
76
  return 0;
@@ -1021,13 +1021,13 @@ static int checkout_conflicts_load_byname_entry(
1021
1021
  *theirs_out = NULL;
1022
1022
 
1023
1023
  if (!name_entry->ancestor) {
1024
- giterr_set(GITERR_INDEX, "A NAME entry exists without an ancestor");
1024
+ giterr_set(GITERR_INDEX, "a NAME entry exists without an ancestor");
1025
1025
  error = -1;
1026
1026
  goto done;
1027
1027
  }
1028
1028
 
1029
1029
  if (!name_entry->ours && !name_entry->theirs) {
1030
- giterr_set(GITERR_INDEX, "A NAME entry exists without an ours or theirs");
1030
+ giterr_set(GITERR_INDEX, "a NAME entry exists without an ours or theirs");
1031
1031
  error = -1;
1032
1032
  goto done;
1033
1033
  }
@@ -1035,7 +1035,7 @@ static int checkout_conflicts_load_byname_entry(
1035
1035
  if ((ancestor = checkout_conflicts_search_ancestor(data,
1036
1036
  name_entry->ancestor)) == NULL) {
1037
1037
  giterr_set(GITERR_INDEX,
1038
- "A NAME entry referenced ancestor entry '%s' which does not exist in the main index",
1038
+ "a NAME entry referenced ancestor entry '%s' which does not exist in the main index",
1039
1039
  name_entry->ancestor);
1040
1040
  error = -1;
1041
1041
  goto done;
@@ -1047,7 +1047,7 @@ static int checkout_conflicts_load_byname_entry(
1047
1047
  else if ((ours = checkout_conflicts_search_branch(data, name_entry->ours)) == NULL ||
1048
1048
  ours->ours == NULL) {
1049
1049
  giterr_set(GITERR_INDEX,
1050
- "A NAME entry referenced our entry '%s' which does not exist in the main index",
1050
+ "a NAME entry referenced our entry '%s' which does not exist in the main index",
1051
1051
  name_entry->ours);
1052
1052
  error = -1;
1053
1053
  goto done;
@@ -1062,7 +1062,7 @@ static int checkout_conflicts_load_byname_entry(
1062
1062
  else if ((theirs = checkout_conflicts_search_branch(data, name_entry->theirs)) == NULL ||
1063
1063
  theirs->theirs == NULL) {
1064
1064
  giterr_set(GITERR_INDEX,
1065
- "A NAME entry referenced their entry '%s' which does not exist in the main index",
1065
+ "a NAME entry referenced their entry '%s' which does not exist in the main index",
1066
1066
  name_entry->theirs);
1067
1067
  error = -1;
1068
1068
  goto done;
@@ -1161,7 +1161,7 @@ static int checkout_conflicts_mark_directoryfile(
1161
1161
  if ((error = git_index_find(&j, index, path)) < 0) {
1162
1162
  if (error == GIT_ENOTFOUND)
1163
1163
  giterr_set(GITERR_INDEX,
1164
- "Index inconsistency, could not find entry for expected conflict '%s'", path);
1164
+ "index inconsistency, could not find entry for expected conflict '%s'", path);
1165
1165
 
1166
1166
  goto done;
1167
1167
  }
@@ -1169,7 +1169,7 @@ static int checkout_conflicts_mark_directoryfile(
1169
1169
  for (; j < len; j++) {
1170
1170
  if ((entry = git_index_get_byindex(index, j)) == NULL) {
1171
1171
  giterr_set(GITERR_INDEX,
1172
- "Index inconsistency, truncated index while loading expected conflict '%s'", path);
1172
+ "index inconsistency, truncated index while loading expected conflict '%s'", path);
1173
1173
  error = -1;
1174
1174
  goto done;
1175
1175
  }
@@ -1254,14 +1254,14 @@ static int checkout_verify_paths(
1254
1254
 
1255
1255
  if (action & CHECKOUT_ACTION__REMOVE) {
1256
1256
  if (!git_path_isvalid(repo, delta->old_file.path, flags)) {
1257
- giterr_set(GITERR_CHECKOUT, "Cannot remove invalid path '%s'", delta->old_file.path);
1257
+ giterr_set(GITERR_CHECKOUT, "cannot remove invalid path '%s'", delta->old_file.path);
1258
1258
  return -1;
1259
1259
  }
1260
1260
  }
1261
1261
 
1262
1262
  if (action & ~CHECKOUT_ACTION__REMOVE) {
1263
1263
  if (!git_path_isvalid(repo, delta->new_file.path, flags)) {
1264
- giterr_set(GITERR_CHECKOUT, "Cannot checkout to invalid path '%s'", delta->new_file.path);
1264
+ giterr_set(GITERR_CHECKOUT, "cannot checkout to invalid path '%s'", delta->new_file.path);
1265
1265
  return -1;
1266
1266
  }
1267
1267
  }
@@ -1430,7 +1430,7 @@ static int mkpath2file(
1430
1430
  */
1431
1431
  error = git_futils_rmdir_r(path, NULL, GIT_RMDIR_REMOVE_FILES);
1432
1432
  } else if (errno != ENOENT) {
1433
- giterr_set(GITERR_OS, "Failed to stat file '%s'", path);
1433
+ giterr_set(GITERR_OS, "failed to stat '%s'", path);
1434
1434
  return GIT_EEXISTS;
1435
1435
  } else {
1436
1436
  giterr_clear();
@@ -1454,7 +1454,7 @@ static int checkout_stream_write(
1454
1454
  int ret;
1455
1455
 
1456
1456
  if ((ret = p_write(stream->fd, buffer, len)) < 0)
1457
- giterr_set(GITERR_OS, "Could not write to '%s'", stream->path);
1457
+ giterr_set(GITERR_OS, "could not write to '%s'", stream->path);
1458
1458
 
1459
1459
  return ret;
1460
1460
  }
@@ -1503,7 +1503,7 @@ static int blob_content_to_file(
1503
1503
  mode = GIT_FILEMODE_BLOB;
1504
1504
 
1505
1505
  if ((fd = p_open(path, flags, mode)) < 0) {
1506
- giterr_set(GITERR_OS, "Could not open '%s' for writing", path);
1506
+ giterr_set(GITERR_OS, "could not open '%s' for writing", path);
1507
1507
  return fd;
1508
1508
  }
1509
1509
 
@@ -1540,7 +1540,7 @@ static int blob_content_to_file(
1540
1540
  data->perfdata.stat_calls++;
1541
1541
 
1542
1542
  if ((error = p_stat(path, st)) < 0) {
1543
- giterr_set(GITERR_OS, "Error statting '%s'", path);
1543
+ giterr_set(GITERR_OS, "failed to stat '%s'", path);
1544
1544
  return error;
1545
1545
  }
1546
1546
 
@@ -1567,7 +1567,7 @@ static int blob_content_to_link(
1567
1567
 
1568
1568
  if (data->can_symlink) {
1569
1569
  if ((error = p_symlink(git_buf_cstr(&linktarget), path)) < 0)
1570
- giterr_set(GITERR_OS, "Could not create symlink %s", path);
1570
+ giterr_set(GITERR_OS, "could not create symlink %s", path);
1571
1571
  } else {
1572
1572
  error = git_futils_fake_symlink(git_buf_cstr(&linktarget), path);
1573
1573
  }
@@ -1576,7 +1576,7 @@ static int blob_content_to_link(
1576
1576
  data->perfdata.stat_calls++;
1577
1577
 
1578
1578
  if ((error = p_lstat(path, st)) < 0)
1579
- giterr_set(GITERR_CHECKOUT, "Could not stat symlink %s", path);
1579
+ giterr_set(GITERR_CHECKOUT, "could not stat symlink %s", path);
1580
1580
 
1581
1581
  st->st_mode = GIT_FILEMODE_LINK;
1582
1582
  }
@@ -1621,7 +1621,7 @@ static int checkout_submodule_update_index(
1621
1621
  data->perfdata.stat_calls++;
1622
1622
  if (p_stat(fullpath->ptr, &st) < 0) {
1623
1623
  giterr_set(
1624
- GITERR_CHECKOUT, "Could not stat submodule %s\n", file->path);
1624
+ GITERR_CHECKOUT, "could not stat submodule %s\n", file->path);
1625
1625
  return GIT_ENOTFOUND;
1626
1626
  }
1627
1627
 
@@ -1694,7 +1694,7 @@ static int checkout_safe_for_update_only(
1694
1694
  return 0;
1695
1695
 
1696
1696
  /* otherwise, stat error and no update */
1697
- giterr_set(GITERR_OS, "Failed to stat file '%s'", path);
1697
+ giterr_set(GITERR_OS, "failed to stat '%s'", path);
1698
1698
  return -1;
1699
1699
  }
1700
1700
 
@@ -1966,7 +1966,7 @@ static int checkout_path_suffixed(git_buf *path, const char *suffix)
1966
1966
  if (i == INT_MAX) {
1967
1967
  git_buf_truncate(path, path_len);
1968
1968
 
1969
- giterr_set(GITERR_CHECKOUT, "Could not write '%s': working directory file exists", path->ptr);
1969
+ giterr_set(GITERR_CHECKOUT, "could not write '%s': working directory file exists", path->ptr);
1970
1970
  return GIT_EEXISTS;
1971
1971
  }
1972
1972
 
@@ -2097,7 +2097,7 @@ static int checkout_write_merge(
2097
2097
  goto done;
2098
2098
 
2099
2099
  if (result.path == NULL || result.mode == 0) {
2100
- giterr_set(GITERR_CHECKOUT, "Could not merge contents of file");
2100
+ giterr_set(GITERR_CHECKOUT, "could not merge contents of file");
2101
2101
  error = GIT_ECONFLICT;
2102
2102
  goto done;
2103
2103
  }
@@ -2345,7 +2345,7 @@ static int checkout_data_init(
2345
2345
  memset(data, 0, sizeof(*data));
2346
2346
 
2347
2347
  if (!repo) {
2348
- giterr_set(GITERR_CHECKOUT, "Cannot checkout nothing");
2348
+ giterr_set(GITERR_CHECKOUT, "cannot checkout nothing");
2349
2349
  return -1;
2350
2350
  }
2351
2351
 
@@ -2553,6 +2553,10 @@ int git_checkout_iterator(
2553
2553
  GIT_ITERATOR_IGNORE_CASE : GIT_ITERATOR_DONT_IGNORE_CASE;
2554
2554
  baseline_opts.start = data.pfx;
2555
2555
  baseline_opts.end = data.pfx;
2556
+ if (opts && (opts->checkout_strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH)) {
2557
+ baseline_opts.pathlist.count = opts->paths.count;
2558
+ baseline_opts.pathlist.strings = opts->paths.strings;
2559
+ }
2556
2560
 
2557
2561
  if (data.opts.baseline_index) {
2558
2562
  if ((error = git_iterator_for_index(
@@ -2647,7 +2651,7 @@ int git_checkout_index(
2647
2651
 
2648
2652
  if (!index && !repo) {
2649
2653
  giterr_set(GITERR_CHECKOUT,
2650
- "Must provide either repository or index to checkout");
2654
+ "must provide either repository or index to checkout");
2651
2655
  return -1;
2652
2656
  }
2653
2657
 
@@ -2655,7 +2659,7 @@ int git_checkout_index(
2655
2659
  git_index_owner(index) &&
2656
2660
  git_index_owner(index) != repo) {
2657
2661
  giterr_set(GITERR_CHECKOUT,
2658
- "Index to checkout does not match repository");
2662
+ "index to checkout does not match repository");
2659
2663
  return -1;
2660
2664
  } else if(index && repo && !git_index_owner(index)) {
2661
2665
  GIT_REFCOUNT_OWN(index, repo);
@@ -2694,12 +2698,12 @@ int git_checkout_tree(
2694
2698
 
2695
2699
  if (!treeish && !repo) {
2696
2700
  giterr_set(GITERR_CHECKOUT,
2697
- "Must provide either repository or tree to checkout");
2701
+ "must provide either repository or tree to checkout");
2698
2702
  return -1;
2699
2703
  }
2700
2704
  if (treeish && repo && git_object_owner(treeish) != repo) {
2701
2705
  giterr_set(GITERR_CHECKOUT,
2702
- "Object to checkout does not match repository");
2706
+ "object to checkout does not match repository");
2703
2707
  return -1;
2704
2708
  }
2705
2709
 
@@ -2709,7 +2713,7 @@ int git_checkout_tree(
2709
2713
  if (treeish) {
2710
2714
  if (git_object_peel((git_object **)&tree, treeish, GIT_OBJ_TREE) < 0) {
2711
2715
  giterr_set(
2712
- GITERR_CHECKOUT, "Provided object cannot be peeled to a tree");
2716
+ GITERR_CHECKOUT, "provided object cannot be peeled to a tree");
2713
2717
  return -1;
2714
2718
  }
2715
2719
  }