rugged 0.23.0b4 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5365f2755f87b76139a9752e291cd2a92e4cef74
4
- data.tar.gz: 25b17d77f34a4e73cc0529cb4dd6ea23e6a1d0e6
3
+ metadata.gz: cc5c92158c3f0efe09b400923043fea4b06a616e
4
+ data.tar.gz: b77ee9c931d0872300d02da8dd203407d38f8657
5
5
  SHA512:
6
- metadata.gz: 4997a2cb895a33fc4ecacb59d7436999e6ee71965b107f9a7e098576744500baae2c506d95b9bf6bfc7e8fb5dddf332ec66ead60ed28e3e747c32911448dcc01
7
- data.tar.gz: 55f33cc8e38044499830e2c362bf4abe0384a4e6d32cd11fa5313f6e3e15d4f53a43ed5dab76197baa60dc30f20c076eac5a2a8fdc6a161de9fe1ca49f62db4b
6
+ metadata.gz: b907420c4a42b97b6175701a373d872b5218a11f59b0e7d8f992f418be4ff9164ed8449727d91628ba1fb1b3a5972a2d33ff3b2162b245232526bb318efca94f
7
+ data.tar.gz: 041e9cef3a07e628b6078baeaba421b3965826a6e0c3f2bbf805178eda4590f0172574f012ce9a97a5cb6f456123e2161706c72d38afff05a341197711330bb2
@@ -2181,6 +2181,54 @@ static VALUE rb_git_checkout_tree(int argc, VALUE *argv, VALUE self)
2181
2181
  return Qnil;
2182
2182
  }
2183
2183
 
2184
+ /**
2185
+ * call-seq: repo.checkout_index(index[,options]) -> nil
2186
+ *
2187
+ * Updates files in the index and the working tree to match the content of the
2188
+ * commit pointed at by +index+.
2189
+ *
2190
+ * See Repository#checkout_tree for a list of supported +options+.
2191
+ */
2192
+ static VALUE rb_git_checkout_index(int argc, VALUE *argv, VALUE self)
2193
+ {
2194
+ VALUE rb_index, rb_options;
2195
+ git_repository *repo;
2196
+ git_index *index;
2197
+ git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
2198
+ struct rugged_cb_payload *payload;
2199
+ int error, exception = 0;
2200
+
2201
+ rb_scan_args(argc, argv, "10:", &rb_index, &rb_options);
2202
+
2203
+ if (!rb_obj_is_kind_of(rb_index, rb_cRuggedIndex))
2204
+ rb_raise(rb_eTypeError, "Expected Rugged::Index");
2205
+
2206
+ Data_Get_Struct(self, git_repository, repo);
2207
+ Data_Get_Struct(rb_index, git_index, index);
2208
+
2209
+ rugged_parse_checkout_options(&opts, rb_options);
2210
+
2211
+ error = git_checkout_index(repo, index, &opts);
2212
+ xfree(opts.paths.strings);
2213
+
2214
+ if ((payload = opts.notify_payload) != NULL) {
2215
+ exception = payload->exception;
2216
+ xfree(opts.notify_payload);
2217
+ }
2218
+
2219
+ if ((payload = opts.progress_payload) != NULL) {
2220
+ exception = payload->exception;
2221
+ xfree(opts.progress_payload);
2222
+ }
2223
+
2224
+ if (exception)
2225
+ rb_jump_tag(exception);
2226
+
2227
+ rugged_exception_check(error);
2228
+
2229
+ return Qnil;
2230
+ }
2231
+
2184
2232
  /**
2185
2233
  * call-seq: repo.checkout_head([options]) -> nil
2186
2234
  *
@@ -2483,6 +2531,7 @@ void Init_rugged_repo(void)
2483
2531
  rb_define_method(rb_cRuggedRepo, "default_signature", rb_git_repo_default_signature, 0);
2484
2532
 
2485
2533
  rb_define_method(rb_cRuggedRepo, "checkout_tree", rb_git_checkout_tree, -1);
2534
+ rb_define_method(rb_cRuggedRepo, "checkout_index", rb_git_checkout_index, -1);
2486
2535
  rb_define_method(rb_cRuggedRepo, "checkout_head", rb_git_checkout_head, -1);
2487
2536
 
2488
2537
  rb_define_method(rb_cRuggedRepo, "cherrypick", rb_git_repo_cherrypick, -1);
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.23.0b4'
2
+ Version = VERSION = '0.23.0'
3
3
  end
@@ -137,7 +137,13 @@ GIT_EXTERN(int) git_filter_list_apply_to_data(
137
137
  git_buf *in);
138
138
 
139
139
  /**
140
- * Apply filter list to the contents of a file on disk
140
+ * Apply a filter list to the contents of a file on disk
141
+ *
142
+ * @param out buffer into which to store the filtered file
143
+ * @param filters the list of filters to apply
144
+ * @param repo the repository in which to perform the filtering
145
+ * @param path the path of the file to filter, a relative path will be
146
+ * taken as relative to the workdir
141
147
  */
