rugged 0.24.6.1 → 0.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/ext/rugged/extconf.rb +9 -2
- data/ext/rugged/rugged.c +85 -21
- data/ext/rugged/rugged.h +7 -21
- data/ext/rugged/rugged_backend.c +3 -20
- data/ext/rugged/rugged_blame.c +7 -24
- data/ext/rugged/rugged_blob.c +136 -59
- data/ext/rugged/rugged_branch.c +3 -20
- data/ext/rugged/rugged_branch_collection.c +3 -20
- data/ext/rugged/rugged_commit.c +251 -101
- data/ext/rugged/rugged_config.c +3 -20
- data/ext/rugged/rugged_cred.c +3 -20
- data/ext/rugged/rugged_diff.c +3 -20
- data/ext/rugged/rugged_diff_delta.c +3 -20
- data/ext/rugged/rugged_diff_hunk.c +3 -20
- data/ext/rugged/rugged_diff_line.c +3 -20
- data/ext/rugged/rugged_index.c +46 -229
- data/ext/rugged/rugged_note.c +3 -20
- data/ext/rugged/rugged_object.c +3 -20
- data/ext/rugged/rugged_patch.c +192 -34
- data/ext/rugged/rugged_rebase.c +90 -48
- data/ext/rugged/rugged_reference.c +4 -21
- data/ext/rugged/rugged_reference_collection.c +3 -20
- data/ext/rugged/rugged_remote.c +70 -42
- data/ext/rugged/rugged_remote_collection.c +3 -20
- data/ext/rugged/rugged_repo.c +50 -59
- data/ext/rugged/rugged_revwalk.c +4 -21
- data/ext/rugged/rugged_settings.c +3 -20
- data/ext/rugged/rugged_signature.c +3 -20
- data/ext/rugged/rugged_submodule.c +4 -21
- data/ext/rugged/rugged_submodule_collection.c +3 -20
- data/ext/rugged/rugged_tag.c +3 -20
- data/ext/rugged/rugged_tag_collection.c +3 -20
- data/ext/rugged/rugged_tree.c +189 -184
- data/lib/rugged/attributes.rb +5 -0
- data/lib/rugged/blob.rb +5 -0
- data/lib/rugged/branch.rb +6 -1
- data/lib/rugged/commit.rb +5 -0
- data/lib/rugged/console.rb +5 -0
- data/lib/rugged/credentials.rb +5 -0
- data/lib/rugged/diff/delta.rb +5 -0
- data/lib/rugged/diff/hunk.rb +5 -0
- data/lib/rugged/diff/line.rb +5 -0
- data/lib/rugged/diff.rb +5 -0
- data/lib/rugged/index.rb +120 -0
- data/lib/rugged/object.rb +5 -0
- data/lib/rugged/patch.rb +5 -0
- data/lib/rugged/reference.rb +5 -0
- data/lib/rugged/remote.rb +5 -0
- data/lib/rugged/repository.rb +9 -4
- data/lib/rugged/submodule_collection.rb +5 -0
- data/lib/rugged/tag.rb +5 -0
- data/lib/rugged/tree.rb +156 -1
- data/lib/rugged/version.rb +6 -1
- data/lib/rugged/walker.rb +5 -0
- data/lib/rugged.rb +5 -0
- data/vendor/libgit2/CMakeLists.txt +12 -2
- data/vendor/libgit2/include/git2/blob.h +39 -28
- data/vendor/libgit2/include/git2/commit.h +76 -0
- data/vendor/libgit2/include/git2/common.h +21 -1
- data/vendor/libgit2/include/git2/describe.h +5 -2
- data/vendor/libgit2/include/git2/diff.h +62 -7
- data/vendor/libgit2/include/git2/errors.h +2 -1
- data/vendor/libgit2/include/git2/index.h +25 -0
- data/vendor/libgit2/include/git2/merge.h +10 -1
- data/vendor/libgit2/include/git2/odb.h +47 -1
- data/vendor/libgit2/include/git2/pack.h +4 -4
- data/vendor/libgit2/include/git2/patch.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +92 -0
- data/vendor/libgit2/include/git2/refs.h +11 -0
- data/vendor/libgit2/include/git2/remote.h +21 -8
- data/vendor/libgit2/include/git2/repository.h +20 -1
- data/vendor/libgit2/include/git2/revwalk.h +4 -6
- data/vendor/libgit2/include/git2/signature.h +13 -0
- data/vendor/libgit2/include/git2/submodule.h +11 -3
- data/vendor/libgit2/include/git2/sys/merge.h +177 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +11 -0
- data/vendor/libgit2/include/git2/sys/remote.h +16 -0
- data/vendor/libgit2/include/git2/sys/stream.h +2 -1
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +3 -1
- data/vendor/libgit2/include/git2/tag.h +9 -0
- data/vendor/libgit2/include/git2/transaction.h +9 -0
- data/vendor/libgit2/include/git2/tree.h +55 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/annotated_commit.c +99 -80
- data/vendor/libgit2/src/annotated_commit.h +5 -2
- data/vendor/libgit2/src/apply.c +377 -0
- data/vendor/libgit2/src/apply.h +21 -0
- data/vendor/libgit2/src/array.h +0 -1
- data/vendor/libgit2/src/blob.c +71 -39
- data/vendor/libgit2/src/branch.c +7 -5
- data/vendor/libgit2/src/buffer.c +252 -20
- data/vendor/libgit2/src/buffer.h +8 -0
- data/vendor/libgit2/src/checkout.c +69 -42
- data/vendor/libgit2/src/clone.c +0 -8
- data/vendor/libgit2/src/commit.c +193 -49
- data/vendor/libgit2/src/commit_list.c +8 -3
- data/vendor/libgit2/src/commit_list.h +1 -0
- data/vendor/libgit2/src/common.h +2 -1
- data/vendor/libgit2/src/config.c +3 -3
- data/vendor/libgit2/src/config_file.c +20 -10
- data/vendor/libgit2/src/crlf.c +1 -0
- data/vendor/libgit2/src/curl_stream.c +106 -6
- data/vendor/libgit2/src/delta.c +238 -62
- data/vendor/libgit2/src/delta.h +79 -58
- data/vendor/libgit2/src/describe.c +1 -1
- data/vendor/libgit2/src/diff.c +32 -1554
- data/vendor/libgit2/src/diff.h +14 -122
- data/vendor/libgit2/src/diff_driver.c +4 -6
- data/vendor/libgit2/src/diff_file.c +3 -0
- data/vendor/libgit2/src/diff_generate.c +1613 -0
- data/vendor/libgit2/src/diff_generate.h +123 -0
- data/vendor/libgit2/src/diff_parse.c +101 -0
- data/vendor/libgit2/src/diff_parse.h +18 -0
- data/vendor/libgit2/src/diff_print.c +263 -144
- data/vendor/libgit2/src/diff_stats.c +21 -12
- data/vendor/libgit2/src/diff_tform.c +1 -0
- data/vendor/libgit2/src/diff_tform.h +22 -0
- data/vendor/libgit2/src/diff_xdiff.c +9 -9
- data/vendor/libgit2/src/diff_xdiff.h +5 -5
- data/vendor/libgit2/src/fetchhead.c +8 -8
- data/vendor/libgit2/src/filebuf.c +6 -1
- data/vendor/libgit2/src/filebuf.h +1 -0
- data/vendor/libgit2/src/fileops.c +22 -1
- data/vendor/libgit2/src/fileops.h +8 -2
- data/vendor/libgit2/src/fnmatch.c +18 -5
- data/vendor/libgit2/src/global.c +21 -4
- data/vendor/libgit2/src/global.h +6 -0
- data/vendor/libgit2/src/graph.c +1 -1
- data/vendor/libgit2/src/index.c +159 -46
- data/vendor/libgit2/src/index.h +2 -0
- data/vendor/libgit2/src/iterator.c +1573 -1468
- data/vendor/libgit2/src/iterator.h +52 -69
- data/vendor/libgit2/src/merge.c +163 -64
- data/vendor/libgit2/src/merge.h +61 -2
- data/vendor/libgit2/src/merge_driver.c +397 -0
- data/vendor/libgit2/src/merge_driver.h +60 -0
- data/vendor/libgit2/src/merge_file.c +11 -49
- data/vendor/libgit2/src/netops.c +12 -10
- data/vendor/libgit2/src/object_api.c +19 -1
- data/vendor/libgit2/src/odb.c +228 -52
- data/vendor/libgit2/src/odb_loose.c +19 -1
- data/vendor/libgit2/src/odb_mempack.c +1 -1
- data/vendor/libgit2/src/odb_pack.c +27 -1
- data/vendor/libgit2/src/openssl_stream.c +4 -5
- data/vendor/libgit2/src/pack-objects.c +105 -76
- data/vendor/libgit2/src/pack-objects.h +13 -12
- data/vendor/libgit2/src/pack.c +16 -10
- data/vendor/libgit2/src/pack.h +2 -0
- data/vendor/libgit2/src/patch.c +216 -0
- data/vendor/libgit2/src/patch.h +66 -0
- data/vendor/libgit2/src/{diff_patch.c → patch_generate.c} +203 -376
- data/vendor/libgit2/src/patch_generate.h +68 -0
- data/vendor/libgit2/src/patch_parse.c +1159 -0
- data/vendor/libgit2/src/patch_parse.h +56 -0
- data/vendor/libgit2/src/path.c +38 -2
- data/vendor/libgit2/src/path.h +18 -0
- data/vendor/libgit2/src/pathspec.c +1 -1
- data/vendor/libgit2/src/pool.h +5 -0
- data/vendor/libgit2/src/pqueue.c +12 -5
- data/vendor/libgit2/src/pqueue.h +1 -0
- data/vendor/libgit2/src/proxy.c +32 -0
- data/vendor/libgit2/src/proxy.h +14 -0
- data/vendor/libgit2/src/push.c +1 -1
- data/vendor/libgit2/src/rebase.c +63 -36
- data/vendor/libgit2/src/refdb.c +4 -2
- data/vendor/libgit2/src/refdb_fs.c +82 -54
- data/vendor/libgit2/src/refs.c +13 -1
- data/vendor/libgit2/src/remote.c +20 -81
- data/vendor/libgit2/src/repository.c +212 -29
- data/vendor/libgit2/src/reset.c +1 -1
- data/vendor/libgit2/src/revparse.c +1 -1
- data/vendor/libgit2/src/revwalk.c +260 -184
- data/vendor/libgit2/src/settings.c +11 -3
- data/vendor/libgit2/src/signature.c +27 -2
- data/vendor/libgit2/src/sortedcache.c +14 -5
- data/vendor/libgit2/src/stash.c +1 -0
- data/vendor/libgit2/src/status.c +1 -0
- data/vendor/libgit2/src/stransport_stream.c +4 -2
- data/vendor/libgit2/src/stream.h +2 -2
- data/vendor/libgit2/src/submodule.c +16 -4
- data/vendor/libgit2/src/sysdir.c +1 -1
- data/vendor/libgit2/src/transport.c +3 -5
- data/vendor/libgit2/src/transports/http.c +38 -13
- data/vendor/libgit2/src/transports/local.c +4 -1
- data/vendor/libgit2/src/transports/smart.c +6 -0
- data/vendor/libgit2/src/transports/smart.h +1 -0
- data/vendor/libgit2/src/transports/smart_pkt.c +5 -13
- data/vendor/libgit2/src/transports/smart_protocol.c +22 -7
- data/vendor/libgit2/src/transports/winhttp.c +144 -11
- data/vendor/libgit2/src/tree.c +267 -2
- data/vendor/libgit2/src/unix/posix.h +10 -0
- data/vendor/libgit2/src/unix/pthread.h +2 -0
- data/vendor/libgit2/src/util.c +25 -2
- data/vendor/libgit2/src/util.h +10 -0
- data/vendor/libgit2/src/varint.c +44 -0
- data/vendor/libgit2/src/varint.h +15 -0
- data/vendor/libgit2/src/vector.c +58 -0
- data/vendor/libgit2/src/vector.h +8 -0
- data/vendor/libgit2/src/win32/posix.h +3 -0
- data/vendor/libgit2/src/win32/thread.c +18 -0
- data/vendor/libgit2/src/win32/thread.h +2 -0
- data/vendor/libgit2/src/win32/w32_util.h +1 -1
- data/vendor/libgit2/src/zstream.c +37 -8
- data/vendor/libgit2/src/zstream.h +8 -1
- metadata +100 -82
- data/vendor/libgit2/Makefile.embed +0 -60
- data/vendor/libgit2/src/delta-apply.c +0 -166
- data/vendor/libgit2/src/delta-apply.h +0 -62
- data/vendor/libgit2/src/diff_patch.h +0 -83
data/ext/rugged/rugged_index.c
CHANGED
@@ -1,25 +1,8 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
11
|
-
* furnished to do so, subject to the following conditions:
|
12
|
-
*
|
13
|
-
* The above copyright notice and this permission notice shall be included in
|
14
|
-
* all copies or substantial portions of the Software.
|
15
|
-
*
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
-
* THE SOFTWARE.
|
2
|
+
* Copyright (C) the Rugged contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of Rugged, distributed under the MIT license.
|
5
|
+
* For full terms see the included LICENSE file.
|
23
6
|
*/
|
24
7
|
|
25
8
|
#include "rugged.h"
|
@@ -691,146 +674,51 @@ static VALUE rb_git_index_readtree(VALUE self, VALUE rb_tree)
|
|
691
674
|
return Qnil;
|
692
675
|
}
|
693
676
|
|
694
|
-
|
695
|
-
* call-seq:
|
696
|
-
* index.diff([options]) -> diff
|
697
|
-
* index.diff(diffable[, options]) -> diff
|
698
|
-
*
|
699
|
-
* The first form returns a diff between the index and the current working
|
700
|
-
* directory.
|
701
|
-
*
|
702
|
-
* The second form returns a diff between the index and the given diffable object.
|
703
|
-
* +diffable+ can either be a +Rugged::Commit+ or a +Rugged::Tree+.
|
704
|
-
*
|
705
|
-
* The index will be used as the "old file" side of the diff, while the working
|
706
|
-
* directory or the +diffable+ will be used for the "new file" side.
|
707
|
-
*
|
708
|
-
* The following options can be passed in the +options+ Hash:
|
709
|
-
*
|
710
|
-
* :paths ::
|
711
|
-
* An array of paths / fnmatch patterns to constrain the diff to a specific
|
712
|
-
* set of files. Also see +:disable_pathspec_match+.
|
713
|
-
*
|
714
|
-
* :max_size ::
|
715
|
-
* An integer specifying the maximum byte size of a file before a it will
|
716
|
-
* be treated as binary. The default value is 512MB.
|
717
|
-
*
|
718
|
-
* :context_lines ::
|
719
|
-
* The number of unchanged lines that define the boundary of a hunk (and
|
720
|
-
* to display before and after the actual changes). The default is 3.
|
721
|
-
*
|
722
|
-
* :interhunk_lines ::
|
723
|
-
* The maximum number of unchanged lines between hunk boundaries before the hunks
|
724
|
-
* will be merged into a one. The default is 0.
|
725
|
-
*
|
726
|
-
* :reverse ::
|
727
|
-
* If true, the sides of the diff will be reversed.
|
728
|
-
*
|
729
|
-
* :force_text ::
|
730
|
-
* If true, all files will be treated as text, disabling binary attributes & detection.
|
731
|
-
*
|
732
|
-
* :ignore_whitespace ::
|
733
|
-
* If true, all whitespace will be ignored.
|
734
|
-
*
|
735
|
-
* :ignore_whitespace_change ::
|
736
|
-
* If true, changes in amount of whitespace will be ignored.
|
737
|
-
*
|
738
|
-
* :ignore_whitespace_eol ::
|
739
|
-
* If true, whitespace at end of line will be ignored.
|
740
|
-
*
|
741
|
-
* :ignore_submodules ::
|
742
|
-
* if true, submodules will be excluded from the diff completely.
|
743
|
-
*
|
744
|
-
* :patience ::
|
745
|
-
* If true, the "patience diff" algorithm will be used (currenlty unimplemented).
|
746
|
-
*
|
747
|
-
* :include_ignored ::
|
748
|
-
* If true, ignored files will be included in the diff.
|
749
|
-
*
|
750
|
-
* :include_untracked ::
|
751
|
-
* If true, untracked files will be included in the diff.
|
752
|
-
*
|
753
|
-
* :include_unmodified ::
|
754
|
-
* If true, unmodified files will be included in the diff.
|
755
|
-
*
|
756
|
-
* :recurse_untracked_dirs ::
|
757
|
-
* Even if +:include_untracked+ is true, untracked directories will only be
|
758
|
-
* marked with a single entry in the diff. If this flag is set to true,
|
759
|
-
* all files under ignored directories will be included in the diff, too.
|
760
|
-
*
|
761
|
-
* :disable_pathspec_match ::
|
762
|
-
* If true, the given +:paths+ will be applied as exact matches, instead of
|
763
|
-
* as fnmatch patterns.
|
764
|
-
*
|
765
|
-
* :deltas_are_icase ::
|
766
|
-
* If true, filename comparisons will be made with case-insensitivity.
|
767
|
-
*
|
768
|
-
* :include_untracked_content ::
|
769
|
-
* if true, untracked content will be contained in the the diff patch text.
|
770
|
-
*
|
771
|
-
* :skip_binary_check ::
|
772
|
-
* If true, diff deltas will be generated without spending time on binary
|
773
|
-
* detection. This is useful to improve performance in cases where the actual
|
774
|
-
* file content difference is not needed.
|
775
|
-
*
|
776
|
-
* :include_typechange ::
|
777
|
-
* If true, type changes for files will not be interpreted as deletion of
|
778
|
-
* the "old file" and addition of the "new file", but will generate
|
779
|
-
* typechange records.
|
780
|
-
*
|
781
|
-
* :include_typechange_trees ::
|
782
|
-
* Even if +:include_typechange+ is true, blob -> tree changes will still
|
783
|
-
* usually be handled as a deletion of the blob. If this flag is set to true,
|
784
|
-
* blob -> tree changes will be marked as typechanges.
|
785
|
-
*
|
786
|
-
* :ignore_filemode ::
|
787
|
-
* If true, file mode changes will be ignored.
|
788
|
-
*
|
789
|
-
* :recurse_ignored_dirs ::
|
790
|
-
* Even if +:include_ignored+ is true, ignored directories will only be
|
791
|
-
* marked with a single entry in the diff. If this flag is set to true,
|
792
|
-
* all files under ignored directories will be included in the diff, too.
|
793
|
-
*/
|
794
|
-
static VALUE rb_git_index_diff(int argc, VALUE *argv, VALUE self)
|
677
|
+
static VALUE rb_git_diff_tree_to_index(VALUE self, VALUE rb_other, VALUE rb_options)
|
795
678
|
{
|
796
679
|
git_index *index;
|
797
680
|
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
798
681
|
git_repository *repo;
|
799
682
|
git_diff *diff = NULL;
|
800
|
-
VALUE owner
|
683
|
+
VALUE owner;
|
801
684
|
int error;
|
685
|
+
git_tree *other_tree;
|
802
686
|
|
803
|
-
rb_scan_args(argc, argv, "01:", &rb_other, &rb_options);
|
804
687
|
rugged_parse_diff_options(&opts, rb_options);
|
805
688
|
|
806
689
|
Data_Get_Struct(self, git_index, index);
|
807
690
|
owner = rugged_owner(self);
|
808
691
|
Data_Get_Struct(owner, git_repository, repo);
|
809
692
|
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
693
|
+
// Need to flip the reverse option, so that the index is by default
|
694
|
+
// the "old file" side of the diff.
|
695
|
+
opts.flags ^= GIT_DIFF_REVERSE;
|
696
|
+
|
697
|
+
Data_Get_Struct(rb_other, git_tree, other_tree);
|
698
|
+
error = git_diff_tree_to_index(&diff, repo, other_tree, index, &opts);
|
699
|
+
|
700
|
+
xfree(opts.pathspec.strings);
|
701
|
+
rugged_exception_check(error);
|
702
|
+
|
703
|
+
return rugged_diff_new(rb_cRuggedDiff, owner, diff);
|
704
|
+
}
|
705
|
+
|
706
|
+
static VALUE rb_git_diff_index_to_workdir(VALUE self, VALUE rb_options)
|
707
|
+
{
|
708
|
+
git_index *index;
|
709
|
+
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
|
710
|
+
git_repository *repo;
|
711
|
+
git_diff *diff = NULL;
|
712
|
+
VALUE owner;
|
713
|
+
int error;
|
714
|
+
|
715
|
+
rugged_parse_diff_options(&opts, rb_options);
|
716
|
+
|
717
|
+
Data_Get_Struct(self, git_index, index);
|
718
|
+
owner = rugged_owner(self);
|
719
|
+
Data_Get_Struct(owner, git_repository, repo);
|
720
|
+
|
721
|
+
error = git_diff_index_to_workdir(&diff, repo, index, &opts);
|
834
722
|
|
835
723
|
xfree(opts.pathspec.strings);
|
836
724
|
rugged_exception_check(error);
|
@@ -952,76 +840,6 @@ static VALUE rb_git_conflict_get(VALUE self, VALUE rb_path)
|
|
952
840
|
return rb_result;
|
953
841
|
}
|
954
842
|
|
955
|
-
void rugged_parse_merge_file_options(git_merge_file_options *opts, VALUE rb_options)
|
956
|
-
{
|
957
|
-
if (!NIL_P(rb_options)) {
|
958
|
-
VALUE rb_value;
|
959
|
-
Check_Type(rb_options, T_HASH);
|
960
|
-
|
961
|
-
rb_value = rb_hash_aref(rb_options, CSTR2SYM("ancestor_label"));
|
962
|
-
if (!NIL_P(rb_value)) {
|
963
|
-
Check_Type(rb_value, T_FIXNUM);
|
964
|
-
opts->ancestor_label = StringValueCStr(rb_value);
|
965
|
-
}
|
966
|
-
|
967
|
-
rb_value = rb_hash_aref(rb_options, CSTR2SYM("our_label"));
|
968
|
-
if (!NIL_P(rb_value)) {
|
969
|
-
Check_Type(rb_value, T_FIXNUM);
|
970
|
-
opts->our_label = StringValueCStr(rb_value);
|
971
|
-
}
|
972
|
-
|
973
|
-
rb_value = rb_hash_aref(rb_options, CSTR2SYM("their_label"));
|
974
|
-
if (!NIL_P(rb_value)) {
|
975
|
-
Check_Type(rb_value, T_FIXNUM);
|
976
|
-
opts->their_label = StringValueCStr(rb_value);
|
977
|
-
}
|
978
|
-
|
979
|
-
rb_value = rb_hash_aref(rb_options, CSTR2SYM("favor"));
|
980
|
-
if (!NIL_P(rb_value)) {
|
981
|
-
ID id_favor;
|
982
|
-
|
983
|
-
Check_Type(rb_value, T_SYMBOL);
|
984
|
-
id_favor = SYM2ID(rb_value);
|
985
|
-
|
986
|
-
if (id_favor == rb_intern("normal")) {
|
987
|
-
opts->favor = GIT_MERGE_FILE_FAVOR_NORMAL;
|
988
|
-
} else if (id_favor == rb_intern("ours")) {
|
989
|
-
opts->favor = GIT_MERGE_FILE_FAVOR_OURS;
|
990
|
-
} else if (id_favor == rb_intern("theirs")) {
|
991
|
-
opts->favor = GIT_MERGE_FILE_FAVOR_THEIRS;
|
992
|
-
} else if (id_favor == rb_intern("union")) {
|
993
|
-
opts->favor = GIT_MERGE_FILE_FAVOR_UNION;
|
994
|
-
} else {
|
995
|
-
rb_raise(rb_eTypeError,
|
996
|
-
"Invalid favor mode. Expected `:normal`, `:ours`, `:theirs` or `:union`");
|
997
|
-
}
|
998
|
-
}
|
999
|
-
|
1000
|
-
rb_value = rb_hash_aref(rb_options, CSTR2SYM("style"));
|
1001
|
-
if (!NIL_P(rb_value)) {
|
1002
|
-
ID id_style;
|
1003
|
-
|
1004
|
-
Check_Type(rb_value, T_SYMBOL);
|
1005
|
-
id_style = SYM2ID(rb_value);
|
1006
|
-
|
1007
|
-
if (id_style == rb_intern("standard")) {
|
1008
|
-
opts->flags |= GIT_MERGE_FILE_STYLE_MERGE;
|
1009
|
-
} else if (id_style == rb_intern("diff3")) {
|
1010
|
-
opts->flags |= GIT_MERGE_FILE_STYLE_DIFF3;
|
1011
|
-
} else {
|
1012
|
-
rb_raise(rb_eTypeError,
|
1013
|
-
"Invalid style mode. Expected `:standard`, or `:diff3`");
|
1014
|
-
}
|
1015
|
-
} else {
|
1016
|
-
opts->flags |= GIT_MERGE_FILE_STYLE_MERGE;
|
1017
|
-
}
|
1018
|
-
|
1019
|
-
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("simplify")))) {
|
1020
|
-
opts->flags |= GIT_MERGE_FILE_SIMPLIFY_ALNUM;
|
1021
|
-
}
|
1022
|
-
}
|
1023
|
-
}
|
1024
|
-
|
1025
843
|
/*
|
1026
844
|
* call-seq:
|
1027
845
|
* index.merge_file(path[, options]) -> merge_file or nil
|
@@ -1061,8 +879,7 @@ void rugged_parse_merge_file_options(git_merge_file_options *opts, VALUE rb_opti
|
|
1061
879
|
|
1062
880
|
static VALUE rb_git_merge_file(int argc, VALUE *argv, VALUE self)
|
1063
881
|
{
|
1064
|
-
VALUE rb_path, rb_options;
|
1065
|
-
VALUE rb_result = rb_hash_new();
|
882
|
+
VALUE rb_path, rb_options, rb_result;
|
1066
883
|
VALUE rb_repo = rugged_owner(self);
|
1067
884
|
|
1068
885
|
git_repository *repo;
|
@@ -1074,10 +891,8 @@ static VALUE rb_git_merge_file(int argc, VALUE *argv, VALUE self)
|
|
1074
891
|
|
1075
892
|
rb_scan_args(argc, argv, "1:", &rb_path, &rb_options);
|
1076
893
|
|
1077
|
-
if (!NIL_P(rb_options))
|
1078
|
-
Check_Type(rb_options, T_HASH);
|
894
|
+
if (!NIL_P(rb_options))
|
1079
895
|
rugged_parse_merge_file_options(&opts, rb_options);
|
1080
|
-
}
|
1081
896
|
|
1082
897
|
Check_Type(rb_path, T_STRING);
|
1083
898
|
|
@@ -1092,14 +907,15 @@ static VALUE rb_git_merge_file(int argc, VALUE *argv, VALUE self)
|
|
1092
907
|
else
|
1093
908
|
rugged_exception_check(error);
|
1094
909
|
|
910
|
+
if (ours == NULL)
|
911
|
+
rb_raise(rb_eRuntimeError, "The conflict does not have a stage 2 entry");
|
912
|
+
else if (theirs == NULL)
|
913
|
+
rb_raise(rb_eRuntimeError, "The conflict does not have a stage 3 entry");
|
914
|
+
|
1095
915
|
error = git_merge_file_from_index(&merge_file_result, repo, ancestor, ours, theirs, &opts);
|
1096
916
|
rugged_exception_check(error);
|
1097
917
|
|
1098
|
-
|
1099
|
-
rb_hash_aset(rb_result, CSTR2SYM("path"), rb_path);
|
1100
|
-
rb_hash_aset(rb_result, CSTR2SYM("filemode"), INT2FIX(merge_file_result.mode));
|
1101
|
-
rb_hash_aset(rb_result, CSTR2SYM("data"), rb_str_new(merge_file_result.ptr, merge_file_result.len));
|
1102
|
-
|
918
|
+
rb_result = rb_merge_file_result_fromC(&merge_file_result);
|
1103
919
|
git_merge_file_result_free(&merge_file_result);
|
1104
920
|
|
1105
921
|
return rb_result;
|
@@ -1224,7 +1040,8 @@ void Init_rugged_index(void)
|
|
1224
1040
|
rb_define_method(rb_cRuggedIndex, "get", rb_git_index_get, -1);
|
1225
1041
|
rb_define_method(rb_cRuggedIndex, "[]", rb_git_index_get, -1);
|
1226
1042
|
rb_define_method(rb_cRuggedIndex, "each", rb_git_index_each, 0);
|
1227
|
-
|
1043
|
+
rb_define_private_method(rb_cRuggedIndex, "diff_tree_to_index", rb_git_diff_tree_to_index, 2);
|
1044
|
+
rb_define_private_method(rb_cRuggedIndex, "diff_index_to_workdir", rb_git_diff_index_to_workdir, 1);
|
1228
1045
|
|
1229
1046
|
rb_define_method(rb_cRuggedIndex, "conflicts?", rb_git_index_conflicts_p, 0);
|
1230
1047
|
rb_define_method(rb_cRuggedIndex, "conflicts", rb_git_index_conflicts, 0);
|
data/ext/rugged/rugged_note.c
CHANGED
@@ -1,25 +1,8 @@
|
|
1
1
|
/*
|
2
|
-
*
|
2
|
+
* Copyright (C) the Rugged contributors. All rights reserved.
|
3
3
|
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
11
|
-
* furnished to do so, subject to the following conditions:
|
12
|
-
*
|
13
|
-
* The above copyright notice and this permission notice shall be included in
|
14
|
-
* all copies or substantial portions of the Software.
|
15
|
-
*
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
-
* THE SOFTWARE.
|
4
|
+
* This file is part of Rugged, distributed under the MIT license.
|
5
|
+
* For full terms see the included LICENSE file.
|
23
6
|
*/
|
24
7
|
|
25
8
|
#include "rugged.h"
|
data/ext/rugged/rugged_object.c
CHANGED
@@ -1,25 +1,8 @@
|
|
1
1
|
/*
|
2
|
-
*
|
2
|
+
* Copyright (C) the Rugged contributors. All rights reserved.
|
3
3
|
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
11
|
-
* furnished to do so, subject to the following conditions:
|
12
|
-
*
|
13
|
-
* The above copyright notice and this permission notice shall be included in
|
14
|
-
* all copies or substantial portions of the Software.
|
15
|
-
*
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
-
* THE SOFTWARE.
|
4
|
+
* This file is part of Rugged, distributed under the MIT license.
|
5
|
+
* For full terms see the included LICENSE file.
|
23
6
|
*/
|
24
7
|
|
25
8
|
#include "rugged.h"
|
data/ext/rugged/rugged_patch.c
CHANGED
@@ -1,25 +1,8 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
11
|
-
* furnished to do so, subject to the following conditions:
|
12
|
-
*
|
13
|
-
* The above copyright notice and this permission notice shall be included in
|
14
|
-
* all copies or substantial portions of the Software.
|
15
|
-
*
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
-
* THE SOFTWARE.
|
2
|
+
* Copyright (C) the Rugged contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of Rugged, distributed under the MIT license.
|
5
|
+
* For full terms see the included LICENSE file.
|
23
6
|
*/
|
24
7
|
|
25
8
|
#include "rugged.h"
|
@@ -173,21 +156,157 @@ static VALUE rb_git_diff_patch_stat(VALUE self)
|
|
173
156
|
return rb_ary_new3(2, INT2FIX(additions), INT2FIX(deletions));
|
174
157
|
}
|
175
158
|
|
159
|
+
enum {
|
160
|
+
EXCLUDE_CONTEXT = (1u << 0),
|
161
|
+
EXCLUDE_ADDITIONS = (1u << 1),
|
162
|
+
EXCLUDE_DELETIONS = (1u << 2),
|
163
|
+
EXCLUDE_EOFNL = (1u << 3)
|
164
|
+
};
|
165
|
+
|
166
|
+
/*
|
167
|
+
* call-seq:
|
168
|
+
* patch.lines(options = {}) -> int
|
169
|
+
*
|
170
|
+
* The following options can be passed in the +options+ Hash:
|
171
|
+
*
|
172
|
+
* :exclude_context ::
|
173
|
+
* Boolean value specifying that context line counts should be excluded from
|
174
|
+
* the returned total.
|
175
|
+
*
|
176
|
+
* :exclude_additions ::
|
177
|
+
* Boolean value specifying that addition line counts should be excluded from
|
178
|
+
* the returned total.
|
179
|
+
*
|
180
|
+
* :exclude_deletions ::
|
181
|
+
* Boolean value specifying that deletion line counts should be excluded from
|
182
|
+
* the returned total.
|
183
|
+
*
|
184
|
+
* :exclude_eofnl ::
|
185
|
+
* Boolean value specifying that end-of-file newline change lines should
|
186
|
+
* be excluded from the returned total.
|
187
|
+
*
|
188
|
+
* Returns the total number of lines in the patch, depending on the options
|
189
|
+
* specified.
|
190
|
+
*/
|
191
|
+
static VALUE rb_git_diff_patch_lines(int argc, VALUE *argv, VALUE self)
|
192
|
+
{
|
193
|
+
git_patch *patch;
|
194
|
+
size_t lines = 0;
|
195
|
+
int options = 0;
|
196
|
+
VALUE rb_options;
|
197
|
+
Data_Get_Struct(self, git_patch, patch);
|
198
|
+
|
199
|
+
rb_scan_args(argc, argv, "0:", &rb_options);
|
200
|
+
if (!NIL_P(rb_options)) {
|
201
|
+
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_context")))) {
|
202
|
+
options |= EXCLUDE_CONTEXT;
|
203
|
+
}
|
204
|
+
|
205
|
+
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_additions")))) {
|
206
|
+
options |= EXCLUDE_ADDITIONS;
|
207
|
+
}
|
208
|
+
|
209
|
+
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_deletions")))) {
|
210
|
+
options |= EXCLUDE_DELETIONS;
|
211
|
+
}
|
212
|
+
|
213
|
+
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_eofnl")))) {
|
214
|
+
options |= EXCLUDE_EOFNL;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
if (options == 0) {
|
219
|
+
size_t i = 0, hunks_count = git_patch_num_hunks(patch);
|
220
|
+
for (i = 0; i < hunks_count; ++i) {
|
221
|
+
lines += git_patch_num_lines_in_hunk(patch, i);
|
222
|
+
}
|
223
|
+
} else {
|
224
|
+
size_t i = 0, hunks_count = git_patch_num_hunks(patch);
|
225
|
+
for (i = 0; i < hunks_count; ++i) {
|
226
|
+
size_t lines_in_hunk = git_patch_num_lines_in_hunk(patch, i), l = 0;
|
227
|
+
|
228
|
+
for (l = 0; l < lines_in_hunk; ++l) {
|
229
|
+
const git_diff_line *line;
|
230
|
+
rugged_exception_check(
|
231
|
+
git_patch_get_line_in_hunk(&line, patch, i, l)
|
232
|
+
);
|
233
|
+
|
234
|
+
switch (line->origin) {
|
235
|
+
case GIT_DIFF_LINE_CONTEXT:
|
236
|
+
if (options & EXCLUDE_CONTEXT) continue;
|
237
|
+
break;
|
238
|
+
|
239
|
+
case GIT_DIFF_LINE_ADDITION:
|
240
|
+
if (options & EXCLUDE_ADDITIONS) continue;
|
241
|
+
break;
|
242
|
+
|
243
|
+
case GIT_DIFF_LINE_DELETION:
|
244
|
+
if (options & EXCLUDE_DELETIONS) continue;
|
245
|
+
break;
|
246
|
+
|
247
|
+
case GIT_DIFF_LINE_ADD_EOFNL:
|
248
|
+
case GIT_DIFF_LINE_DEL_EOFNL:
|
249
|
+
if (options & EXCLUDE_EOFNL) continue;
|
250
|
+
break;
|
251
|
+
}
|
252
|
+
|
253
|
+
lines += 1;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
return INT2FIX(lines);
|
259
|
+
}
|
260
|
+
|
176
261
|
/*
|
177
262
|
* call-seq:
|
178
|
-
* patch.
|
263
|
+
* patch.bytesize(options = {}) -> int
|
264
|
+
*
|
265
|
+
* The following options can be passed in the +options+ Hash:
|
179
266
|
*
|
180
|
-
*
|
267
|
+
* :exclude_context ::
|
268
|
+
* Boolean value specifying that context lines should be excluded when
|
269
|
+
* counting the number of bytes in the patch.
|
270
|
+
*
|
271
|
+
* :exclude_hunk_headers ::
|
272
|
+
* Boolean value specifying that hunk headers should be excluded when
|
273
|
+
* counting the number of bytes in the patch.
|
274
|
+
*
|
275
|
+
* :exclude_file_headers ::
|
276
|
+
* Boolean value specifying that file headers should be excluded when
|
277
|
+
* counting the number of bytes in the patch.
|
278
|
+
*
|
279
|
+
* Returns the number of bytes in the patch, depending on which options are
|
280
|
+
* specified.
|
181
281
|
*/
|
182
|
-
static VALUE
|
282
|
+
static VALUE rb_git_diff_patch_bytesize(int argc, VALUE *argv, VALUE self)
|
183
283
|
{
|
184
284
|
git_patch *patch;
|
185
|
-
size_t
|
285
|
+
size_t bytesize;
|
286
|
+
VALUE rb_options;
|
287
|
+
int include_context, include_hunk_headers, include_file_headers;
|
186
288
|
Data_Get_Struct(self, git_patch, patch);
|
187
289
|
|
188
|
-
|
290
|
+
include_context = include_hunk_headers = include_file_headers = 1;
|
189
291
|
|
190
|
-
|
292
|
+
rb_scan_args(argc, argv, "0:", &rb_options);
|
293
|
+
if (!NIL_P(rb_options)) {
|
294
|
+
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_context")))) {
|
295
|
+
include_context = 0;
|
296
|
+
}
|
297
|
+
|
298
|
+
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_hunk_headers")))) {
|
299
|
+
include_hunk_headers = 0;
|
300
|
+
}
|
301
|
+
|
302
|
+
if (RTEST(rb_hash_aref(rb_options, CSTR2SYM("exclude_file_headers")))) {
|
303
|
+
include_file_headers = 0;
|
304
|
+
}
|
305
|
+
}
|
306
|
+
|
307
|
+
bytesize = git_patch_size(patch, include_context, include_hunk_headers, include_file_headers);
|
308
|
+
|
309
|
+
return INT2FIX(bytesize);
|
191
310
|
}
|
192
311
|
|
193
312
|
static int patch_print_cb(
|
@@ -196,20 +315,36 @@ static int patch_print_cb(
|
|
196
315
|
const git_diff_line *line,
|
197
316
|
void *payload)
|
198
317
|
{
|
199
|
-
VALUE
|
318
|
+
VALUE rb_buffer = (VALUE)payload;
|
200
319
|
|
201
320
|
switch (line->origin) {
|
202
321
|
case GIT_DIFF_LINE_CONTEXT:
|
203
322
|
case GIT_DIFF_LINE_ADDITION:
|
204
323
|
case GIT_DIFF_LINE_DELETION:
|
205
|
-
|
324
|
+
rb_ary_push(rb_buffer, rb_str_new(&line->origin, 1));
|
206
325
|
}
|
207
326
|
|
208
|
-
|
327
|
+
rb_ary_push(rb_buffer, rb_str_new(line->content, line->content_len));
|
209
328
|
|
210
329
|
return GIT_OK;
|
211
330
|
}
|
212
331
|
|
332
|
+
static int patch_print_header_cb(
|
333
|
+
const git_diff_delta *delta,
|
334
|
+
const git_diff_hunk *hunk,
|
335
|
+
const git_diff_line *line,
|
336
|
+
void *payload)
|
337
|
+
{
|
338
|
+
VALUE rb_buffer = (VALUE)payload;
|
339
|
+
|
340
|
+
if (line->origin == GIT_DIFF_LINE_FILE_HDR) {
|
341
|
+
rb_ary_push(rb_buffer, rb_str_new(line->content, line->content_len));
|
342
|
+
return GIT_OK;
|
343
|
+
} else {
|
344
|
+
return GIT_ITEROVER;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
|
213
348
|
/*
|
214
349
|
* call-seq:
|
215
350
|
* patch.to_s -> str
|
@@ -219,14 +354,35 @@ static int patch_print_cb(
|
|
219
354
|
static VALUE rb_git_diff_patch_to_s(VALUE self)
|
220
355
|
{
|
221
356
|
git_patch *patch;
|
222
|
-
VALUE
|
357
|
+
VALUE rb_buffer = rb_ary_new();
|
223
358
|
Data_Get_Struct(self, git_patch, patch);
|
224
359
|
|
225
|
-
rugged_exception_check(git_patch_print(patch, patch_print_cb, (void*)
|
360
|
+
rugged_exception_check(git_patch_print(patch, patch_print_cb, (void*)rb_buffer));
|
226
361
|
|
227
|
-
return
|
362
|
+
return rb_ary_join(rb_buffer, Qnil);
|
228
363
|
}
|
229
364
|
|
365
|
+
/*
|
366
|
+
* call-seq:
|
367
|
+
* patch.header -> str
|
368
|
+
*
|
369
|
+
* Returns only the header of the patch as a string.
|
370
|
+
*/
|
371
|
+
static VALUE rb_git_diff_patch_header(VALUE self)
|
372
|
+
{
|
373
|
+
git_patch *patch;
|
374
|
+
int error = 0;
|
375
|
+
VALUE rb_buffer = rb_ary_new();
|
376
|
+
Data_Get_Struct(self, git_patch, patch);
|
377
|
+
|
378
|
+
error = git_patch_print(patch, patch_print_header_cb, (void*)rb_buffer);
|
379
|
+
if (error && error != GIT_ITEROVER)
|
380
|
+
rugged_exception_check(error);
|
381
|
+
|
382
|
+
return rb_ary_join(rb_buffer, Qnil);
|
383
|
+
}
|
384
|
+
|
385
|
+
|
230
386
|
void Init_rugged_patch(void)
|
231
387
|
{
|
232
388
|
rb_cRuggedPatch = rb_define_class_under(rb_mRugged, "Patch", rb_cObject);
|
@@ -234,10 +390,12 @@ void Init_rugged_patch(void)
|
|
234
390
|
rb_define_singleton_method(rb_cRuggedPatch, "from_strings", rb_git_patch_from_strings, -1);
|
235
391
|
|
236
392
|
rb_define_method(rb_cRuggedPatch, "stat", rb_git_diff_patch_stat, 0);
|
237
|
-
rb_define_method(rb_cRuggedPatch, "lines", rb_git_diff_patch_lines,
|
393
|
+
rb_define_method(rb_cRuggedPatch, "lines", rb_git_diff_patch_lines, -1);
|
394
|
+
rb_define_method(rb_cRuggedPatch, "bytesize", rb_git_diff_patch_bytesize, -1);
|
238
395
|
|
239
396
|
rb_define_method(rb_cRuggedPatch, "delta", rb_git_diff_patch_delta, 0);
|
240
397
|
|
398
|
+
rb_define_method(rb_cRuggedPatch, "header", rb_git_diff_patch_header, 0);
|
241
399
|
rb_define_method(rb_cRuggedPatch, "to_s", rb_git_diff_patch_to_s, 0);
|
242
400
|
|
243
401
|
rb_define_method(rb_cRuggedPatch, "each_hunk", rb_git_diff_patch_each_hunk, 0);
|