rugged 0.25.0b7 → 0.25.0b8

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: bc3490bf1a853d0f30e8c825dca468582cb12e2f
4
- data.tar.gz: 9799cb94e85aaacd3aac5be5e2381acd65a1239a
3
+ metadata.gz: 9436b2f4df762f300fb1103b01d8f80c4973441a
4
+ data.tar.gz: fffa3a995093034dac0762800d16fb6d6fa9d38b
5
5
  SHA512:
6
- metadata.gz: 756066193b6fce22cd1a2af4818a58c785dbbee0026d1adb07082ba9af3772cead576bf7a5029ba8394d409d8cfdd25da5524ad173dfb6508ed943df3889dd68
7
- data.tar.gz: 7ead1eb36914cf7c49decee943477ead775dc03927b3532e6436adbb544848eafa5ba38bddfc2489b60e37fc52087dcae9ead8151005415dacd9eba5d21a8ede
6
+ metadata.gz: afad4fb30f5ba7c31ba25714422e2941df978bfd3df5c72d2510ce2c5372769bb74ee5ab0e24115d1e52a19dd84fbf3289453d187253a9f1f63fb6cd294d6c95
7
+ data.tar.gz: 7f5c92919ec876e1ba8a3c042fe9de29b632c4d5be8ed327c9e2226c6424d401b132b25f347c52000c7a1287d0958c7ff59a9768af4c2da3c4fe066a5ec776e4
@@ -1,3 +1,3 @@
1
1
  module Rugged
2
- Version = VERSION = '0.25.0b7'
2
+ Version = VERSION = '0.25.0b8'
3
3
  end