142
148
  GIT_EXTERN(int) git_filter_list_apply_to_file(
143
149
  git_buf *out,
@@ -146,24 +152,51 @@ GIT_EXTERN(int) git_filter_list_apply_to_file(
146
152
  const char *path);
147
153
 
148
154
  /**
149
- * Apply filter list to the contents of a blob
155
+ * Apply a filter list to the contents of a blob
156
+ *
157
+ * @param out buffer into which to store the filtered file
158
+ * @param filters the list of filters to apply
159
+ * @param blob the blob to filter
150
160
  */
151
161
  GIT_EXTERN(int) git_filter_list_apply_to_blob(
152
162
  git_buf *out,
153
163
  git_filter_list *filters,
154
164
  git_blob *blob);
155
165
 
166
+ /**
167
+ * Apply a filter list to an arbitrary buffer as a stream
168
+ *
169
+ * @param filters the list of filters to apply
170
+ * @param data the buffer to filter
171
+ * @param target the stream into which the data will be written
172
+ */
156
173
  GIT_EXTERN(int) git_filter_list_stream_data(
157
174
  git_filter_list *filters,
158
175
  git_buf *data,
159
176
  git_writestream *target);
160
177
 
178
+ /**
179
+ * Apply a filter list to a file as a stream
180
+ *
181
+ * @param filters the list of filters to apply
182
+ * @param repo the repository in which to perform the filtering
183
+ * @param path the path of the file to filter, a relative path will be
184
+ * taken as relative to the workdir
185
+ * @param target the stream into which the data will be written
186
+ */
161
187
  GIT_EXTERN(int) git_filter_list_stream_file(
162
188
  git_filter_list *filters,
163
189
  git_repository *repo,
164
190
  const char *path,
165
191
  git_writestream *target);
166
192
 
193
+ /**
194
+ * Apply a filter list to a blob as a stream
195
+ *
196
+ * @param filters the list of filters to apply
197
+ * @param blob the blob to filter
198
+ * @param target the stream into which the data will be written
199
+ */
167
200
  GIT_EXTERN(int) git_filter_list_stream_blob(
168
201
  git_filter_list *filters,
169
202
  git_blob *blob,
@@ -583,17 +583,6 @@ GIT_EXTERN(int) git_submodule_open(
583
583
  */
584
584
  GIT_EXTERN(int) git_submodule_reload(git_submodule *submodule, int force);
585
585
 
586
- /**
587
- * Reread all submodule info.
588
- *
589
- * Call this to reload all cached submodule information for the repo.
590
- *
591
- * @param repo The repository to reload submodule data for
592
- * @param force Force full reload even if the data doesn't seem out of date
593
- * @return 0 on success, <0 on error
594
- */
595
- GIT_EXTERN(int) git_submodule_reload_all(git_repository *repo, int force);
596
-
597
586
  /**
598
587
  * Get the status for a submodule.
599
588
  *
@@ -336,7 +336,7 @@ static int format_binary(
336
336
  "delta" : "literal";
337
337
  const char *scan, *end;
338
338
 
339
- git_buf_printf(pi->buf, "%s %lu\n", typename, inflatedlen);
339
+ git_buf_printf(pi->buf, "%s %" PRIuZ "\n", typename, inflatedlen);
340
340
  pi->line.num_lines++;
341
341
 
342
342
  for (scan = data, end = data + datalen; scan < end; ) {
@@ -13,13 +13,6 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts);
13
13
 
14
14
  int git_fetch_download_pack(git_remote *remote, const git_remote_callbacks *callbacks);
15
15
 
16
- int git_fetch__download_pack(
17
- git_transport *t,
18
- git_repository *repo,
19
- git_transfer_progress *stats,
20
- git_transfer_progress_cb progress_cb,
21
- void *progress_payload);
22
-
23
16
  int git_fetch_setup_walk(git_revwalk **out, git_repository *repo);
24
17
 
25
18
  #endif
@@ -1852,7 +1852,6 @@ int git_iterator_walk(
1852
1852
  const git_index_entry **iterator_item; /* next in each iterator */
1853
1853
  const git_index_entry **cur_items; /* current path in each iter */
1854
1854
  const git_index_entry *first_match;
1855
- int cur_item_modified;
1856
1855
  size_t i, j;
1857
1856
  int error = 0;
1858
1857
 
@@ -1875,7 +1874,6 @@ int git_iterator_walk(
1875
1874
  cur_items[i] = NULL;
1876
1875
 
1877
1876
  first_match = NULL;
1878
- cur_item_modified = 0;
1879
1877
 
1880
1878
  /* Find the next path(s) to consume from each iterator */
1881
1879
  for (i = 0; i < cnt; i++) {
@@ -1898,9 +1896,6 @@ int git_iterator_walk(
1898
1896
 
1899
1897
  first_match = iterator_item[i];
1900
1898
  cur_items[i] = iterator_item[i];
1901
- } else if (path_diff > 0) {
1902
- /* No entry for the current item, this is modified */
1903
- cur_item_modified = 1;
1904
1899
  } else if (path_diff == 0) {
1905
1900
  cur_items[i] = iterator_item[i];
1906
1901
  }
@@ -1926,8 +1921,8 @@ int git_iterator_walk(
1926
1921
  }
1927
1922
 
1928
1923
  done:
1929
- git__free(iterator_item);
1930
- git__free(cur_items);
1924
+ git__free((git_index_entry **)iterator_item);
1925
+ git__free((git_index_entry **)cur_items);
1931
1926
 
1932
1927
  if (error == GIT_ITEROVER)
1933
1928
  error = 0;
@@ -53,7 +53,7 @@ static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_
53
53
  int git_odb__format_object_header(char *hdr, size_t n, git_off_t obj_len, git_otype obj_type)
54
54
  {
55
55
  const char *type_str = git_object_type2string(obj_type);
56
- int len = p_snprintf(hdr, n, "%s %lld", type_str, obj_len);
56
+ int len = p_snprintf(hdr, n, "%s %lld", type_str, (long long)obj_len);
57
57
  assert(len > 0 && len <= (int)n);
58
58
  return len+1;
59
59
  }
@@ -413,6 +413,7 @@ void openssl_free(git_stream *stream)
413
413
  {
414
414
  openssl_stream *st = (openssl_stream *) stream;
415
415
 
416
+ git__free(st->host);
416
417
  git__free(st->cert_info.data);
417
418
  git_stream_free(st->io);
418
419
  git__free(st);
@@ -142,6 +142,7 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
142
142
  giterr_set(
143
143
  GITERR_INVALID,
144
144
  "'%s' is not a valid refspec.", input);
145
+ git_refspec__free(refspec);
145
146
  return -1;
146
147
  }
147
148
 
@@ -153,6 +154,8 @@ void git_refspec__free(git_refspec *refspec)
153
154
  git__free(refspec->src);
154
155
  git__free(refspec->dst);
155
156
  git__free(refspec->string);
157
+
158
+ memset(refspec, 0x0, sizeof(git_refspec));
156
159
  }
157
160
 
158
161
  const char *git_refspec_src(const git_refspec *refspec)
@@ -867,7 +867,9 @@ static int reserved_names_add8dot3(git_repository *repo, const char *path)
867
867
  {
868
868
  char *name = git_win32_path_8dot3_name(path);
869
869
  const char *def = GIT_DIR_SHORTNAME;
870
+ const char *def_dot_git = DOT_GIT;
870
871
  size_t name_len, def_len = CONST_STRLEN(GIT_DIR_SHORTNAME);
872
+ size_t def_dot_git_len = CONST_STRLEN(DOT_GIT);
871
873
  git_buf *buf;
872
874
 
873
875
  if (!name)
@@ -875,7 +877,8 @@ static int reserved_names_add8dot3(git_repository *repo, const char *path)
875
877
 
876
878
  name_len = strlen(name);
877
879
 
878
- if (name_len == def_len && memcmp(name, def, def_len) == 0) {
880
+ if ((name_len == def_len && memcmp(name, def, def_len) == 0) ||
881
+ (name_len == def_dot_git_len && memcmp(name, def_dot_git, def_dot_git_len) == 0)) {
879
882
  git__free(name);
880
883
  return 0;
881
884
  }
@@ -793,7 +793,6 @@ static int stage_new_file(const git_index_entry **entries, void *data)
793
793
 
794
794
  static int stage_new_files(
795
795
  git_index **out,
796
- git_repository *repo,
797
796
  git_tree *parent_tree,
798
797
  git_tree *tree)
799
798
  {
@@ -886,7 +885,7 @@ int git_stash_apply(
886
885
  */
887
886
  } else if ((opts.flags & GIT_STASH_APPLY_REINSTATE_INDEX) == 0) {
888
887
  if ((error = stage_new_files(
889
- &stash_adds, repo, stash_parent_tree, stash_tree)) < 0 ||
888
+ &stash_adds, stash_parent_tree, stash_tree)) < 0 ||
890
889
  (error = merge_indexes(
891
890
  &unstashed_index, repo, stash_parent_tree, repo_index, stash_adds)) < 0)
892
891
  goto cleanup;
@@ -168,11 +168,18 @@ int git_submodule_lookup(
168
168
  return error;
169
169
  }
170
170
 
171
- /* If it's not configured, we need to check for the path */
171
+ /* If it's not configured or we're looking by path */
172
172
  if (location == 0 || location == GIT_SUBMODULE_STATUS_IN_WD) {
173
173
  git_config_backend *mods;
174
174
  const char *pattern = "submodule\\..*\\.path";
175
- fbp_data data = { name, NULL };
175
+ git_buf path = GIT_BUF_INIT;
176
+ fbp_data data = { NULL, NULL };
177
+
178
+ git_buf_puts(&path, name);
179
+ while (path.ptr[path.size-1] == '/') {
180
+ path.ptr[--path.size] = '\0';
181
+ }
182
+ data.path = path.ptr;
176
183
 
177
184
  mods = open_gitmodules(repo, GITMODULES_EXISTING);
178
185
 
@@ -189,8 +196,7 @@ int git_submodule_lookup(
189
196
  if (data.name) {
190
197
  git__free(sm->name);
191
198
  sm->name = data.name;
192
- sm->path = git__strdup(name);
193
- GITERR_CHECK_ALLOC(sm->path);
199
+ sm->path = git_buf_detach(&path);
194
200
 
195
201
  /* Try to load again with the right name */
196
202
  if ((error = git_submodule_reload(sm, false)) < 0) {
@@ -198,6 +204,8 @@ int git_submodule_lookup(
198
204
  return error;
199
205
  }
200
206
  }
207
+
208
+ git_buf_free(&path);
201
209
  }
202
210
 
203
211
  if ((error = git_submodule_location(&location, sm)) < 0) {
@@ -741,7 +749,7 @@ const char *git_submodule_update_to_str(git_submodule_update_t update)
741
749
  {
742
750
  int i;
743
751
  for (i = 0; i < (int)ARRAY_SIZE(_sm_update_map); ++i)
744
- if (_sm_update_map[i].map_value == update)
752
+ if (_sm_update_map[i].map_value == (int)update)
745
753
  return _sm_update_map[i].str_match;
746
754
  return NULL;
747
755
  }
@@ -1377,7 +1385,7 @@ int git_submodule_reload(git_submodule *sm, int force)
1377
1385
 
1378
1386
  git_buf_sets(&path, "submodule\\.");
1379
1387
  git_buf_text_puts_escape_regex(&path, sm->name);
1380
- git_buf_puts(&path, ".*");
1388
+ git_buf_puts(&path, "\\..*");
1381
1389
 
1382
1390
  if (git_buf_oom(&path)) {
1383
1391
  error = -1;
@@ -1691,28 +1699,9 @@ static int submodule_load_from_config(
1691
1699
 
1692
1700
  /* Deregister under name being replaced */
1693
1701
  if (replaced) {
1694
- git_submodule_free(sm);
1695
1702
  git__free(replaced);
1696
1703
  }
1697
1704
 
1698
- /* Insert under alternate key */
1699
- if (alternate) {
1700
- void *old_sm = NULL;
1701
-
1702
- if (error < 0)
1703
- goto done;
1704
- if (error > 0)
1705
- error = 0;
1706
-
1707
- GIT_REFCOUNT_INC(sm); /* increase refcount for new key */
1708
-
1709
- /* if we replaced an old module under this key, release the old one */
1710
- if (old_sm && ((git_submodule *)old_sm) != sm) {
1711
- git_submodule_free(old_sm);
1712
- /* TODO: log warning about multiple submodules with same path */
1713
- }
1714
- }
1715
-
1716
1705
  /* TODO: Look up path in index and if it is present but not a GITLINK
1717
1706
  * then this should be deleted (at least to match git's behavior)
1718
1707
  */
@@ -336,8 +336,11 @@ static int on_headers_complete(http_parser *parser)
336
336
  if (!t->owner->cred_acquire_cb) {
337
337
  no_callback = 1;
338
338
  } else {
339
- if (allowed_auth_types &&
340
- (!t->cred || 0 == (t->cred->credtype & allowed_auth_types))) {
339
+ if (allowed_auth_types) {
340
+ if (t->cred) {
341
+ t->cred->free(t->cred);
342
+ t->cred = NULL;
343
+ }
341
344
 
342
345
  error = t->owner->cred_acquire_cb(&t->cred,
343
346
  t->owner->url,
@@ -1096,7 +1096,6 @@ static int winhttp_stream_write_chunked(
1096
1096
  size_t len)
1097
1097
  {
1098
1098
  winhttp_stream *s = (winhttp_stream *)stream;
1099
- winhttp_subtransport *t = OWNING_SUBTRANSPORT(s);
1100
1099
  int error;
1101
1100
 
1102
1101
  if (!s->request && winhttp_stream_connect(s) < 0)
@@ -11,6 +11,7 @@
11
11
  #include <dirent.h>
12
12
  #include <sys/param.h>
13
13
  #include <sys/time.h>
14
+ #include <sys/stat.h>
14
15
 
15
16
  typedef int GIT_SOCKET;
16
17
  #define INVALID_SOCKET -1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugged
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0b4
4
+ version: 0.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-29 00:00:00.000000000 Z
12
+ date: 2015-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -519,9 +519,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
519
519
  version: 1.9.3
520
520
  required_rubygems_version: !ruby/object:Gem::Requirement
521
521
  requirements:
522
- - - ">"
522
+ - - ">="
523
523
  - !ruby/object:Gem::Version
524
- version: 1.3.1
524
+ version: '0'
525
525
  requirements: []
526
526
  rubyforge_project:
527
527
  rubygems_version: 2.2.2