rugged 0.22.0b5 → 0.22.1b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -3
  3. data/ext/rugged/extconf.rb +21 -5
  4. data/ext/rugged/rugged.c +1 -0
  5. data/ext/rugged/rugged.h +8 -0
  6. data/ext/rugged/rugged_backend.c +34 -0
  7. data/ext/rugged/rugged_branch_collection.c +1 -0
  8. data/ext/rugged/rugged_remote.c +37 -86
  9. data/ext/rugged/rugged_remote_collection.c +2 -1
  10. data/ext/rugged/rugged_repo.c +149 -24
  11. data/ext/rugged/rugged_revwalk.c +1 -2
  12. data/ext/rugged/rugged_submodule.c +1 -1
  13. data/ext/rugged/rugged_tree.c +69 -5
  14. data/lib/rugged/version.rb +1 -1
  15. data/vendor/libgit2/CMakeLists.txt +2 -1
  16. data/vendor/libgit2/include/git2.h +0 -1
  17. data/vendor/libgit2/include/git2/checkout.h +8 -0
  18. data/vendor/libgit2/include/git2/merge.h +8 -0
  19. data/vendor/libgit2/include/git2/push.h +0 -110
  20. data/vendor/libgit2/include/git2/remote.h +30 -1
  21. data/vendor/libgit2/include/git2/revert.h +1 -1
  22. data/vendor/libgit2/include/git2/submodule.h +80 -1
  23. data/vendor/libgit2/include/git2/sys/index.h +2 -2
  24. data/vendor/libgit2/include/git2/{threads.h → sys/openssl.h} +10 -12
  25. data/vendor/libgit2/include/git2/sys/refs.h +11 -0
  26. data/vendor/libgit2/include/git2/tree.h +1 -1
  27. data/vendor/libgit2/include/git2/version.h +3 -3
  28. data/vendor/libgit2/src/attr_file.c +3 -1
  29. data/vendor/libgit2/src/buffer.c +2 -1
  30. data/vendor/libgit2/src/checkout.c +135 -39
  31. data/vendor/libgit2/src/checkout.h +7 -0
  32. data/vendor/libgit2/src/config_file.c +5 -7
  33. data/vendor/libgit2/src/crlf.c +2 -0
  34. data/vendor/libgit2/src/describe.c +6 -2
  35. data/vendor/libgit2/src/diff.c +1 -0
  36. data/vendor/libgit2/src/fileops.c +87 -19
  37. data/vendor/libgit2/src/fileops.h +18 -0
  38. data/vendor/libgit2/src/global.c +1 -1
  39. data/vendor/libgit2/src/ident.c +2 -0
  40. data/vendor/libgit2/src/index.c +4 -4
  41. data/vendor/libgit2/src/merge.c +3 -1
  42. data/vendor/libgit2/src/notes.c +1 -1
  43. data/vendor/libgit2/src/pack.c +1 -0
  44. data/vendor/libgit2/src/path.c +17 -12
  45. data/vendor/libgit2/src/path.h +17 -3
  46. data/vendor/libgit2/src/push.h +110 -0
  47. data/vendor/libgit2/src/rebase.c +4 -2
  48. data/vendor/libgit2/src/remote.c +237 -16
  49. data/vendor/libgit2/src/remote.h +2 -0
  50. data/vendor/libgit2/src/repository.c +7 -3
  51. data/vendor/libgit2/src/submodule.c +229 -18
  52. data/vendor/libgit2/src/transports/local.c +61 -2
  53. data/vendor/libgit2/src/transports/smart_protocol.c +5 -3
  54. data/vendor/libgit2/src/tree.c +2 -2
  55. data/vendor/libgit2/src/util.h +13 -2
  56. data/vendor/libgit2/src/win32/mingw-compat.h +2 -0
  57. data/vendor/libgit2/src/win32/path_w32.h +2 -0
  58. metadata +4 -4
  59. data/vendor/libgit2/cmake/Modules/FindLIBSSH2.cmake +0 -44
