rugged 0.23.0b2 → 0.23.0b4
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.
- checksums.yaml +4 -4
- data/ext/rugged/rugged_blob.c +39 -0
- data/ext/rugged/rugged_diff.c +7 -3
- data/ext/rugged/rugged_index.c +2 -2
- data/ext/rugged/rugged_remote.c +27 -148
- data/ext/rugged/rugged_remote_collection.c +134 -12
- data/ext/rugged/rugged_repo.c +74 -5
- data/ext/rugged/rugged_submodule.c +18 -208
- data/ext/rugged/rugged_submodule_collection.c +148 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +33 -25
- data/vendor/libgit2/deps/winhttp/winhttp.def +29 -29
- data/vendor/libgit2/include/git2.h +1 -1
- data/vendor/libgit2/include/git2/blob.h +4 -6
- data/vendor/libgit2/include/git2/checkout.h +10 -1
- data/vendor/libgit2/include/git2/clone.h +6 -7
- data/vendor/libgit2/include/git2/commit.h +11 -0
- data/vendor/libgit2/include/git2/cred_helpers.h +2 -2
- data/vendor/libgit2/include/git2/describe.h +1 -1
- data/vendor/libgit2/include/git2/diff.h +68 -11
- data/vendor/libgit2/include/git2/errors.h +4 -1
- data/vendor/libgit2/include/git2/filter.h +16 -0
- data/vendor/libgit2/include/git2/index.h +38 -11
- data/vendor/libgit2/include/git2/odb.h +1 -1
- data/vendor/libgit2/include/git2/odb_backend.h +2 -2
- data/vendor/libgit2/include/git2/remote.h +300 -207
- data/vendor/libgit2/include/git2/reset.h +1 -0
- data/vendor/libgit2/include/git2/stash.h +135 -4
- data/vendor/libgit2/include/git2/status.h +1 -0
- data/vendor/libgit2/include/git2/submodule.h +46 -75
- data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/sys/stream.h +2 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -21
- data/vendor/libgit2/include/git2/transport.h +27 -0
- data/vendor/libgit2/include/git2/types.h +20 -10
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/libgit2.pc.in +4 -2
- data/vendor/libgit2/src/attr.c +2 -1
- data/vendor/libgit2/src/attr_file.c +18 -37
- data/vendor/libgit2/src/blame.c +2 -2
- data/vendor/libgit2/src/blob.c +4 -3
- data/vendor/libgit2/src/branch.c +6 -3
- data/vendor/libgit2/src/buf_text.c +4 -6
- data/vendor/libgit2/src/buf_text.h +1 -2
- data/vendor/libgit2/src/buffer.c +8 -6
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/cache.c +1 -0
- data/vendor/libgit2/src/checkout.c +34 -20
- data/vendor/libgit2/src/clone.c +29 -29
- data/vendor/libgit2/src/commit.c +65 -0
- data/vendor/libgit2/src/common.h +5 -0
- data/vendor/libgit2/src/config.c +20 -0
- data/vendor/libgit2/src/config.h +6 -0
- data/vendor/libgit2/src/config_file.c +2 -2
- data/vendor/libgit2/src/crlf.c +39 -17
- data/vendor/libgit2/src/curl_stream.c +257 -0
- data/vendor/libgit2/src/curl_stream.h +14 -0
- data/vendor/libgit2/src/diff.c +223 -88
- data/vendor/libgit2/src/diff.h +21 -1
- data/vendor/libgit2/src/diff_file.c +23 -13
- data/vendor/libgit2/src/diff_file.h +4 -2
- data/vendor/libgit2/src/diff_patch.c +266 -71
- data/vendor/libgit2/src/diff_patch.h +36 -0
- data/vendor/libgit2/src/diff_print.c +156 -126
- data/vendor/libgit2/src/diff_tform.c +32 -54
- data/vendor/libgit2/src/fetch.c +27 -10
- data/vendor/libgit2/src/fetch.h +2 -2
- data/vendor/libgit2/src/filebuf.c +1 -1
- data/vendor/libgit2/src/fileops.c +6 -2
- data/vendor/libgit2/src/filter.c +28 -7
- data/vendor/libgit2/src/fnmatch.c +5 -5
- data/vendor/libgit2/src/global.c +16 -0
- data/vendor/libgit2/src/ident.c +2 -2
- data/vendor/libgit2/src/ignore.c +1 -0
- data/vendor/libgit2/src/index.c +338 -80
- data/vendor/libgit2/src/index.h +4 -1
- data/vendor/libgit2/src/indexer.c +19 -5
- data/vendor/libgit2/src/iterator.c +118 -11
- data/vendor/libgit2/src/iterator.h +25 -0
- data/vendor/libgit2/src/merge.c +96 -106
- data/vendor/libgit2/src/merge.h +14 -4
- data/vendor/libgit2/src/netops.c +3 -3
- data/vendor/libgit2/src/odb.c +17 -9
- data/vendor/libgit2/src/odb.h +1 -1
- data/vendor/libgit2/src/odb_loose.c +2 -2
- data/vendor/libgit2/src/odb_pack.c +1 -1
- data/vendor/libgit2/src/openssl_stream.c +118 -27
- data/vendor/libgit2/src/pack-objects.c +28 -0
- data/vendor/libgit2/src/pack-objects.h +1 -0
- data/vendor/libgit2/src/pack.c +18 -10
- data/vendor/libgit2/src/path.c +16 -11
- data/vendor/libgit2/src/path.h +1 -1
- data/vendor/libgit2/src/push.c +26 -42
- data/vendor/libgit2/src/push.h +2 -34
- data/vendor/libgit2/src/rebase.c +1 -1
- data/vendor/libgit2/src/refs.c +1 -1
- data/vendor/libgit2/src/refspec.c +6 -0
- data/vendor/libgit2/src/remote.c +381 -274
- data/vendor/libgit2/src/remote.h +0 -4
- data/vendor/libgit2/src/repository.c +33 -12
- data/vendor/libgit2/src/repository.h +0 -1
- data/vendor/libgit2/src/reset.c +1 -0
- data/vendor/libgit2/src/stash.c +439 -17
- data/vendor/libgit2/src/status.c +6 -0
- data/vendor/libgit2/src/stransport_stream.c +58 -21
- data/vendor/libgit2/src/stream.h +15 -0
- data/vendor/libgit2/src/submodule.c +410 -664
- data/vendor/libgit2/src/submodule.h +0 -24
- data/vendor/libgit2/src/transaction.c +1 -0
- data/vendor/libgit2/src/transports/cred.c +55 -1
- data/vendor/libgit2/src/transports/http.c +18 -2
- data/vendor/libgit2/src/transports/local.c +60 -59
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -11
- data/vendor/libgit2/src/transports/ssh.c +46 -7
- data/vendor/libgit2/src/unix/posix.h +4 -0
- data/vendor/libgit2/src/util.c +9 -9
- data/vendor/libgit2/src/util.h +9 -0
- data/vendor/libgit2/src/win32/posix.h +3 -0
- data/vendor/libgit2/src/win32/posix_w32.c +38 -0
- data/vendor/libgit2/src/win32/w32_util.h +10 -0
- metadata +4 -3
- data/vendor/libgit2/include/git2/push.h +0 -94
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5365f2755f87b76139a9752e291cd2a92e4cef74
|
|
4
|
+
data.tar.gz: 25b17d77f34a4e73cc0529cb4dd6ea23e6a1d0e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4997a2cb895a33fc4ecacb59d7436999e6ee71965b107f9a7e098576744500baae2c506d95b9bf6bfc7e8fb5dddf332ec66ead60ed28e3e747c32911448dcc01
|
|
7
|
+
data.tar.gz: 55f33cc8e38044499830e2c362bf4abe0384a4e6d32cd11fa5313f6e3e15d4f53a43ed5dab76197baa60dc30f20c076eac5a2a8fdc6a161de9fe1ca49f62db4b
|
data/ext/rugged/rugged_blob.c
CHANGED
|
@@ -317,6 +317,44 @@ static VALUE rb_git_blob_from_io(int argc, VALUE *argv, VALUE klass)
|
|
|
317
317
|
return rugged_create_oid(&oid);
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
+
/*
|
|
321
|
+
* call-seq:
|
|
322
|
+
* blob.loc -> int
|
|
323
|
+
*
|
|
324
|
+
* Return the number of lines for this blob,
|
|
325
|
+
* assuming the blob is plaintext (i.e. not binary)
|
|
326
|
+
*/
|
|
327
|
+
static VALUE rb_git_blob_loc(VALUE self)
|
|
328
|
+
{
|
|
329
|
+
git_blob *blob;
|
|
330
|
+
const char *data, *data_end;
|
|
331
|
+
size_t loc = 0;
|
|
332
|
+
|
|
333
|
+
Data_Get_Struct(self, git_blob, blob);
|
|
334
|
+
|
|
335
|
+
data = git_blob_rawcontent(blob);
|
|
336
|
+
data_end = data + git_blob_rawsize(blob);
|
|
337
|
+
|
|
338
|
+
if (data == data_end)
|
|
339
|
+
return INT2FIX(0);
|
|
340
|
+
|
|
341
|
+
for (; data < data_end; ++data) {
|
|
342
|
+
if (data[0] == '\n') {
|
|
343
|
+
loc++;
|
|
344
|
+
}
|
|
345
|
+
else if (data[0] == '\r') {
|
|
346
|
+
if (data + 1 < data_end && data[1] == '\n')
|
|
347
|
+
data++;
|
|
348
|
+
loc++;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (data[-1] != '\n' && data[-1] != '\r')
|
|
353
|
+
loc++;
|
|
354
|
+
|
|
355
|
+
return INT2FIX(loc);
|
|
356
|
+
}
|
|
357
|
+
|
|
320
358
|
|
|
321
359
|
/*
|
|
322
360
|
* call-seq:
|
|
@@ -583,6 +621,7 @@ void Init_rugged_blob(void)
|
|
|
583
621
|
rb_define_method(rb_cRuggedBlob, "content", rb_git_blob_content_GET, -1);
|
|
584
622
|
rb_define_method(rb_cRuggedBlob, "text", rb_git_blob_text_GET, -1);
|
|
585
623
|
rb_define_method(rb_cRuggedBlob, "sloc", rb_git_blob_sloc, 0);
|
|
624
|
+
rb_define_method(rb_cRuggedBlob, "loc", rb_git_blob_loc, 0);
|
|
586
625
|
rb_define_method(rb_cRuggedBlob, "binary?", rb_git_blob_is_binary, 0);
|
|
587
626
|
rb_define_method(rb_cRuggedBlob, "diff", rb_git_blob_diff, -1);
|
|
588
627
|
|
data/ext/rugged/rugged_diff.c
CHANGED
|
@@ -120,11 +120,15 @@ void rugged_parse_diff_options(git_diff_options *opts, VALUE rb_options)
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("show_untracked_content")))) {
|
|
123
|
-
opts->flags |= GIT_DIFF_SHOW_UNTRACKED_CONTENT
|
|
123
|
+
opts->flags |= GIT_DIFF_SHOW_UNTRACKED_CONTENT;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("show_unmodified")))) {
|
|
127
|
-
opts->flags |=
|
|
127
|
+
opts->flags |= GIT_DIFF_SHOW_UNMODIFIED;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("show_binary")))) {
|
|
131
|
+
opts->flags |= GIT_DIFF_SHOW_BINARY;
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("patience")))) {
|
|
@@ -643,7 +647,7 @@ static VALUE rb_git_diff_stat(VALUE self)
|
|
|
643
647
|
Data_Get_Struct(self, git_diff, diff);
|
|
644
648
|
|
|
645
649
|
git_diff_foreach(
|
|
646
|
-
diff, diff_file_stats_cb, NULL, diff_line_stats_cb, &stats);
|
|
650
|
+
diff, diff_file_stats_cb, NULL, NULL, diff_line_stats_cb, &stats);
|
|
647
651
|
|
|
648
652
|
return rb_ary_new3(
|
|
649
653
|
3, INT2FIX(stats.files), INT2FIX(stats.adds), INT2FIX(stats.dels));
|
data/ext/rugged/rugged_index.c
CHANGED
|
@@ -555,7 +555,7 @@ static VALUE rb_git_indexentry_fromC(const git_index_entry *entry)
|
|
|
555
555
|
return rb_entry;
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
-
static inline
|
|
558
|
+
static inline uint32_t
|
|
559
559
|
default_entry_value(VALUE rb_entry, const char *key)
|
|
560
560
|
{
|
|
561
561
|
VALUE val = rb_hash_aref(rb_entry, CSTR2SYM(key));
|
|
@@ -587,7 +587,7 @@ static void rb_git_indexentry_toC(git_index_entry *entry, VALUE rb_entry)
|
|
|
587
587
|
entry->mode = default_entry_value(rb_entry, "mode");
|
|
588
588
|
entry->gid = default_entry_value(rb_entry, "gid");
|
|
589
589
|
entry->uid = default_entry_value(rb_entry, "uid");
|
|
590
|
-
entry->file_size =
|
|
590
|
+
entry->file_size = default_entry_value(rb_entry, "file_size");
|
|
591
591
|
|
|
592
592
|
if ((val = rb_hash_aref(rb_entry, CSTR2SYM("mtime"))) != Qnil) {
|
|
593
593
|
if (!rb_obj_is_kind_of(val, rb_cTime))
|
data/ext/rugged/rugged_remote.c
CHANGED
|
@@ -264,8 +264,7 @@ static VALUE rb_git_remote_ls(int argc, VALUE *argv, VALUE self)
|
|
|
264
264
|
|
|
265
265
|
rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload);
|
|
266
266
|
|
|
267
|
-
if ((error =
|
|
268
|
-
(error = git_remote_connect(remote, GIT_DIRECTION_FETCH)) ||
|
|
267
|
+
if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks)) ||
|
|
269
268
|
(error = git_remote_ls(&heads, &heads_len, remote)))
|
|
270
269
|
goto cleanup;
|
|
271
270
|
|
|
@@ -319,28 +318,6 @@ static VALUE rb_git_remote_url(VALUE self)
|
|
|
319
318
|
return rb_str_new_utf8(git_remote_url(remote));
|
|
320
319
|
}
|
|
321
320
|
|
|
322
|
-
/*
|
|
323
|
-
* call-seq:
|
|
324
|
-
* remote.url = url -> url
|
|
325
|
-
*
|
|
326
|
-
* Sets the remote's url without persisting it in the config.
|
|
327
|
-
* Existing connections will not be updated.
|
|
328
|
-
*
|
|
329
|
-
* remote.url = 'git://github.com/libgit2/rugged.git' #=> "git://github.com/libgit2/rugged.git"
|
|
330
|
-
*/
|
|
331
|
-
static VALUE rb_git_remote_set_url(VALUE self, VALUE rb_url)
|
|
332
|
-
{
|
|
333
|
-
git_remote *remote;
|
|
334
|
-
|
|
335
|
-
Check_Type(rb_url, T_STRING);
|
|
336
|
-
Data_Get_Struct(self, git_remote, remote);
|
|
337
|
-
|
|
338
|
-
rugged_exception_check(
|
|
339
|
-
git_remote_set_url(remote, StringValueCStr(rb_url))
|
|
340
|
-
);
|
|
341
|
-
return rb_url;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
321
|
/*
|
|
345
322
|
* call-seq:
|
|
346
323
|
* remote.push_url() -> string or nil
|
|
@@ -372,13 +349,18 @@ static VALUE rb_git_remote_push_url(VALUE self)
|
|
|
372
349
|
*/
|
|
373
350
|
static VALUE rb_git_remote_set_push_url(VALUE self, VALUE rb_url)
|
|
374
351
|
{
|
|
352
|
+
VALUE rb_repo = rugged_owner(self);
|
|
375
353
|
git_remote *remote;
|
|
354
|
+
git_repository *repo;
|
|
355
|
+
|
|
356
|
+
rugged_check_repo(rb_repo);
|
|
357
|
+
Data_Get_Struct(rb_repo, git_repository, repo);
|
|
376
358
|
|
|
377
359
|
Check_Type(rb_url, T_STRING);
|
|
378
360
|
Data_Get_Struct(self, git_remote, remote);
|
|
379
361
|
|
|
380
362
|
rugged_exception_check(
|
|
381
|
-
git_remote_set_pushurl(remote, StringValueCStr(rb_url))
|
|
363
|
+
git_remote_set_pushurl(repo, git_remote_name(remote), StringValueCStr(rb_url))
|
|
382
364
|
);
|
|
383
365
|
|
|
384
366
|
return rb_url;
|
|
@@ -427,86 +409,6 @@ static VALUE rb_git_remote_push_refspecs(VALUE self)
|
|
|
427
409
|
return rb_git_remote_refspecs(self, GIT_DIRECTION_PUSH);
|
|
428
410
|
}
|
|
429
411
|
|
|
430
|
-
static VALUE rb_git_remote_add_refspec(VALUE self, VALUE rb_refspec, git_direction direction)
|
|
431
|
-
{
|
|
432
|
-
git_remote *remote;
|
|
433
|
-
int error = 0;
|
|
434
|
-
|
|
435
|
-
Data_Get_Struct(self, git_remote, remote);
|
|
436
|
-
|
|
437
|
-
Check_Type(rb_refspec, T_STRING);
|
|
438
|
-
|
|
439
|
-
if (direction == GIT_DIRECTION_FETCH)
|
|
440
|
-
error = git_remote_add_fetch(remote, StringValueCStr(rb_refspec));
|
|
441
|
-
else
|
|
442
|
-
error = git_remote_add_push(remote, StringValueCStr(rb_refspec));
|
|
443
|
-
|
|
444
|
-
rugged_exception_check(error);
|
|
445
|
-
|
|
446
|
-
return Qnil;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/*
|
|
450
|
-
* call-seq:
|
|
451
|
-
* remote.add_fetch(refspec) -> nil
|
|
452
|
-
*
|
|
453
|
-
* Add a fetch refspec to the remote.
|
|
454
|
-
*/
|
|
455
|
-
static VALUE rb_git_remote_add_fetch(VALUE self, VALUE rb_refspec)
|
|
456
|
-
{
|
|
457
|
-
return rb_git_remote_add_refspec(self, rb_refspec, GIT_DIRECTION_FETCH);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
/*
|
|
461
|
-
* call-seq:
|
|
462
|
-
* remote.add_push(refspec) -> nil
|
|
463
|
-
*
|
|
464
|
-
* Add a push refspec to the remote.
|
|
465
|
-
*/
|
|
466
|
-
static VALUE rb_git_remote_add_push(VALUE self, VALUE rb_refspec)
|
|
467
|
-
{
|
|
468
|
-
return rb_git_remote_add_refspec(self, rb_refspec, GIT_DIRECTION_PUSH);
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/*
|
|
472
|
-
* call-seq:
|
|
473
|
-
* remote.clear_refspecs -> nil
|
|
474
|
-
*
|
|
475
|
-
* Remove all configured fetch and push refspecs from the remote.
|
|
476
|
-
*/
|
|
477
|
-
static VALUE rb_git_remote_clear_refspecs(VALUE self)
|
|
478
|
-
{
|
|
479
|
-
git_remote *remote;
|
|
480
|
-
|
|
481
|
-
Data_Get_Struct(self, git_remote, remote);
|
|
482
|
-
|
|
483
|
-
git_remote_clear_refspecs(remote);
|
|
484
|
-
|
|
485
|
-
return Qnil;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
/*
|
|
489
|
-
* call-seq:
|
|
490
|
-
* remote.save -> true
|
|
491
|
-
*
|
|
492
|
-
* Saves the remote data (url, fetchspecs, ...) to the config.
|
|
493
|
-
*
|
|
494
|
-
* Anonymous, in-memory remotes created through
|
|
495
|
-
* +ReferenceCollection#create_anonymous+ can not be saved.
|
|
496
|
-
* Doing so will result in an exception being raised.
|
|
497
|
-
*/
|
|
498
|
-
static VALUE rb_git_remote_save(VALUE self)
|
|
499
|
-
{
|
|
500
|
-
git_remote *remote;
|
|
501
|
-
|
|
502
|
-
Data_Get_Struct(self, git_remote, remote);
|
|
503
|
-
|
|
504
|
-
rugged_exception_check(
|
|
505
|
-
git_remote_save(remote)
|
|
506
|
-
);
|
|
507
|
-
return Qtrue;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
412
|
/*
|
|
511
413
|
* call-seq:
|
|
512
414
|
* remote.check_connection(direction, options = {}) -> boolean
|
|
@@ -556,21 +458,13 @@ static VALUE rb_git_remote_check_connection(int argc, VALUE *argv, VALUE self)
|
|
|
556
458
|
|
|
557
459
|
rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload);
|
|
558
460
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
if (git_remote_connect(remote, direction))
|
|
563
|
-
return Qfalse;
|
|
564
|
-
else {
|
|
565
|
-
git_remote_disconnect(remote);
|
|
566
|
-
return Qtrue;
|
|
567
|
-
}
|
|
461
|
+
error = git_remote_connect(remote, direction, &callbacks);
|
|
462
|
+
git_remote_disconnect(remote);
|
|
568
463
|
|
|
569
|
-
cleanup:
|
|
570
464
|
if (payload.exception)
|
|
571
465
|
rb_jump_tag(payload.exception);
|
|
572
|
-
|
|
573
|
-
return Qfalse;
|
|
466
|
+
|
|
467
|
+
return error ? Qfalse : Qtrue;
|
|
574
468
|
}
|
|
575
469
|
|
|
576
470
|
/*
|
|
@@ -622,7 +516,8 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
|
|
|
622
516
|
git_remote *remote;
|
|
623
517
|
git_repository *repo;
|
|
624
518
|
git_strarray refspecs;
|
|
625
|
-
|
|
519
|
+
git_fetch_options opts = GIT_FETCH_OPTIONS_INIT;
|
|
520
|
+
const git_transfer_progress *stats;
|
|
626
521
|
struct rugged_remote_cb_payload payload = { Qnil, Qnil, Qnil, Qnil, Qnil, Qnil, 0 };
|
|
627
522
|
|
|
628
523
|
char *log_message = NULL;
|
|
@@ -638,7 +533,7 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
|
|
|
638
533
|
rugged_check_repo(rb_repo);
|
|
639
534
|
Data_Get_Struct(rb_repo, git_repository, repo);
|
|
640
535
|
|
|
641
|
-
rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload);
|
|
536
|
+
rugged_remote_init_callbacks_and_payload_from_options(rb_options, &opts.callbacks, &payload);
|
|
642
537
|
|
|
643
538
|
if (!NIL_P(rb_options)) {
|
|
644
539
|
VALUE rb_val = rb_hash_aref(rb_options, CSTR2SYM("message"));
|
|
@@ -646,23 +541,7 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
|
|
|
646
541
|
log_message = StringValueCStr(rb_val);
|
|
647
542
|
}
|
|
648
543
|
|
|
649
|
-
|
|
650
|
-
goto cleanup;
|
|
651
|
-
|
|
652
|
-
if ((error = git_remote_fetch(remote, &refspecs, log_message)) == GIT_OK) {
|
|
653
|
-
const git_transfer_progress *stats = git_remote_stats(remote);
|
|
654
|
-
|
|
655
|
-
rb_result = rb_hash_new();
|
|
656
|
-
rb_hash_aset(rb_result, CSTR2SYM("total_objects"), UINT2NUM(stats->total_objects));
|
|
657
|
-
rb_hash_aset(rb_result, CSTR2SYM("indexed_objects"), UINT2NUM(stats->indexed_objects));
|
|
658
|
-
rb_hash_aset(rb_result, CSTR2SYM("received_objects"), UINT2NUM(stats->received_objects));
|
|
659
|
-
rb_hash_aset(rb_result, CSTR2SYM("local_objects"), UINT2NUM(stats->local_objects));
|
|
660
|
-
rb_hash_aset(rb_result, CSTR2SYM("total_deltas"), UINT2NUM(stats->total_deltas));
|
|
661
|
-
rb_hash_aset(rb_result, CSTR2SYM("indexed_deltas"), UINT2NUM(stats->indexed_deltas));
|
|
662
|
-
rb_hash_aset(rb_result, CSTR2SYM("received_bytes"), INT2FIX(stats->received_bytes));
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
cleanup:
|
|
544
|
+
error = git_remote_fetch(remote, &refspecs, &opts, log_message);
|
|
666
545
|
|
|
667
546
|
xfree(refspecs.strings);
|
|
668
547
|
|
|
@@ -671,6 +550,17 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
|
|
|
671
550
|
|
|
672
551
|
rugged_exception_check(error);
|
|
673
552
|
|
|
553
|
+
stats = git_remote_stats(remote);
|
|
554
|
+
|
|
555
|
+
rb_result = rb_hash_new();
|
|
556
|
+
rb_hash_aset(rb_result, CSTR2SYM("total_objects"), UINT2NUM(stats->total_objects));
|
|
557
|
+
rb_hash_aset(rb_result, CSTR2SYM("indexed_objects"), UINT2NUM(stats->indexed_objects));
|
|
558
|
+
rb_hash_aset(rb_result, CSTR2SYM("received_objects"), UINT2NUM(stats->received_objects));
|
|
559
|
+
rb_hash_aset(rb_result, CSTR2SYM("local_objects"), UINT2NUM(stats->local_objects));
|
|
560
|
+
rb_hash_aset(rb_result, CSTR2SYM("total_deltas"), UINT2NUM(stats->total_deltas));
|
|
561
|
+
rb_hash_aset(rb_result, CSTR2SYM("indexed_deltas"), UINT2NUM(stats->indexed_deltas));
|
|
562
|
+
rb_hash_aset(rb_result, CSTR2SYM("received_bytes"), INT2FIX(stats->received_bytes));
|
|
563
|
+
|
|
674
564
|
return rb_result;
|
|
675
565
|
}
|
|
676
566
|
|
|
@@ -708,7 +598,6 @@ static VALUE rb_git_remote_push(int argc, VALUE *argv, VALUE self)
|
|
|
708
598
|
|
|
709
599
|
git_repository *repo;
|
|
710
600
|
git_remote *remote;
|
|
711
|
-
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
|
|
712
601
|
git_strarray refspecs;
|
|
713
602
|
git_push_options opts = GIT_PUSH_OPTIONS_INIT;
|
|
714
603
|
|
|
@@ -724,14 +613,10 @@ static VALUE rb_git_remote_push(int argc, VALUE *argv, VALUE self)
|
|
|
724
613
|
Data_Get_Struct(rb_repo, git_repository, repo);
|
|
725
614
|
Data_Get_Struct(self, git_remote, remote);
|
|
726
615
|
|
|
727
|
-
rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload);
|
|
728
|
-
|
|
729
|
-
if ((error = git_remote_set_callbacks(remote, &callbacks)))
|
|
730
|
-
goto cleanup;
|
|
616
|
+
rugged_remote_init_callbacks_and_payload_from_options(rb_options, &opts.callbacks, &payload);
|
|
731
617
|
|
|
732
618
|
error = git_remote_push(remote, &refspecs, &opts);
|
|
733
619
|
|
|
734
|
-
cleanup:
|
|
735
620
|
xfree(refspecs.strings);
|
|
736
621
|
|
|
737
622
|
if (payload.exception)
|
|
@@ -746,20 +631,14 @@ void Init_rugged_remote(void)
|
|
|
746
631
|
{
|
|
747
632
|
rb_cRuggedRemote = rb_define_class_under(rb_mRugged, "Remote", rb_cObject);
|
|
748
633
|
|
|
749
|
-
|
|
750
634
|
rb_define_method(rb_cRuggedRemote, "name", rb_git_remote_name, 0);
|
|
751
635
|
rb_define_method(rb_cRuggedRemote, "url", rb_git_remote_url, 0);
|
|
752
|
-
rb_define_method(rb_cRuggedRemote, "url=", rb_git_remote_set_url, 1);
|
|
753
636
|
rb_define_method(rb_cRuggedRemote, "push_url", rb_git_remote_push_url, 0);
|
|
754
637
|
rb_define_method(rb_cRuggedRemote, "push_url=", rb_git_remote_set_push_url, 1);
|
|
755
638
|
rb_define_method(rb_cRuggedRemote, "fetch_refspecs", rb_git_remote_fetch_refspecs, 0);
|
|
756
639
|
rb_define_method(rb_cRuggedRemote, "push_refspecs", rb_git_remote_push_refspecs, 0);
|
|
757
|
-
rb_define_method(rb_cRuggedRemote, "add_fetch", rb_git_remote_add_fetch, 1);
|
|
758
|
-
rb_define_method(rb_cRuggedRemote, "add_push", rb_git_remote_add_push, 1);
|
|
759
640
|
rb_define_method(rb_cRuggedRemote, "ls", rb_git_remote_ls, -1);
|
|
760
641
|
rb_define_method(rb_cRuggedRemote, "check_connection", rb_git_remote_check_connection, -1);
|
|
761
642
|
rb_define_method(rb_cRuggedRemote, "fetch", rb_git_remote_fetch, -1);
|
|
762
643
|
rb_define_method(rb_cRuggedRemote, "push", rb_git_remote_push, -1);
|
|
763
|
-
rb_define_method(rb_cRuggedRemote, "clear_refspecs", rb_git_remote_clear_refspecs, 0);
|
|
764
|
-
rb_define_method(rb_cRuggedRemote, "save", rb_git_remote_save, 0);
|
|
765
644
|
}
|
|
@@ -69,8 +69,7 @@ static VALUE rb_git_remote_collection_create_anonymous(VALUE self, VALUE rb_url)
|
|
|
69
69
|
error = git_remote_create_anonymous(
|
|
70
70
|
&remote,
|
|
71
71
|
repo,
|
|
72
|
-
StringValueCStr(rb_url)
|
|
73
|
-
NULL);
|
|
72
|
+
StringValueCStr(rb_url));
|
|
74
73
|
|
|
75
74
|
rugged_exception_check(error);
|
|
76
75
|
|
|
@@ -298,7 +297,6 @@ static VALUE rb_git_remote_collection_delete(VALUE self, VALUE rb_name_or_remote
|
|
|
298
297
|
{
|
|
299
298
|
VALUE rb_repo = rugged_owner(self);
|
|
300
299
|
git_repository *repo;
|
|
301
|
-
int error;
|
|
302
300
|
|
|
303
301
|
if (rb_obj_is_kind_of(rb_name_or_remote, rb_cRuggedRemote))
|
|
304
302
|
rb_name_or_remote = rb_funcall(rb_name_or_remote, rb_intern("name"), 0);
|
|
@@ -309,27 +307,151 @@ static VALUE rb_git_remote_collection_delete(VALUE self, VALUE rb_name_or_remote
|
|
|
309
307
|
rugged_check_repo(rb_repo);
|
|
310
308
|
Data_Get_Struct(rb_repo, git_repository, repo);
|
|
311
309
|
|
|
312
|
-
|
|
310
|
+
rugged_exception_check(
|
|
311
|
+
git_remote_delete(repo, StringValueCStr(rb_name_or_remote))
|
|
312
|
+
);
|
|
313
|
+
|
|
314
|
+
return Qnil;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/*
|
|
318
|
+
* call-seq:
|
|
319
|
+
* remotes.set_url(remote, url) -> nil
|
|
320
|
+
* remotes.set_url(name, url) -> nil
|
|
321
|
+
*
|
|
322
|
+
* Sets the remote's url in the configuration.
|
|
323
|
+
* Rugged::Remote objects already in memory will not be affected.
|
|
324
|
+
*
|
|
325
|
+
* repo.remotes.set_url("origin", 'git://github.com/libgit2/rugged.git')
|
|
326
|
+
*/
|
|
327
|
+
static VALUE rb_git_remote_collection_set_url(VALUE self, VALUE rb_name_or_remote, VALUE rb_url)
|
|
328
|
+
{
|
|
329
|
+
VALUE rb_repo = rugged_owner(self);
|
|
330
|
+
git_repository *repo;
|
|
331
|
+
|
|
332
|
+
if (rb_obj_is_kind_of(rb_name_or_remote, rb_cRuggedRemote))
|
|
333
|
+
rb_name_or_remote = rb_funcall(rb_name_or_remote, rb_intern("name"), 0);
|
|
334
|
+
|
|
335
|
+
if (TYPE(rb_name_or_remote) != T_STRING)
|
|
336
|
+
rb_raise(rb_eTypeError, "Expecting a String or Rugged::Remote instance");
|
|
337
|
+
|
|
338
|
+
rugged_check_repo(rb_repo);
|
|
339
|
+
Data_Get_Struct(rb_repo, git_repository, repo);
|
|
340
|
+
|
|
341
|
+
Check_Type(rb_url, T_STRING);
|
|
342
|
+
|
|
343
|
+
rugged_exception_check(
|
|
344
|
+
git_remote_set_url(repo, StringValueCStr(rb_name_or_remote), StringValueCStr(rb_url))
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
return Qnil;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/*
|
|
351
|
+
* call-seq:
|
|
352
|
+
* remotes.set_push_url(remote, url) -> nil
|
|
353
|
+
* remotes.set_push_url(name, url) -> nil
|
|
354
|
+
*
|
|
355
|
+
* Sets the remote's url for pushing in the configuration.
|
|
356
|
+
* Rugged::Remote objects already in memory will not be affected.
|
|
357
|
+
*
|
|
358
|
+
* repo.remotes.set_push_url("origin", 'git://github.com/libgit2/rugged.git')
|
|
359
|
+
*/
|
|
360
|
+
static VALUE rb_git_remote_collection_set_push_url(VALUE self, VALUE rb_name_or_remote, VALUE rb_url)
|
|
361
|
+
{
|
|
362
|
+
VALUE rb_repo = rugged_owner(self);
|
|
363
|
+
git_repository *repo;
|
|
364
|
+
|
|
365
|
+
if (rb_obj_is_kind_of(rb_name_or_remote, rb_cRuggedRemote))
|
|
366
|
+
rb_name_or_remote = rb_funcall(rb_name_or_remote, rb_intern("name"), 0);
|
|
367
|
+
|
|
368
|
+
if (TYPE(rb_name_or_remote) != T_STRING)
|
|
369
|
+
rb_raise(rb_eTypeError, "Expecting a String or Rugged::Remote instance");
|
|
370
|
+
|
|
371
|
+
rugged_check_repo(rb_repo);
|
|
372
|
+
Data_Get_Struct(rb_repo, git_repository, repo);
|
|
373
|
+
|
|
374
|
+
Check_Type(rb_url, T_STRING);
|
|
375
|
+
|
|
376
|
+
rugged_exception_check(
|
|
377
|
+
git_remote_set_pushurl(repo, StringValueCStr(rb_name_or_remote), StringValueCStr(rb_url))
|
|
378
|
+
);
|
|
379
|
+
|
|
380
|
+
return Qnil;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
static VALUE rb_git_remote_collection_add_refspec(VALUE self, VALUE rb_name_or_remote, VALUE rb_refspec, git_direction direction)
|
|
384
|
+
{
|
|
385
|
+
VALUE rb_repo = rugged_owner(self);
|
|
386
|
+
git_repository *repo;
|
|
387
|
+
int error = 0;
|
|
388
|
+
|
|
389
|
+
if (rb_obj_is_kind_of(rb_name_or_remote, rb_cRuggedRemote))
|
|
390
|
+
rb_name_or_remote = rb_funcall(rb_name_or_remote, rb_intern("name"), 0);
|
|
391
|
+
|
|
392
|
+
if (TYPE(rb_name_or_remote) != T_STRING)
|
|
393
|
+
rb_raise(rb_eTypeError, "Expecting a String or Rugged::Remote instance");
|
|
394
|
+
|
|
395
|
+
rugged_check_repo(rb_repo);
|
|
396
|
+
Data_Get_Struct(rb_repo, git_repository, repo);
|
|
397
|
+
|
|
398
|
+
Check_Type(rb_refspec, T_STRING);
|
|
399
|
+
|
|
400
|
+
if (direction == GIT_DIRECTION_FETCH)
|
|
401
|
+
error = git_remote_add_fetch(repo, StringValueCStr(rb_name_or_remote), StringValueCStr(rb_refspec));
|
|
402
|
+
else
|
|
403
|
+
error = git_remote_add_push(repo, StringValueCStr(rb_name_or_remote), StringValueCStr(rb_refspec));
|
|
404
|
+
|
|
313
405
|
rugged_exception_check(error);
|
|
314
406
|
|
|
315
407
|
return Qnil;
|
|
316
408
|
}
|
|
317
409
|
|
|
410
|
+
/*
|
|
411
|
+
* call-seq:
|
|
412
|
+
* remotes.add_fetch_refspec(remote, refspec) -> nil
|
|
413
|
+
* remotes.add_fetch_refspec(name, refspec) -> nil
|
|
414
|
+
*
|
|
415
|
+
* Add a fetch refspec to the remote.
|
|
416
|
+
*/
|
|
417
|
+
static VALUE rb_git_remote_collection_add_fetch_refspec(VALUE self, VALUE rb_name_or_remote, VALUE rb_refspec)
|
|
418
|
+
{
|
|
419
|
+
return rb_git_remote_collection_add_refspec(self, rb_name_or_remote, rb_refspec, GIT_DIRECTION_FETCH);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/*
|
|
423
|
+
* call-seq:
|
|
424
|
+
* remotes.add_push_refspec(remote, refspec) -> nil
|
|
425
|
+
* remotes.add_push_refspec(name, refspec) -> nil
|
|
426
|
+
*
|
|
427
|
+
* Add a push refspec to the remote.
|
|
428
|
+
*/
|
|
429
|
+
static VALUE rb_git_remote_collection_add_push_refspec(VALUE self, VALUE rb_name_or_remote, VALUE rb_refspec)
|
|
430
|
+
{
|
|
431
|
+
return rb_git_remote_collection_add_refspec(self, rb_name_or_remote, rb_refspec, GIT_DIRECTION_PUSH);
|
|
432
|
+
}
|
|
433
|
+
|
|
318
434
|
void Init_rugged_remote_collection(void)
|
|
319
435
|
{
|
|
320
436
|
rb_cRuggedRemoteCollection = rb_define_class_under(rb_mRugged, "RemoteCollection", rb_cObject);
|
|
321
437
|
rb_include_module(rb_cRuggedRemoteCollection, rb_mEnumerable);
|
|
322
438
|
|
|
323
|
-
rb_define_method(rb_cRuggedRemoteCollection, "initialize",
|
|
439
|
+
rb_define_method(rb_cRuggedRemoteCollection, "initialize", rb_git_remote_collection_initialize, 1);
|
|
440
|
+
|
|
441
|
+
rb_define_method(rb_cRuggedRemoteCollection, "[]", rb_git_remote_collection_aref, 1);
|
|
442
|
+
|
|
443
|
+
rb_define_method(rb_cRuggedRemoteCollection, "create", rb_git_remote_collection_create, 2);
|
|
444
|
+
rb_define_method(rb_cRuggedRemoteCollection, "create_anonymous", rb_git_remote_collection_create_anonymous, 1);
|
|
324
445
|
|
|
325
|
-
rb_define_method(rb_cRuggedRemoteCollection, "
|
|
446
|
+
rb_define_method(rb_cRuggedRemoteCollection, "each", rb_git_remote_collection_each, 0);
|
|
447
|
+
rb_define_method(rb_cRuggedRemoteCollection, "each_name", rb_git_remote_collection_each_name, 0);
|
|
326
448
|
|
|
327
|
-
rb_define_method(rb_cRuggedRemoteCollection, "
|
|
328
|
-
rb_define_method(rb_cRuggedRemoteCollection, "
|
|
449
|
+
rb_define_method(rb_cRuggedRemoteCollection, "set_url", rb_git_remote_collection_set_url, 2);
|
|
450
|
+
rb_define_method(rb_cRuggedRemoteCollection, "set_push_url", rb_git_remote_collection_set_push_url, 2);
|
|
329
451
|
|
|
330
|
-
rb_define_method(rb_cRuggedRemoteCollection, "
|
|
331
|
-
rb_define_method(rb_cRuggedRemoteCollection, "
|
|
452
|
+
rb_define_method(rb_cRuggedRemoteCollection, "add_push_refspec", rb_git_remote_collection_add_push_refspec, 2);
|
|
453
|
+
rb_define_method(rb_cRuggedRemoteCollection, "add_fetch_refspec", rb_git_remote_collection_add_fetch_refspec, 2);
|
|
332
454
|
|
|
333
|
-
rb_define_method(rb_cRuggedRemoteCollection, "rename",
|
|
334
|
-
rb_define_method(rb_cRuggedRemoteCollection, "delete",
|
|
455
|
+
rb_define_method(rb_cRuggedRemoteCollection, "rename", rb_git_remote_collection_rename, 2);
|
|
456
|
+
rb_define_method(rb_cRuggedRemoteCollection, "delete", rb_git_remote_collection_delete, 1);
|
|
335
457
|
}
|