jit 1.0.3 → 1.0.4
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/lib/command/diff.rb +11 -11
- data/lib/command/log.rb +3 -19
- data/lib/command/receive_pack.rb +3 -0
- data/lib/command/shared/print_diff.rb +22 -0
- data/lib/command/shared/receive_objects.rb +1 -0
- data/lib/database.rb +1 -1
- data/lib/database/backends.rb +6 -1
- data/lib/database/packed.rb +1 -4
- data/lib/pack.rb +1 -0
- data/lib/pack/compressor.rb +2 -2
- data/lib/pack/index.rb +1 -1
- data/lib/refs.rb +2 -1
- data/lib/revision.rb +1 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a23448f0810b2084307896eb1e1406b86b24c04c579a47d685da99d71ca35a3a
|
4
|
+
data.tar.gz: f36e92883aeb81d4ab383e47d74047b9c508c0f8b83db2e630749cf32967230a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ea0e84691e98799b8cdd265aad34829580bfe248c934ddbc6ff24bb5c008029d07a1935471b05abec87d0568e0cc6a562279285157fc794f420a9847dd09eb7
|
7
|
+
data.tar.gz: 1e1b050921161d866dd2e0f42a57a6b7b0b432f930c86eae29f77d608fad121fb4851f4a07d11dff0c76d8b98402261750347907255123b00102238478f2859a
|
data/lib/command/diff.rb
CHANGED
@@ -27,6 +27,8 @@ module Command
|
|
27
27
|
|
28
28
|
if @options[:cached]
|
29
29
|
diff_head_index
|
30
|
+
elsif @args.size == 2
|
31
|
+
diff_commits
|
30
32
|
else
|
31
33
|
diff_index_workspace
|
32
34
|
end
|
@@ -36,6 +38,13 @@ module Command
|
|
36
38
|
|
37
39
|
private
|
38
40
|
|
41
|
+
def diff_commits
|
42
|
+
return unless @options[:patch]
|
43
|
+
|
44
|
+
a, b = @args.map { |rev| Revision.new(repo, rev).resolve }
|
45
|
+
print_commit_diff(a, b)
|
46
|
+
end
|
47
|
+
|
39
48
|
def diff_head_index
|
40
49
|
return unless @options[:patch]
|
41
50
|
|
@@ -85,17 +94,12 @@ module Command
|
|
85
94
|
|
86
95
|
def from_head(path)
|
87
96
|
entry = @status.head_tree.fetch(path)
|
88
|
-
|
89
|
-
|
90
|
-
Target.new(path, entry.oid, entry.mode.to_s(8), blob.data)
|
97
|
+
from_entry(path, entry)
|
91
98
|
end
|
92
99
|
|
93
100
|
def from_index(path, stage = 0)
|
94
101
|
entry = repo.index.entry_for_path(path, stage)
|
95
|
-
|
96
|
-
|
97
|
-
blob = repo.database.load(entry.oid)
|
98
|
-
Target.new(path, entry.oid, entry.mode.to_s(8), blob.data)
|
102
|
+
entry ? from_entry(path, entry) : nil
|
99
103
|
end
|
100
104
|
|
101
105
|
def from_file(path)
|
@@ -106,9 +110,5 @@ module Command
|
|
106
110
|
Target.new(path, oid, mode.to_s(8), blob.data)
|
107
111
|
end
|
108
112
|
|
109
|
-
def from_nothing(path)
|
110
|
-
Target.new(path, NULL_OID, nil, "")
|
111
|
-
end
|
112
|
-
|
113
113
|
end
|
114
114
|
end
|
data/lib/command/log.rb
CHANGED
@@ -145,15 +145,8 @@ module Command
|
|
145
145
|
return unless @options[:patch]
|
146
146
|
return show_merge_patch(commit) if commit.merge?
|
147
147
|
|
148
|
-
diff = @rev_list.tree_diff(commit.parent, commit.oid)
|
149
|
-
paths = diff.keys.sort_by(&:to_s)
|
150
|
-
|
151
148
|
blank_line
|
152
|
-
|
153
|
-
paths.each do |path|
|
154
|
-
old_item, new_item = diff[path]
|
155
|
-
print_diff(from_diff_item(path, old_item), from_diff_item(path, new_item))
|
156
|
-
end
|
149
|
+
print_commit_diff(commit.parent, commit.oid, @rev_list)
|
157
150
|
end
|
158
151
|
|
159
152
|
def show_merge_patch(commit)
|
@@ -168,21 +161,12 @@ module Command
|
|
168
161
|
blank_line
|
169
162
|
|
170
163
|
paths.each do |path|
|
171
|
-
parents = diffs.map { |diff|
|
172
|
-
child =
|
164
|
+
parents = diffs.map { |diff| from_entry(path, diff[path][0]) }
|
165
|
+
child = from_entry(path, diffs.first[path][1])
|
173
166
|
|
174
167
|
print_combined_diff(parents, child)
|
175
168
|
end
|
176
169
|
end
|
177
170
|
|
178
|
-
def from_diff_item(path, item)
|
179
|
-
if item
|
180
|
-
blob = repo.database.load(item.oid)
|
181
|
-
Target.new(path, item.oid, item.mode.to_s(8), blob.data)
|
182
|
-
else
|
183
|
-
Target.new(path, NULL_OID, nil, "")
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
171
|
end
|
188
172
|
end
|
data/lib/command/receive_pack.rb
CHANGED
@@ -64,6 +64,9 @@ module Command
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def validate_update(ref, old_oid, new_oid)
|
67
|
+
raise "funny refname" unless Revision.valid_ref?(ref)
|
68
|
+
raise "missing necessary objects" if new_oid and not repo.database.has?(new_oid)
|
69
|
+
|
67
70
|
if repo.config.get(["receive", "denyDeletes"])
|
68
71
|
raise "deletion prohibited" unless new_oid
|
69
72
|
end
|
@@ -28,6 +28,17 @@ module Command
|
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
+
def from_entry(path, entry)
|
32
|
+
return from_nothing(path) unless entry
|
33
|
+
|
34
|
+
blob = repo.database.load(entry.oid)
|
35
|
+
Target.new(path, entry.oid, entry.mode.to_s(8), blob.data)
|
36
|
+
end
|
37
|
+
|
38
|
+
def from_nothing(path)
|
39
|
+
Target.new(path, NULL_OID, nil, "")
|
40
|
+
end
|
41
|
+
|
31
42
|
def diff_fmt(name, text)
|
32
43
|
key = ["color", "diff", name]
|
33
44
|
style = repo.config.get(key)&.split(/ +/) || DIFF_FORMATS.fetch(name)
|
@@ -43,6 +54,17 @@ module Command
|
|
43
54
|
repo.database.short_oid(oid)
|
44
55
|
end
|
45
56
|
|
57
|
+
def print_commit_diff(a, b, differ = nil)
|
58
|
+
differ ||= repo.database
|
59
|
+
diff = differ.tree_diff(a, b)
|
60
|
+
paths = diff.keys.sort_by(&:to_s)
|
61
|
+
|
62
|
+
paths.each do |path|
|
63
|
+
old_entry, new_entry = diff[path]
|
64
|
+
print_diff(from_entry(path, old_entry), from_entry(path, new_entry))
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
46
68
|
def print_diff(a, b)
|
47
69
|
return if a.oid == b.oid and a.mode == b.mode
|
48
70
|
|
data/lib/database.rb
CHANGED
data/lib/database/backends.rb
CHANGED
data/lib/database/packed.rb
CHANGED
data/lib/pack.rb
CHANGED
data/lib/pack/compressor.rb
CHANGED
@@ -23,9 +23,9 @@ module Pack
|
|
23
23
|
def build_deltas
|
24
24
|
@progress&.start("Compressing objects", @objects.size)
|
25
25
|
|
26
|
-
@objects.
|
26
|
+
@objects.sort_by!(&:sort_key)
|
27
27
|
|
28
|
-
@objects.
|
28
|
+
@objects.reverse_each do |entry|
|
29
29
|
build_delta(entry)
|
30
30
|
@progress&.tick
|
31
31
|
end
|
data/lib/pack/index.rb
CHANGED
data/lib/refs.rb
CHANGED
data/lib/revision.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Coglan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email: jcoglan@gmail.com
|
15
15
|
executables:
|
16
16
|
- jit
|
@@ -115,7 +115,7 @@ homepage: https://shop.jcoglan.com/building-git/
|
|
115
115
|
licenses:
|
116
116
|
- GPL-3.0
|
117
117
|
metadata: {}
|
118
|
-
post_install_message:
|
118
|
+
post_install_message:
|
119
119
|
rdoc_options: []
|
120
120
|
require_paths:
|
121
121
|
- lib
|
@@ -130,8 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
requirements: []
|
133
|
-
rubygems_version: 3.1.
|
134
|
-
signing_key:
|
133
|
+
rubygems_version: 3.1.6
|
134
|
+
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: The information manager from London
|
137
137
|
test_files: []
|