@@ -35,6 +35,9 @@ typedef struct {
35
35
  int flags;
36
36
  git_atomic cancelled;
37
37
  git_repository *repo;
38
+ git_transport_message_cb progress_cb;
39
+ git_transport_message_cb error_cb;
40
+ void *message_cb_payload;
38
41
  git_vector refs;
39
42
  unsigned connected : 1,
40
43
  have_refs : 1;
@@ -126,8 +129,10 @@ static int add_ref(transport_local *t, const char *name)
126
129
  head = git__calloc(1, sizeof(git_remote_head));
127
130
  GITERR_CHECK_ALLOC(head);
128
131
 
129
- if (git_buf_join(&buf, 0, name, peeled) < 0)
132
+ if (git_buf_join(&buf, 0, name, peeled) < 0) {
133
+ free_head(head);
130
134
  return -1;
135
+ }
131
136
  head->name = git_buf_detach(&buf);
132
137
 
133
138
  if (!(error = git_tag_peel(&target, (git_tag *)obj))) {
@@ -494,6 +499,8 @@ static int foreach_cb(void *buf, size_t len, void *payload)
494
499
  return data->writepack->append(data->writepack, buf, len, data->stats);
495
500
  }
496
501
 
502
+ static const char *counting_objects_fmt = "Counting objects %d\r";
503
+
497
504
  static int local_download_pack(
498
505
  git_transport *transport,
499
506
  git_repository *repo,
@@ -510,6 +517,7 @@ static int local_download_pack(
510
517
  git_packbuilder *pack = NULL;
511
518
  git_odb_writepack *writepack = NULL;
512
519
  git_odb *odb = NULL;
520
+ git_buf progress_info = GIT_BUF_INIT;
513
521
 
514
522
  if ((error = git_revwalk_new(&walk, t->repo)) < 0)
515
523
  goto cleanup;
@@ -540,6 +548,13 @@ static int local_download_pack(
540
548
  git_object_free(obj);
541
549
  }
542
550
 
551
+ if ((error = git_buf_printf(&progress_info, counting_objects_fmt, git_packbuilder_object_count(pack))) < 0)
552
+ goto cleanup;
553
+
554
+ if (t->progress_cb &&
555
+ (error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload)) < 0)
556
+ goto cleanup;
557
+
543
558
  /* Walk the objects, building a packfile */
544
559
  if ((error = git_repository_odb__weakptr(&odb, repo)) < 0)
545
560
  goto cleanup;
@@ -561,9 +576,28 @@ static int local_download_pack(
561
576
  }
562
577
 
563
578
  git_commit_free(commit);
579
+
580
+ git_buf_clear(&progress_info);
581
+ if ((error = git_buf_printf(&progress_info, counting_objects_fmt, git_packbuilder_object_count(pack))) < 0)
582
+ goto cleanup;
583
+
584
+ if (t->progress_cb &&
585
+ (error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload)) < 0)
586
+ goto cleanup;
587
+
564
588
  }
565
589
  }
566
590
 
591
+ /* One last one with the newline */
592
+ git_buf_clear(&progress_info);
593
+ git_buf_printf(&progress_info, counting_objects_fmt, git_packbuilder_object_count(pack));
594
+ if ((error = git_buf_putc(&progress_info, '\n')) < 0)
595
+ goto cleanup;
596
+
597
+ if (t->progress_cb &&
598
+ (error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload)) < 0)
599
+ goto cleanup;
600
+
567
601
  if ((error = git_odb_write_pack(&writepack, odb, progress_cb, progress_payload)) != 0)
568
602
  goto cleanup;
569
603
 
@@ -582,11 +616,30 @@ static int local_download_pack(
582
616
 
583
617
  cleanup:
584
618
  if (writepack) writepack->free(writepack);
619
+ git_buf_free(&progress_info);
585
620
  git_packbuilder_free(pack);
586
621
  git_revwalk_free(walk);
587
622
  return error;
588
623
  }
589
624
 
625
+ static int local_set_callbacks(
626
+ git_transport *transport,
627
+ git_transport_message_cb progress_cb,
628
+ git_transport_message_cb error_cb,
629
+ git_transport_certificate_check_cb certificate_check_cb,
630
+ void *message_cb_payload)
631
+ {
632
+ transport_local *t = (transport_local *)transport;
633
+
634
+ GIT_UNUSED(certificate_check_cb);
635
+
636
+ t->progress_cb = progress_cb;
637
+ t->error_cb = error_cb;
638
+ t->message_cb_payload = message_cb_payload;
639
+
640
+ return 0;
641
+ }
642
+
590
643
  static int local_is_connected(git_transport *transport)
