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/lib/rugged/remote.rb
CHANGED
data/lib/rugged/repository.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (C) the Rugged contributors. All rights reserved.
|
2
|
+
#
|
3
|
+
# This file is part of Rugged, distributed under the MIT license.
|
4
|
+
# For full terms see the included LICENSE file.
|
5
|
+
|
1
6
|
module Rugged
|
2
7
|
# Repository is an interface into a Git repository on-disk. It's the primary
|
3
8
|
# interface between your app and the main Git objects Rugged makes available
|
@@ -140,7 +145,7 @@ module Rugged
|
|
140
145
|
|
141
146
|
# All the tags in the repository.
|
142
147
|
#
|
143
|
-
# Returns
|
148
|
+
# Returns a TagCollection containing all the tags.
|
144
149
|
def tags
|
145
150
|
@tags ||= TagCollection.new(self)
|
146
151
|
end
|
@@ -155,14 +160,14 @@ module Rugged
|
|
155
160
|
|
156
161
|
# All the branches in the repository
|
157
162
|
#
|
158
|
-
# Returns
|
163
|
+
# Returns a BranchCollection containing Rugged::Branch objects
|
159
164
|
def branches
|
160
165
|
@branches ||= BranchCollection.new(self)
|
161
166
|
end
|
162
167
|
|
163
168
|
# All the submodules in the repository
|
164
169
|
#
|
165
|
-
# Returns
|
170
|
+
# Returns a SubmoduleCollection containing Rugged::Submodule objects
|
166
171
|
def submodules
|
167
172
|
@submodules ||= SubmoduleCollection.new(self)
|
168
173
|
end
|
@@ -190,7 +195,7 @@ module Rugged
|
|
190
195
|
# revision - The String SHA1.
|
191
196
|
# path - The String file path.
|
192
197
|
#
|
193
|
-
# Returns a
|
198
|
+
# Returns a Rugged::Blob object
|
194
199
|
def blob_at(revision, path)
|
195
200
|
tree = Rugged::Commit.lookup(self, revision).tree
|
196
201
|
begin
|
data/lib/rugged/tag.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (C) the Rugged contributors. All rights reserved.
|
2
|
+
#
|
3
|
+
# This file is part of Rugged, distributed under the MIT license.
|
4
|
+
# For full terms see the included LICENSE file.
|
5
|
+
|
1
6
|
module Rugged
|
2
7
|
class Tag < Rugged::Reference
|
3
8
|
GPG_SIGNATURE_PREFIX = "-----BEGIN PGP SIGNATURE-----".freeze
|
data/lib/rugged/tree.rb
CHANGED
@@ -1,5 +1,160 @@
|
|
1
|
+
# Copyright (C) the Rugged contributors. All rights reserved.
|
2
|
+
#
|
3
|
+
# This file is part of Rugged, distributed under the MIT license.
|
4
|
+
# For full terms see the included LICENSE file.
|
5
|
+
|
1
6
|
module Rugged
|
2
7
|
class Tree
|
8
|
+
##
|
9
|
+
# call-seq:
|
10
|
+
# Tree.diff(repo, tree, diffable[, options]) -> diff
|
11
|
+
#
|
12
|
+
# Returns a diff between the `tree` and the diffable object that was given.
|
13
|
+
# +diffable+ can either be a +Rugged::Commit+, a +Rugged::Tree+, a +Rugged::Index+,
|
14
|
+
# or +nil+.
|
15
|
+
#
|
16
|
+
# The +tree+ object will be used as the "old file" side of the diff, while the
|
17
|
+
# parent tree or the +diffable+ object will be used for the "new file" side.
|
18
|
+
#
|
19
|
+
# If +tree+ or +diffable+ are nil, they will be treated as an empty tree. Passing
|
20
|
+
# both as `nil` will raise an exception.
|
21
|
+
#
|
22
|
+
# The following options can be passed in the +options+ Hash:
|
23
|
+
#
|
24
|
+
# :paths ::
|
25
|
+
# An array of paths / fnmatch patterns to constrain the diff to a specific
|
26
|
+
# set of files. Also see +:disable_pathspec_match+.
|
27
|
+
#
|
28
|
+
# :max_size ::
|
29
|
+
# An integer specifying the maximum byte size of a file before a it will
|
30
|
+
# be treated as binary. The default value is 512MB.
|
31
|
+
#
|
32
|
+
# :context_lines ::
|
33
|
+
# The number of unchanged lines that define the boundary of a hunk (and
|
34
|
+
# to display before and after the actual changes). The default is 3.
|
35
|
+
#
|
36
|
+
# :interhunk_lines ::
|
37
|
+
# The maximum number of unchanged lines between hunk boundaries before the hunks
|
38
|
+
# will be merged into a one. The default is 0.
|
39
|
+
#
|
40
|
+
# :old_prefix ::
|
41
|
+
# The virtual "directory" to prefix to old filenames in hunk headers.
|
42
|
+
# The default is "a".
|
43
|
+
#
|
44
|
+
# :new_prefix ::
|
45
|
+
# The virtual "directory" to prefix to new filenames in hunk headers.
|
46
|
+
# The default is "b".
|
47
|
+
#
|
48
|
+
# :reverse ::
|
49
|
+
# If true, the sides of the diff will be reversed.
|
50
|
+
#
|
51
|
+
# :force_text ::
|
52
|
+
# If true, all files will be treated as text, disabling binary attributes & detection.
|
53
|
+
#
|
54
|
+
# :ignore_whitespace ::
|
55
|
+
# If true, all whitespace will be ignored.
|
56
|
+
#
|
57
|
+
# :ignore_whitespace_change ::
|
58
|
+
# If true, changes in amount of whitespace will be ignored.
|
59
|
+
#
|
60
|
+
# :ignore_whitespace_eol ::
|
61
|
+
# If true, whitespace at end of line will be ignored.
|
62
|
+
#
|
63
|
+
# :ignore_submodules ::
|
64
|
+
# if true, submodules will be excluded from the diff completely.
|
65
|
+
#
|
66
|
+
# :patience ::
|
67
|
+
# If true, the "patience diff" algorithm will be used (currenlty unimplemented).
|
68
|
+
#
|
69
|
+
# :include_ignored ::
|
70
|
+
# If true, ignored files will be included in the diff.
|
71
|
+
#
|
72
|
+
# :include_untracked ::
|
73
|
+
# If true, untracked files will be included in the diff.
|
74
|
+
#
|
75
|
+
# :include_unmodified ::
|
76
|
+
# If true, unmodified files will be included in the diff.
|
77
|
+
#
|
78
|
+
# :recurse_untracked_dirs ::
|
79
|
+
# Even if +:include_untracked+ is true, untracked directories will only be
|
80
|
+
# marked with a single entry in the diff. If this flag is set to true,
|
81
|
+
# all files under ignored directories will be included in the diff, too.
|
82
|
+
#
|
83
|
+
# :disable_pathspec_match ::
|
84
|
+
# If true, the given +:paths+ will be applied as exact matches, instead of
|
85
|
+
# as fnmatch patterns.
|
86
|
+
#
|
87
|
+
# :deltas_are_icase ::
|
88
|
+
# If true, filename comparisons will be made with case-insensitivity.
|
89
|
+
#
|
90
|
+
# :include_untracked_content ::
|
91
|
+
# if true, untracked content will be contained in the the diff patch text.
|
92
|
+
#
|
93
|
+
# :skip_binary_check ::
|
94
|
+
# If true, diff deltas will be generated without spending time on binary
|
95
|
+
# detection. This is useful to improve performance in cases where the actual
|
96
|
+
# file content difference is not needed.
|
97
|
+
#
|
98
|
+
# :include_typechange ::
|
99
|
+
# If true, type changes for files will not be interpreted as deletion of
|
100
|
+
# the "old file" and addition of the "new file", but will generate
|
101
|
+
# typechange records.
|
102
|
+
#
|
103
|
+
# :include_typechange_trees ::
|
104
|
+
# Even if +:include_typechange+ is true, blob -> tree changes will still
|
105
|
+
# usually be handled as a deletion of the blob. If this flag is set to true,
|
106
|
+
# blob -> tree changes will be marked as typechanges.
|
107
|
+
#
|
108
|
+
# :ignore_filemode ::
|
109
|
+
# If true, file mode changes will be ignored.
|
110
|
+
#
|
111
|
+
# :recurse_ignored_dirs ::
|
112
|
+
# Even if +:include_ignored+ is true, ignored directories will only be
|
113
|
+
# marked with a single entry in the diff. If this flag is set to true,
|
114
|
+
# all files under ignored directories will be included in the diff, too.
|
115
|
+
#
|
116
|
+
# Examples:
|
117
|
+
#
|
118
|
+
# # Emulating `git diff <treeish>`
|
119
|
+
# tree = Rugged::Tree.lookup(repo, "d70d245ed97ed2aa596dd1af6536e4bfdb047b69")
|
120
|
+
# diff = tree.diff(repo.index)
|
121
|
+
# diff.merge!(tree.diff)
|
122
|
+
#
|
123
|
+
# # Tree-to-Tree Diff
|
124
|
+
# tree = Rugged::Tree.lookup(repo, "d70d245ed97ed2aa596dd1af6536e4bfdb047b69")
|
125
|
+
# other_tree = Rugged::Tree.lookup(repo, "7a9e0b02e63179929fed24f0a3e0f19168114d10")
|
126
|
+
# diff = tree.diff(other_tree)
|
127
|
+
#
|
128
|
+
|
129
|
+
def self.diff(repo, tree, other_tree = nil, options = {})
|
130
|
+
if tree && !tree.is_a?(Rugged::Tree)
|
131
|
+
raise TypeError, "At least a Rugged::Tree object is required for diffing"
|
132
|
+
end
|
133
|
+
|
134
|
+
if other_tree.nil?
|
135
|
+
if tree.nil?
|
136
|
+
raise TypeError, "Need 'old' or 'new' for diffing"
|
137
|
+
else
|
138
|
+
diff_tree_to_tree repo, tree, nil, options
|
139
|
+
end
|
140
|
+
else
|
141
|
+
if other_tree.is_a?(::String)
|
142
|
+
other_tree = Rugged::Object.rev_parse repo, other_tree
|
143
|
+
end
|
144
|
+
|
145
|
+
case other_tree
|
146
|
+
when Rugged::Commit
|
147
|
+
diff_tree_to_tree repo, tree, other_tree.tree, options
|
148
|
+
when Rugged::Tree
|
149
|
+
diff_tree_to_tree repo, tree, other_tree, options
|
150
|
+
when Rugged::Index
|
151
|
+
diff_tree_to_index repo, tree, other_tree, options
|
152
|
+
else
|
153
|
+
raise TypeError, "A Rugged::Commit, Rugged::Tree or Rugged::Index instance is required"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
3
158
|
include Enumerable
|
4
159
|
|
5
160
|
attr_reader :owner
|
@@ -30,7 +185,7 @@ module Rugged
|
|
30
185
|
self.each { |e| yield e if e[:type] == :blob }
|
31
186
|
end
|
32
187
|
|
33
|
-
#
|
188
|
+
# Iterate over the subtrees in this tree
|
34
189
|
def each_tree
|
35
190
|
self.each { |e| yield e if e[:type] == :tree }
|
36
191
|
end
|
data/lib/rugged/version.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# Copyright (C) the Rugged contributors. All rights reserved.
|
2
|
+
#
|
3
|
+
# This file is part of Rugged, distributed under the MIT license.
|
4
|
+
# For full terms see the included LICENSE file.
|
5
|
+
|
1
6
|
module Rugged
|
2
|
-
Version = VERSION = '0.
|
7
|
+
Version = VERSION = '0.25.0'
|
3
8
|
end
|
data/lib/rugged/walker.rb
CHANGED
data/lib/rugged.rb
CHANGED
@@ -20,6 +20,7 @@ SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Mo
|
|
20
20
|
|
21
21
|
INCLUDE(CheckLibraryExists)
|
22
22
|
INCLUDE(CheckFunctionExists)
|
23
|
+
INCLUDE(CheckSymbolExists)
|
23
24
|
INCLUDE(CheckStructHasMember)
|
24
25
|
INCLUDE(AddCFlagIfSupported)
|
25
26
|
INCLUDE(FindPkgConfig)
|
@@ -109,7 +110,7 @@ ELSE ()
|
|
109
110
|
ENDIF()
|
110
111
|
|
111
112
|
IF (HAVE_STRUCT_STAT_NSEC OR WIN32)
|
112
|
-
OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes"
|
113
|
+
OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" ON )
|
113
114
|
ENDIF()
|
114
115
|
|
115
116
|
# This variable will contain the libraries we need to put into
|
@@ -507,6 +508,11 @@ ELSE ()
|
|
507
508
|
ENDIF ()
|
508
509
|
ENDIF()
|
509
510
|
|
511
|
+
CHECK_SYMBOL_EXISTS(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
|
512
|
+
IF (HAVE_REGCOMP_L)
|
513
|
+
ADD_DEFINITIONS(-DHAVE_REGCOMP_L)
|
514
|
+
ENDIF ()
|
515
|
+
|
510
516
|
CHECK_FUNCTION_EXISTS(futimens HAVE_FUTIMENS)
|
511
517
|
IF (HAVE_FUTIMENS)
|
512
518
|
ADD_DEFINITIONS(-DHAVE_FUTIMENS)
|
@@ -589,8 +595,10 @@ IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
589
595
|
ADD_DEFINITIONS(-DGIT_ARCH_64)
|
590
596
|
ELSEIF (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
591
597
|
ADD_DEFINITIONS(-DGIT_ARCH_32)
|
598
|
+
ELSEIF (CMAKE_SIZEOF_VOID_P)
|
599
|
+
MESSAGE(FATAL_ERROR "Unsupported architecture (pointer size is ${CMAKE_SIZEOF_VOID_P} bytes)")
|
592
600
|
ELSE()
|
593
|
-
MESSAGE(FATAL_ERROR "Unsupported architecture")
|
601
|
+
MESSAGE(FATAL_ERROR "Unsupported architecture (CMAKE_SIZEOF_VOID_P is unset)")
|
594
602
|
ENDIF()
|
595
603
|
|
596
604
|
# Compile and link libgit2
|
@@ -697,6 +705,8 @@ IF (BUILD_CLAR)
|
|
697
705
|
# Add a test target which runs the cred callback tests, to be
|
698
706
|
# called after setting the url and user
|
699
707
|
ADD_TEST(libgit2_clar-cred_callback libgit2_clar -v -sonline::clone::cred_callback)
|
708
|
+
ADD_TEST(libgit2_clar-proxy_credentials_in_url libgit2_clar -v -sonline::clone::proxy_credentials_in_url)
|
709
|
+
ADD_TEST(libgit2_clar-proxy_credentials_request libgit2_clar -v -sonline::clone::proxy_credentials_request)
|
700
710
|
ENDIF ()
|
701
711
|
|
702
712
|
IF (TAGS)
|
@@ -150,46 +150,48 @@ GIT_EXTERN(int) git_blob_create_fromworkdir(git_oid *id, git_repository *repo, c
|
|
150
150
|
*/
|
151
151
|
GIT_EXTERN(int) git_blob_create_fromdisk(git_oid *id, git_repository *repo, const char *path);
|
152
152
|
|
153
|
-
|
154
|
-
typedef int (*git_blob_chunk_cb)(char *content, size_t max_length, void *payload);
|
155
|
-
|
156
153
|
/**
|
157
|
-
*
|
158
|
-
*
|
154
|
+
* Create a stream to write a new blob into the object db
|
155
|
+
*
|
156
|
+
* This function may need to buffer the data on disk and will in
|
157
|
+
* general not be the right choice if you know the size of the data
|
158
|
+
* to write. If you have data in memory, use
|
159
|
+
* `git_blob_create_frombuffer()`. If you do not, but know the size of
|
160
|
+
* the contents (and don't want/need to perform filtering), use
|
161
|
+
* `git_odb_open_wstream()`.
|
162
|
+
*
|
163
|
+
* Don't close this stream yourself but pass it to
|
164
|
+
* `git_blob_create_fromstream_commit()` to commit the write to the
|
165
|
+
* object db and get the object id.
|
159
166
|
*
|
160
167
|
* If the `hintpath` parameter is filled, it will be used to determine
|
161
168
|
* what git filters should be applied to the object before it is written
|
162
169
|
* to the object database.
|
163
170
|
*
|
164
|
-
*
|
165
|
-
*
|
166
|
-
* - `content` must be filled by the callback. The maximum number of
|
167
|
-
* bytes that the buffer can accept per call is defined by the
|
168
|
-
* `max_length` parameter. Allocation and freeing of the buffer will
|
169
|
-
* be taken care of by libgit2.
|
170
|
-
*
|
171
|
-
* - The `callback` must return the number of bytes that have been
|
172
|
-
* written to the `content` buffer.
|
173
|
-
*
|
174
|
-
* - When there is no more data to stream, `callback` should return 0.
|
175
|
-
* This will prevent it from being invoked anymore.
|
176
|
-
*
|
177
|
-
* - If an error occurs, the callback should return a negative value.
|
178
|
-
* This value will be returned to the caller.
|
179
|
-
*
|
180
|
-
* @param id Return the id of the written blob
|
171
|
+
* @param out the stream into which to write
|
181
172
|
* @param repo Repository where the blob will be written.
|
182
173
|
* This repository can be bare or not.
|
183
174
|
* @param hintpath If not NULL, will be used to select data filters
|
184
175
|
* to apply onto the content of the blob to be created.
|
185
|
-
* @return 0 or error code
|
176
|
+
* @return 0 or error code
|
186
177
|
*/
|
187
|
-
GIT_EXTERN(int)
|
188
|
-
|
178
|
+
GIT_EXTERN(int) git_blob_create_fromstream(
|
179
|
+
git_writestream **out,
|
189
180
|
git_repository *repo,
|
190
|
-
const char *hintpath
|
191
|
-
|
192
|
-
|
181
|
+
const char *hintpath);
|
182
|
+
|
183
|
+
/**
|
184
|
+
* Close the stream and write the blob to the object db
|
185
|
+
*
|
186
|
+
* The stream will be closed and freed.
|
187
|
+
*
|
188
|
+
* @param out the id of the new blob
|
189
|
+
* @param stream the stream to close
|
190
|
+
* @return 0 or an error code
|
191
|
+
*/
|
192
|
+
GIT_EXTERN(int) git_blob_create_fromstream_commit(
|
193
|
+
git_oid *out,
|
194
|
+
git_writestream *stream);
|
193
195
|
|
194
196
|
/**
|
195
197
|
* Write an in-memory buffer to the ODB as a blob
|
@@ -216,6 +218,15 @@ GIT_EXTERN(int) git_blob_create_frombuffer(
|
|
216
218
|
*/
|
217
219
|
GIT_EXTERN(int) git_blob_is_binary(const git_blob *blob);
|
218
220
|
|
221
|
+
/**
|
222
|
+
* Create an in-memory copy of a blob. The copy must be explicitly
|
223
|
+
* free'd or it will leak.
|
224
|
+
*
|
225
|
+
* @param out Pointer to store the copy of the object
|
226
|
+
* @param source Original object to copy
|
227
|
+
*/
|
228
|
+
GIT_EXTERN(int) git_blob_dup(git_blob **out, git_blob *source);
|
229
|
+
|
219
230
|
/** @} */
|
220
231
|
GIT_END_DECL
|
221
232
|
#endif
|
@@ -394,6 +394,82 @@ GIT_EXTERN(int) git_commit_amend(
|
|
394
394
|
const char *message,
|
395
395
|
const git_tree *tree);
|
396
396
|
|
397
|
+
/**
|
398
|
+
* Create a commit and write it into a buffer
|
399
|
+
*
|
400
|
+
* Create a commit as with `git_commit_create()` but instead of
|
401
|
+
* writing it to the objectdb, write the contents of the object into a
|
402
|
+
* buffer.
|
403
|
+
*
|
404
|
+
* @param out the buffer into which to write the commit object content
|
405
|
+
*
|
406
|
+
* @param repo Repository where the referenced tree and parents live
|
407
|
+
*
|
408
|
+
* @param author Signature with author and author time of commit
|
409
|
+
*
|
410
|
+
* @param committer Signature with committer and * commit time of commit
|
411
|
+
*
|
412
|
+
* @param message_encoding The encoding for the message in the
|
413
|
+
* commit, represented with a standard encoding name.
|
414
|
+
* E.g. "UTF-8". If NULL, no encoding header is written and
|
415
|
+
* UTF-8 is assumed.
|
416
|
+
*
|
417
|
+
* @param message Full message for this commit
|
418
|
+
*
|
419
|
+
* @param tree An instance of a `git_tree` object that will
|
420
|
+
* be used as the tree for the commit. This tree object must
|
421
|
+
* also be owned by the given `repo`.
|
422
|
+
*
|
423
|
+
* @param parent_count Number of parents for this commit
|
424
|
+
*
|
425
|
+
* @param parents Array of `parent_count` pointers to `git_commit`
|
426
|
+
* objects that will be used as the parents for this commit. This
|
427
|
+
* array may be NULL if `parent_count` is 0 (root commit). All the
|
428
|
+
* given commits must be owned by the `repo`.
|
429
|
+
*
|
430
|
+
* @return 0 or an error code
|
431
|
+
*/
|
432
|
+
GIT_EXTERN(int) git_commit_create_buffer(
|
433
|
+
git_buf *out,
|
434
|
+
git_repository *repo,
|
435
|
+
const git_signature *author,
|
436
|
+
const git_signature *committer,
|
437
|
+
const char *message_encoding,
|
438
|
+
const char *message,
|
439
|
+
const git_tree *tree,
|
440
|
+
size_t parent_count,
|
441
|
+
const git_commit *parents[]);
|
442
|
+
|
443
|
+
/**
|
444
|
+
* Create a commit object from the given buffer and signature
|
445
|
+
*
|
446
|
+
* Given the unsigned commit object's contents, its signature and the
|
447
|
+
* header field in which to store the signature, attach the signature
|
448
|
+
* to the commit and write it into the given repository.
|
449
|
+
*
|
450
|
+
* @param out the resulting commit id
|
451
|
+
* @param commit_content the content of the unsigned commit object
|
452
|
+
* @param signature the signature to add to the commit
|
453
|
+
* @param signature_field which header field should contain this
|
454
|
+
* signature. Leave `NULL` for the default of "gpgsig"
|
455
|
+
* @return 0 or an error code
|
456
|
+
*/
|
457
|
+
GIT_EXTERN(int) git_commit_create_with_signature(
|
458
|
+
git_oid *out,
|
459
|
+
git_repository *repo,
|
460
|
+
const char *commit_content,
|
461
|
+
const char *signature,
|
462
|
+
const char *signature_field);
|
463
|
+
|
464
|
+
/**
|
465
|
+
* Create an in-memory copy of a commit. The copy must be explicitly
|
466
|
+
* free'd or it will leak.
|
467
|
+
*
|
468
|
+
* @param out Pointer to store the copy of the commit
|
469
|
+
* @param source Original commit to copy
|
470
|
+
*/
|
471
|
+
GIT_EXTERN(int) git_commit_dup(git_commit **out, git_commit *source);
|
472
|
+
|
397
473
|
/** @} */
|
398
474
|
GIT_END_DECL
|
399
475
|
#endif
|
@@ -109,9 +109,27 @@ GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
|
|
109
109
|
* was compiled
|
110
110
|
*/
|
111
111
|
typedef enum {
|
112
|
+
/**
|
113
|
+
* If set, libgit2 was built thread-aware and can be safely used from multiple
|
114
|
+
* threads.
|
115
|
+
*/
|
112
116
|
GIT_FEATURE_THREADS = (1 << 0),
|
117
|
+
/**
|
118
|
+
* If set, libgit2 was built with and linked against a TLS implementation.
|
119
|
+
* Custom TLS streams may still be added by the user to support HTTPS
|
120
|
+
* regardless of this.
|
121
|
+
*/
|
113
122
|
GIT_FEATURE_HTTPS = (1 << 1),
|
123
|
+
/**
|
124
|
+
* If set, libgit2 was built with and linked against libssh2. A custom
|
125
|
+
* transport may still be added by the user to support libssh2 regardless of
|
126
|
+
* this.
|
127
|
+
*/
|
114
128
|
GIT_FEATURE_SSH = (1 << 2),
|
129
|
+
/**
|
130
|
+
* If set, libgit2 was built with support for sub-second resolution in file
|
131
|
+
* modification times.
|
132
|
+
*/
|
115
133
|
GIT_FEATURE_NSEC = (1 << 3),
|
116
134
|
} git_feature_t;
|
117
135
|
|
@@ -158,6 +176,7 @@ typedef enum {
|
|
158
176
|
GIT_OPT_SET_USER_AGENT,
|
159
177
|
GIT_OPT_ENABLE_STRICT_OBJECT_CREATION,
|
160
178
|
GIT_OPT_SET_SSL_CIPHERS,
|
179
|
+
GIT_OPT_GET_USER_AGENT,
|
161
180
|
} git_libgit2_opt_t;
|
162
181
|
|
163
182
|
/**
|
@@ -268,7 +287,8 @@ typedef enum {
|
|
268
287
|
* > to ensure that all inputs to the new objects are valid. For
|
269
288
|
* > example, when this is enabled, the parent(s) and tree inputs
|
270
289
|
* > will be validated when creating a new commit. This defaults
|
271
|
-
* > to
|
290
|
+
* > to enabled.
|
291
|
+
*
|
272
292
|
* * opts(GIT_OPT_SET_SSL_CIPHERS, const char *ciphers)
|
273
293
|
*
|
274
294
|
* > Set the SSL ciphers use for HTTPS connections.
|
@@ -44,8 +44,8 @@ typedef enum {
|
|
44
44
|
typedef struct git_describe_options {
|
45
45
|
unsigned int version;
|
46
46
|
|
47
|
-
unsigned int max_candidates_tags;
|
48
|
-
unsigned int describe_strategy;
|
47
|
+
unsigned int max_candidates_tags; /**< default: 10 */
|
48
|
+
unsigned int describe_strategy; /**< default: GIT_DESCRIBE_DEFAULT */
|
49
49
|
const char *pattern;
|
50
50
|
/**
|
51
51
|
* When calculating the distance from the matching tag or
|
@@ -105,6 +105,9 @@ typedef struct {
|
|
105
105
|
|
106
106
|
GIT_EXTERN(int) git_describe_init_format_options(git_describe_format_options *opts, unsigned int version);
|
107
107
|
|
108
|
+
/**
|
109
|
+
* A struct that stores the result of a describe operation.
|
110
|
+
*/
|
108
111
|
typedef struct git_describe_result git_describe_result;
|
109
112
|
|
110
113
|
/**
|
@@ -264,7 +264,7 @@ typedef enum {
|
|
264
264
|
* link, a submodule commit id, or even a tree (although that only if you
|
265
265
|
* are tracking type changes or ignored/untracked directories).
|
266
266
|
*
|
267
|
-
* The `
|
267
|
+
* The `id` is the `git_oid` of the item. If the entry represents an
|
268
268
|
* absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
|
269
269
|
* then the oid will be zeroes.
|
270
270
|
*
|
@@ -277,6 +277,11 @@ typedef enum {
|
|
277
277
|
*
|
278
278
|
* `mode` is, roughly, the stat() `st_mode` value for the item. This will
|
279
279
|
* be restricted to one of the `git_filemode_t` values.
|
280
|
+
*
|
281
|
+
* The `id_abbrev` represents the known length of the `id` field, when
|
282
|
+
* converted to a hex string. It is generally `GIT_OID_HEXSZ`, unless this
|
283
|
+
* delta was created from reading a patch file, in which case it may be
|
284
|
+
* abbreviated to something reasonable, like 7 characters.
|
280
285
|
*/
|
281
286
|
typedef struct {
|
282
287
|
git_oid id;
|
@@ -284,6 +289,7 @@ typedef struct {
|
|
284
289
|
git_off_t size;
|
285
290
|
uint32_t flags;
|
286
291
|
uint16_t mode;
|
292
|
+
uint16_t id_abbrev;
|
287
293
|
} git_diff_file;
|
288
294
|
|
289
295
|
/**
|
@@ -448,6 +454,8 @@ typedef int (*git_diff_file_cb)(
|
|
448
454
|
float progress,
|
449
455
|
void *payload);
|
450
456
|
|
457
|
+
#define GIT_DIFF_HUNK_HEADER_SIZE 128
|
458
|
+
|
451
459
|
/**
|
452
460
|
* When producing a binary diff, the binary data returned will be
|
453
461
|
* either the deflated full ("literal") contents of the file, or
|
@@ -482,6 +490,14 @@ typedef struct {
|
|
482
490
|
|
483
491
|
/** Structure describing the binary contents of a diff. */
|
484
492
|
typedef struct {
|
493
|
+
/**
|
494
|
+
* Whether there is data in this binary structure or not. If this
|
495
|
+
* is `1`, then this was produced and included binary content. If
|
496
|
+
* this is `0` then this was generated knowing only that a binary
|
497
|
+
* file changed but without providing the data, probably from a patch
|
498
|
+
* that said `Binary files a/file.txt and b/file.txt differ`.
|
499
|
+
*/
|
500
|
+
unsigned int contains_data;
|
485
501
|
git_diff_binary_file old_file; /**< The contents of the old file. */
|
486
502
|
git_diff_binary_file new_file; /**< The contents of the new file. */
|
487
503
|
} git_diff_binary;
|
@@ -499,12 +515,12 @@ typedef int(*git_diff_binary_cb)(
|
|
499
515
|
* Structure describing a hunk of a diff.
|
500
516
|
*/
|
501
517
|
typedef struct {
|
502
|
-
int old_start;
|
503
|
-
int old_lines;
|
504
|
-
int new_start;
|
505
|
-
int new_lines;
|
506
|
-
size_t header_len;
|
507
|
-
char header[
|
518
|
+
int old_start; /** Starting line number in old_file */
|
519
|
+
int old_lines; /** Number of lines in old_file */
|
520
|
+
int new_start; /** Starting line number in new_file */
|
521
|
+
int new_lines; /** Number of lines in new_file */
|
522
|
+
size_t header_len; /** Number of bytes in header text */
|
523
|
+
char header[GIT_DIFF_HUNK_HEADER_SIZE]; /** Header text, NUL-byte terminated */
|
508
524
|
} git_diff_hunk;
|
509
525
|
|
510
526
|
/**
|
@@ -1046,6 +1062,21 @@ GIT_EXTERN(int) git_diff_print(
|
|
1046
1062
|
git_diff_line_cb print_cb,
|
1047
1063
|
void *payload);
|
1048
1064
|
|
1065
|
+
/**
|
1066
|
+
* Produce the complete formatted text output from a diff into a
|
1067
|
+
* buffer.
|
1068
|
+
*
|
1069
|
+
* @param out A pointer to a user-allocated git_buf that will
|
1070
|
+
* contain the diff text
|
1071
|
+
* @param diff A git_diff generated by one of the above functions.
|
1072
|
+
* @param format A git_diff_format_t value to pick the text format.
|
1073
|
+
* @return 0 on success or error code
|
1074
|
+
*/
|
1075
|
+
GIT_EXTERN(int) git_diff_to_buf(
|
1076
|
+
git_buf *out,
|
1077
|
+
git_diff *diff,
|
1078
|
+
git_diff_format_t format);
|
1079
|
+
|
1049
1080
|
/**@}*/
|
1050
1081
|
|
1051
1082
|
|
@@ -1166,6 +1197,30 @@ GIT_EXTERN(int) git_diff_buffers(
|
|
1166
1197
|
git_diff_line_cb line_cb,
|
1167
1198
|
void *payload);
|
1168
1199
|
|
1200
|
+
/**
|
1201
|
+
* Read the contents of a git patch file into a `git_diff` object.
|
1202
|
+
*
|
1203
|
+
* The diff object produced is similar to the one that would be
|
1204
|
+
* produced if you actually produced it computationally by comparing
|
1205
|
+
* two trees, however there may be subtle differences. For example,
|
1206
|
+
* a patch file likely contains abbreviated object IDs, so the
|
1207
|
+
* object IDs in a `git_diff_delta` produced by this function will
|
1208
|
+
* also be abbreviated.
|
1209
|
+
*
|
1210
|
+
* This function will only read patch files created by a git
|
1211
|
+
* implementation, it will not read unified diffs produced by
|
1212
|
+
* the `diff` program, nor any other types of patch files.
|
1213
|
+
*
|
1214
|
+
* @param out A pointer to a git_diff pointer that will be allocated.
|
1215
|
+
* @param content The contents of a patch file
|
1216
|
+
* @param content_len The length of the patch file contents
|
1217
|
+
* @return 0 or an error code
|
1218
|
+
*/
|
1219
|
+
GIT_EXTERN(int) git_diff_from_buffer(
|
1220
|
+
git_diff **out,
|
1221
|
+
const char *content,
|
1222
|
+
size_t content_len);
|
1223
|
+
|
1169
1224
|
/**
|
1170
1225
|
* This is an opaque structure which is allocated by `git_diff_get_stats`.
|
1171
1226
|
* You are responsible for releasing the object memory when done, using the
|