@@ -2722,7 +2722,7 @@ int git_checkout_tree(
2722
2722
  if ((error = git_repository_index(&index, repo)) < 0)
2723
2723
  return error;
2724
2724
 
2725
- if ((opts->checkout_strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH)) {
2725
+ if (opts && (opts->checkout_strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH)) {
2726
2726
  iter_opts.pathlist.count = opts->paths.count;
2727
2727
  iter_opts.pathlist.strings = opts->paths.strings;
2728
2728
  }
@@ -8,6 +8,7 @@
8
8
  #define INCLUDE_diff_h__
9
9
 
10
10
  #include "git2/diff.h"
11
+ #include "git2/patch.h"
11
12
  #include "git2/sys/diff.h"
12
13
  #include "git2/oid.h"
13
14
 
@@ -44,6 +45,7 @@ struct git_diff {
44
45
  int (*pfxcomp)(const char *str, const char *pfx);
45
46
  int (*entrycomp)(const void *a, const void *b);
46
47
 
48
+ int (*patch_fn)(git_patch **out, git_diff *diff, size_t idx);
47
49
  void (*free_fn)(git_diff *diff);
48
50
  };
49
51
 
@@ -7,6 +7,7 @@
7
7
  #include "common.h"
8
8
  #include "diff.h"
9
9
  #include "diff_generate.h"
10
+ #include "patch_generate.h"
10
11
  #include "fileops.h"
11
12
  #include "config.h"
12
13
  #include "attr_file.h"
@@ -414,6 +415,7 @@ static git_diff_generated *diff_generated_alloc(
414
415
  diff->base.repo = repo;
415
416
  diff->base.old_src = old_iter->type;
416
417
  diff->base.new_src = new_iter->type;
418
+ diff->base.patch_fn = git_patch_generated_from_diff;
417
419
  diff->base.free_fn = diff_generated_free;
418
420
  memcpy(&diff->base.opts, &dflt, sizeof(git_diff_options));
419
421
 
@@ -6,15 +6,10 @@
6
6
  */
7
7
  #include "common.h"
8
8
  #include "diff.h"
9
+ #include "diff_parse.h"
9
10
  #include "patch.h"
10
11
  #include "patch_parse.h"
11
12
 
12
- typedef struct {
13
- struct git_diff base;
14
-
15
- git_vector patches;
16
- } git_diff_parsed;
17
-
18
13
  static void diff_parsed_free(git_diff *d)
19
14
  {
20
15
  git_diff_parsed *diff = (git_diff_parsed *)d;
@@ -47,6 +42,7 @@ static git_diff_parsed *diff_parsed_alloc(void)
47
42
  diff->base.strncomp = git__strncmp;
48
43
  diff->base.pfxcomp = git__prefixcmp;
49
44
  diff->base.entrycomp = git_diff__entry_cmp;
45
+ diff->base.patch_fn = git_patch_parsed_from_diff;
50
46
  diff->base.free_fn = diff_parsed_free;
51
47
 
52
48
  git_pool_init(&diff->base.pool, 1);
@@ -0,0 +1,18 @@
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_diff_parse_h__
8
+ #define INCLUDE_diff_parse_h__
9
+
10
+ #include "diff.h"
11
+
12
+ typedef struct {
13
+ struct git_diff base;
14
+
15
+ git_vector patches;
16
+ } git_diff_parsed;
17
+
18
+ #endif
@@ -1834,6 +1834,9 @@ static int iterator_for_filesystem(
1834
1834
  iter = git__calloc(1, sizeof(filesystem_iterator));
1835
1835
  GITERR_CHECK_ALLOC(iter);
1836
1836
 
1837
+ iter->base.type = type;
1838
+ iter->base.cb = &callbacks;
1839
+
1837
1840
  root_len = strlen(root);
1838
1841
 
1839
1842
  iter->root = git__malloc(root_len+2);
@@ -1851,9 +1854,6 @@ static int iterator_for_filesystem(
1851
1854
  if ((error = git_buf_puts(&iter->current_path, iter->root)) < 0)
1852
1855
  goto on_error;
1853
1856
 
1854
- iter->base.type = type;
1855
- iter->base.cb = &callbacks;
1856
-
1857
1857
  if ((error = iterator_init_common(&iter->base, repo, index, options)) < 0)
1858
1858
  goto on_error;
1859
1859
 
@@ -1877,8 +1877,6 @@ static int iterator_for_filesystem(
1877
1877
  return 0;
1878
1878
 
1879
1879
  on_error:
1880
- git__free(iter->root);
1881
- git_buf_free(&iter->current_path);
1882
1880
  git_iterator_free(&iter->base);
1883
1881
  return error;
1884
1882
  }
@@ -194,6 +194,12 @@ int git_patch_get_line_in_hunk(
194
194
  return 0;
195
195
  }
196
196
 
197
+ int git_patch_from_diff(git_patch **out, git_diff *diff, size_t idx)
198
+ {
199
+ assert(out && diff && diff->patch_fn);
200
+ return diff->patch_fn(out, diff, idx);
201
+ }
202
+
197
203
  static void git_patch__free(git_patch *patch)
198
204
  {
199
205
  if (patch->free_fn)
@@ -349,20 +349,24 @@ static int diff_binary(git_patch_generated_output *output, git_patch_generated *
349
349
  new_len = patch->nfile.map.len;
350
350
  int error;
351
351
 
352
- /* Create the old->new delta (as the "new" side of the patch),
353
- * and the new->old delta (as the "old" side)
354
- */
355
- if ((error = create_binary(&binary.old_file.type,
356
- (char **)&binary.old_file.data,
357
- &binary.old_file.datalen,
358
- &binary.old_file.inflatedlen,
359
- new_data, new_len, old_data, old_len)) < 0 ||
360
- (error = create_binary(&binary.new_file.type,
361
- (char **)&binary.new_file.data,
362
- &binary.new_file.datalen,
363
- &binary.new_file.inflatedlen,
364
- old_data, old_len, new_data, new_len)) < 0)
365
- return error;
352
+ /* Only load contents if the user actually wants to diff
353
+ * binary files. */
354
+ if (patch->base.diff_opts.flags & GIT_DIFF_SHOW_BINARY) {
355
+ /* Create the old->new delta (as the "new" side of the patch),
356
+ * and the new->old delta (as the "old" side)
357
+ */
358
+ if ((error = create_binary(&binary.old_file.type,
359
+ (char **)&binary.old_file.data,
360
+ &binary.old_file.datalen,
361
+ &binary.old_file.inflatedlen,
362
+ new_data, new_len, old_data, old_len)) < 0 ||
363
+ (error = create_binary(&binary.new_file.type,
364
+ (char **)&binary.new_file.data,
365
+ &binary.new_file.datalen,
366
+ &binary.new_file.inflatedlen,
367
+ old_data, old_len, new_data, new_len)) < 0)
368
+ return error;
369
+ }
366
370
 
367
371
  error = giterr_set_after_callback_function(
368
372
  output->binary_cb(patch->base.delta, &binary, output->payload),
@@ -746,7 +750,7 @@ int git_patch_from_buffers(
746
750
  return patch_from_sources(out, &osrc, &nsrc, opts);
747
751
  }
748
752
 
749
- int git_patch_from_diff(
753
+ int git_patch_generated_from_diff(
750
754
  git_patch **patch_ptr, git_diff *diff, size_t idx)
751
755
  {
752
756
  int error = 0;
@@ -42,6 +42,8 @@ extern void git_patch_generated_old_data(
42
42
  char **, size_t *, git_patch_generated *);
43
43
  extern void git_patch_generated_new_data(
44
44
  char **, size_t *, git_patch_generated *);
45
+ extern int git_patch_generated_from_diff(
46
+ git_patch **, git_diff *, size_t);
45
47
 
46
48
  typedef struct git_patch_generated_output git_patch_generated_output;
47
49
 
@@ -7,6 +7,7 @@
7
7
  #include "git2/patch.h"
8
8
  #include "patch.h"
9
9
  #include "patch_parse.h"
10
+ #include "diff_parse.h"
10
11
  #include "path.h"
11
12
 
12
13
  #define parse_err(...) \
@@ -1025,6 +1026,20 @@ void git_patch_parse_ctx_free(git_patch_parse_ctx *ctx)
1025
1026
  GIT_REFCOUNT_DEC(ctx, patch_parse_ctx_free);
1026
1027
  }
1027
1028
 
1029
+ int git_patch_parsed_from_diff(git_patch **out, git_diff *d, size_t idx)
1030
+ {
1031
+ git_diff_parsed *diff = (git_diff_parsed *)d;
1032
+ git_patch *p;
1033
+
1034
+ if ((p = git_vector_get(&diff->patches, idx)) == NULL)
1035
+ return -1;
1036
+
1037
+ GIT_REFCOUNT_INC(p);
1038
+ *out = p;
1039
+
1040
+ return 0;
1041
+ }
1042
+
1028
1043
  static void patch_parsed__free(git_patch *p)
1029
1044
  {
1030
1045
  git_patch_parsed *patch = (git_patch_parsed *)p;
@@ -51,4 +51,6 @@ extern int git_patch_parse(
51
51
  git_patch **out,
52
52
  git_patch_parse_ctx *ctx);
53
53
 
54
+ extern int git_patch_parsed_from_diff(git_patch **, git_diff *, size_t);
55
+
54
56
  #endif
@@ -599,6 +599,7 @@ static int http_connect(http_subtransport *t)
599
599
  git_stream_close(t->io);
600
600
  git_stream_free(t->io);
601
601
  t->io = NULL;
602
+ t->connected = 0;
602
603
  }
603
604
 
604
605
  if (t->connection_data.use_ssl) {
@@ -1035,6 +1036,8 @@ static int http_close(git_smart_subtransport *subtransport)
1035
1036
 
1036
1037
  clear_parser_state(t);
1037
1038
 
1039
+ t->connected = 0;
1040
+
1038
1041
  if (t->io) {
1039
1042
  git_stream_close(t->io);
1040
1043
  git_stream_free(t->io);
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.25.0b7
4
+ version: 0.25.0b8
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: 2016-08-26 00:00:00.000000000 Z
12
+ date: 2016-09-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -298,6 +298,7 @@ files:
298
298
  - vendor/libgit2/src/diff_generate.c
299
299
  - vendor/libgit2/src/diff_generate.h
300
300
  - vendor/libgit2/src/diff_parse.c
301
+ - vendor/libgit2/src/diff_parse.h
301
302
  - vendor/libgit2/src/diff_print.c
302
303
  - vendor/libgit2/src/diff_stats.c
303
304
  - vendor/libgit2/src/diff_tform.c