591
644
  {
592
645
  transport_local *t = (transport_local *)transport;
@@ -648,6 +701,7 @@ static void local_free(git_transport *transport)
648
701
 
649
702
  int git_transport_local(git_transport **out, git_remote *owner, void *param)
650
703
  {
704
+ int error;
651
705
  transport_local *t;
652
706
 
653
707
  GIT_UNUSED(param);
@@ -656,6 +710,7 @@ int git_transport_local(git_transport **out, git_remote *owner, void *param)
656
710
  GITERR_CHECK_ALLOC(t);
657
711
 
658
712
  t->parent.version = GIT_TRANSPORT_VERSION;
713
+ t->parent.set_callbacks = local_set_callbacks;
659
714
  t->parent.connect = local_connect;
660
715
  t->parent.negotiate_fetch = local_negotiate_fetch;
661
716
  t->parent.download_pack = local_download_pack;
@@ -667,7 +722,11 @@ int git_transport_local(git_transport **out, git_remote *owner, void *param)
667
722
  t->parent.read_flags = local_read_flags;
668
723
  t->parent.cancel = local_cancel;
669
724
 
670
- git_vector_init(&t->refs, 0, NULL);
725
+ if ((error = git_vector_init(&t->refs, 0, NULL)) < 0) {
726
+ git__free(t);
727
+ return error;
728
+ }
729
+
671
730
  t->owner = owner;
672
731
 
673
732
  *out = (git_transport *) t;
@@ -82,7 +82,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
82
82
  int error;
83
83
  const char *end;
84
84
  git_buf buf = GIT_BUF_INIT;
85
- git_refspec *mapping;
85
+ git_refspec *mapping = NULL;
86
86
 
87
87
  ptr += strlen(GIT_CAP_SYMREF);
88
88
  if (*ptr != '=')
@@ -97,7 +97,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
97
97
  return error;
98
98
 
99
99
  /* symref mapping has refspec format */
100
- mapping = git__malloc(sizeof(git_refspec));
100
+ mapping = git__calloc(1, sizeof(git_refspec));
101
101
  GITERR_CHECK_ALLOC(mapping);
102
102
 
103
103
  error = git_refspec__parse(mapping, git_buf_cstr(&buf), true);
@@ -119,6 +119,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
119
119
 
120
120
  on_invalid:
121
121
  giterr_set(GITERR_NET, "remote sent invalid symref");
122
+ git_refspec__free(mapping);
122
123
  return -1;
123
124
  }
124
125
 
@@ -258,7 +259,7 @@ static int store_common(transport_smart *t)
258
259
 
259
260
  static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
260
261
  {
261
- git_revwalk *walk;
262
+ git_revwalk *walk = NULL;
262
263
  git_strarray refs;
263
264
  unsigned int i;
264
265
  git_reference *ref;
@@ -294,6 +295,7 @@ static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
294
295
  return 0;
295
296
 
296
297
  on_error:
298
+ git_revwalk_free(walk);
297
299
  git_reference_free(ref);
298
300
  git_strarray_free(&refs);
299
301
  return error;
@@ -490,7 +490,7 @@ static int write_tree(
490
490
  return (int)find_next_dir(dirname, index, start);
491
491
  }
492
492
 
493
- if ((error = git_treebuilder_create(&bld, repo, NULL)) < 0 || bld == NULL)
493
+ if ((error = git_treebuilder_new(&bld, repo, NULL)) < 0 || bld == NULL)
494
494
  return -1;
495
495
 
496
496
  /*
@@ -624,7 +624,7 @@ int git_tree__write_index(
624
624
  return ret;
625
625
  }
626
626
 
627
- int git_treebuilder_create(
627
+ int git_treebuilder_new(
628
628
  git_treebuilder **builder_p,
629
629
  git_repository *repo,
630
630
  const git_tree *source)
@@ -317,12 +317,12 @@ GIT_INLINE(bool) git__isdigit(int c)
317
317
 
318
318
  GIT_INLINE(bool) git__isspace(int c)
319
319
  {
320
- return (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r' || c == '\v' || c == 0x85 /* Unicode CR+LF */);
320
+ return (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r' || c == '\v');
321
321
  }
322
322
 
323
323
  GIT_INLINE(bool) git__isspace_nonlf(int c)
324
324
  {
325
- return (c == ' ' || c == '\t' || c == '\f' || c == '\r' || c == '\v' || c == 0x85 /* Unicode CR+LF */);
325
+ return (c == ' ' || c == '\t' || c == '\f' || c == '\r' || c == '\v');
326
326
  }
327
327
 
328
328
  GIT_INLINE(bool) git__iswildcard(int c)
@@ -434,6 +434,17 @@ GIT_INLINE(double) git__timer(void)
434
434
  return (double)time * scaling_factor / 1.0E9;
435
435
  }
436
436
 
437
+ #elif defined(AMIGA)
438
+
439
+ #include <proto/timer.h>
440
+
441
+ GIT_INLINE(double) git__timer(void)
442
+ {
443
+ struct TimeVal tv;
444
+ ITimer->GetUpTime(&tv);
445
+ return (double)tv.Seconds + (double)tv.Microseconds / 1.0E6;
446
+ }
447
+
437
448
  #else
438
449
 
439
450
  #include <sys/time.h>
@@ -9,6 +9,8 @@
9
9
 
10
10
  #if defined(__MINGW32__)
11
11
 
12
+ #undef stat
13
+
12
14
  #if _WIN32_WINNT >= 0x0601
13
15
  #define stat __stat64
14
16
  #else
@@ -7,6 +7,8 @@
7
7
  #ifndef INCLUDE_git_path_w32_h__
8
8
  #define INCLUDE_git_path_w32_h__
9
9
 
10
+ #include "common.h"
11
+
10
12
  /*
11
13
  * Provides a large enough buffer to support Windows paths: MAX_PATH is
12
14
  * 260, corresponding to a maximum path length of 259 characters plus a
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.22.0b5
4
+ version: 0.22.1b1
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: 2014-12-17 00:00:00.000000000 Z
12
+ date: 2015-03-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -67,6 +67,7 @@ files:
67
67
  - ext/rugged/extconf.rb
68
68
  - ext/rugged/rugged.c
69
69
  - ext/rugged/rugged.h
70
+ - ext/rugged/rugged_backend.c
70
71
  - ext/rugged/rugged_blame.c
71
72
  - ext/rugged/rugged_blob.c
72
73
  - ext/rugged/rugged_branch.c
@@ -125,7 +126,6 @@ files:
125
126
  - vendor/libgit2/cmake/Modules/FindGSSAPI.cmake
126
127
  - vendor/libgit2/cmake/Modules/FindHTTP_Parser.cmake
127
128
  - vendor/libgit2/cmake/Modules/FindIconv.cmake
128
- - vendor/libgit2/cmake/Modules/FindLIBSSH2.cmake
129
129
  - vendor/libgit2/deps/http-parser/LICENSE-MIT
130
130
  - vendor/libgit2/deps/http-parser/http_parser.c
131
131
  - vendor/libgit2/deps/http-parser/http_parser.h
@@ -217,6 +217,7 @@ files:
217
217
  - vendor/libgit2/include/git2/sys/index.h
218
218
  - vendor/libgit2/include/git2/sys/mempack.h
219
219
  - vendor/libgit2/include/git2/sys/odb_backend.h
220
+ - vendor/libgit2/include/git2/sys/openssl.h
220
221
  - vendor/libgit2/include/git2/sys/refdb_backend.h
221
222
  - vendor/libgit2/include/git2/sys/reflog.h
222
223
  - vendor/libgit2/include/git2/sys/refs.h
@@ -224,7 +225,6 @@ files:
224
225
  - vendor/libgit2/include/git2/sys/stream.h
225
226
  - vendor/libgit2/include/git2/sys/transport.h
226
227
  - vendor/libgit2/include/git2/tag.h
227
- - vendor/libgit2/include/git2/threads.h
228
228
  - vendor/libgit2/include/git2/trace.h
229
229
  - vendor/libgit2/include/git2/transaction.h
230
230
  - vendor/libgit2/include/git2/transport.h
@@ -1,44 +0,0 @@
1
- if (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
2
- set(LIBSSH2_FOUND TRUE)
3
- else (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
4
- find_path(LIBSSH2_INCLUDE_DIR
5
- NAMES
6
- libssh2.h
7
- PATHS
8
- /usr/include
9
- /usr/local/include
10
- /opt/local/include
11
- /sw/include
12
- ${CMAKE_INCLUDE_PATH}
13
- ${CMAKE_INSTALL_PREFIX}/include
14
- )
15
-
16
- find_library(LIBSSH2_LIBRARY
17
- NAMES
18
- ssh2
19
- libssh2
20
- PATHS
21
- /usr/lib
22
- /usr/local/lib
23
- /opt/local/lib
24
- /sw/lib
25
- ${CMAKE_LIBRARY_PATH}
26
- ${CMAKE_INSTALL_PREFIX}/lib
27
- )
28
-
29
- if (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
30
- set(LIBSSH2_FOUND TRUE)
31
- endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
32
-
33
- if (LIBSSH2_FOUND)
34
- set(LIBSSH2_INCLUDE_DIRS
35
- ${LIBSSH2_INCLUDE_DIR}
36
- )
37
-
38
- set(LIBSSH2_LIBRARIES
39
- ${LIBSSH2_LIBRARIES}
40
- ${LIBSSH2_LIBRARY}
41
- )
42
- endif (LIBSSH2_FOUND)
43
- endif (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
44
-