Skip to content

Commit 37c1e4c

Browse files
authored
Merge pull request #1612 from Byron/merge
octopus-merge (part 4: tree-merge-ORT three-way)
2 parents f35b109 + 3745212 commit 37c1e4c

File tree

209 files changed

+6204
-2817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+6204
-2817
lines changed

Diff for: Cargo.lock

+47-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ serde_derive = ">=1.0.185"
194194

195195
once_cell = "1.18.0"
196196
document-features = { version = "0.2.0", optional = true }
197-
198197
[profile.dev.package]
198+
insta.opt-level = 3
199+
similar.opt-level = 3
199200
gix-object = { opt-level = 3 }
200201
gix-ref = { opt-level = 3 }
201202
#gix-pack = { opt-level = 3 }

Diff for: crate-status.md

+18-10
Original file line numberDiff line numberDiff line change
@@ -304,17 +304,24 @@ Check out the [performance discussion][gix-diff-performance] as well.
304304

305305
* **tree**
306306
* [x] changes needed to obtain _other tree_
307-
* **patches**
308-
* There are various ways to generate a patch from two blobs.
309-
* [ ] text
310-
* [ ] binary
311-
* **lines**
312-
* [x] Simple line-by-line diffs powered by the `imara-diff` crate.
307+
* **blobs**
308+
* **patches**
309+
* There are various ways to generate a patch from two blobs.
310+
* [ ] text
311+
* [ ] binary
312+
* [ ] `git-apply` compatibility
313+
* [ ] merge hunks that are close enough based on line-setting (`interhunk-lines`)
314+
* [ ] white-space related settings
315+
* **lines**
316+
* [x] Simple line-by-line diffs powered by the `imara-diff` crate.
313317
* **generic rename tracker to find renames and copies**
314-
* [x] find by exact match
315-
* [x] find by similarity check
318+
* [x] find blobs by exact match
319+
* [x] find blobs by similarity check
316320
* [ ] heuristics to find best candidate
317-
* [ ] find by basename to help detecting simple moves
321+
* [ ] find by basename to support similarity check
322+
* [x] directory tracking
323+
- [x] by identity
324+
- [ ] by similarity
318325
* **blob**
319326
* [x] a choice of to-worktree, to-git and to-worktree-if-needed conversions
320327
* [x] `textconv` filters
@@ -332,12 +339,13 @@ Check out the [performance discussion][gix-diff-performance] as well.
332339

333340
### gix-merge
334341

335-
* [x] three-way merge analysis of blobs with choice of how to resolve conflicts
342+
* [x] three-way merge analysis of **blobs** with choice of how to resolve conflicts
336343
- [ ] choose how to resolve conflicts on the data-structure
337344
- [ ] produce a new blob based on data-structure containing possible resolutions
338345
- [x] `merge` style
339346
- [x] `diff3` style
340347
- [x] `zdiff` style
348+
- [ ] a way to control inter-hunk merging based on proximity (maybe via `gix-diff` feature which could use the same)
341349
* [ ] diff-heuristics match Git perfectly
342350
* [x] API documentation
343351
* [ ] Examples

Diff for: gitoxide-core/src/hours/core.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,23 @@ pub fn spawn_tree_delta_threads<'scope>(
125125
None => continue,
126126
};
127127
from.changes()?
128-
.track_filename()
129-
.track_rewrites(None)
128+
.options(|opts| {
129+
opts.track_filename().track_rewrites(None);
130+
})
130131
.for_each_to_obtain_tree(&to, |change| {
131-
use gix::object::tree::diff::change::Event::*;
132+
use gix::object::tree::diff::Change::*;
132133
changes.fetch_add(1, Ordering::Relaxed);
133-
match change.event {
134+
match change {
134135
Rewrite { .. } => {
135136
unreachable!("we turned that off")
136137
}
137-
Addition { entry_mode, id } => {
138+
Addition { entry_mode, id, .. } => {
138139
if entry_mode.is_no_tree() {
139140
files.added += 1;
140141
add_lines(line_stats, &lines_count, &mut lines, id);
141142
}
142143
}
143-
Deletion { entry_mode, id } => {
144+
Deletion { entry_mode, id, .. } => {
144145
if entry_mode.is_no_tree() {
145146
files.removed += 1;
146147
remove_lines(line_stats, &lines_count, &mut lines, id);
@@ -151,6 +152,7 @@ pub fn spawn_tree_delta_threads<'scope>(
151152
previous_entry_mode,
152153
id,
153154
previous_id,
155+
..
154156
} => match (previous_entry_mode.is_blob(), entry_mode.is_blob()) {
155157
(false, false) => {}
156158
(false, true) => {

Diff for: gitoxide-core/src/hours/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ pub struct WorkByPerson {
1414
pub lines: LineStats,
1515
}
1616

17-
impl<'a> WorkByPerson {
18-
pub fn merge(&mut self, other: &'a WorkByEmail) {
17+
impl WorkByPerson {
18+
pub fn merge(&mut self, other: &WorkByEmail) {
1919
if !self.name.contains(&other.name) {
2020
self.name.push(other.name);
2121
}

Diff for: gitoxide-core/src/query/engine/update.rs

+26-18
Original file line numberDiff line numberDiff line change
@@ -207,34 +207,36 @@ pub fn update(
207207
rewrite_cache.clear_resource_cache_keep_allocation();
208208
diff_cache.clear_resource_cache_keep_allocation();
209209
from.changes()?
210-
.track_path()
211-
.track_rewrites(Some(rewrites))
210+
.options(|opts| {
211+
opts.track_path().track_rewrites(Some(rewrites));
212+
})
212213
.for_each_to_obtain_tree_with_cache(&to, &mut rewrite_cache, |change| {
213-
use gix::object::tree::diff::change::Event::*;
214+
use gix::object::tree::diff::Change::*;
214215
change_counter.fetch_add(1, Ordering::SeqCst);
215-
match change.event {
216-
Addition { entry_mode, id } => {
216+
match change {
217+
Addition {
218+
entry_mode,
219+
id,
220+
location,
221+
..
222+
} => {
217223
if entry_mode.is_blob_or_symlink() {
218-
add_lines(&mut out, change.location, &lines_counter, id);
224+
add_lines(&mut out, location, &lines_counter, id);
219225
}
220226
}
221227
Modification {
222228
entry_mode,
223229
previous_entry_mode,
224230
id,
225231
previous_id,
232+
location,
226233
} => match (previous_entry_mode.is_blob(), entry_mode.is_blob()) {
227234
(false, false) => {}
228235
(false, true) => {
229-
add_lines(&mut out, change.location, &lines_counter, id);
236+
add_lines(&mut out, location, &lines_counter, id);
230237
}
231238
(true, false) => {
232-
add_lines(
233-
&mut out,
234-
change.location,
235-
&lines_counter,
236-
previous_id,
237-
);
239+
add_lines(&mut out, location, &lines_counter, previous_id);
238240
}
239241
(true, true) => {
240242
if let Ok(cache) =
@@ -266,7 +268,7 @@ pub fn update(
266268
lines_counter
267269
.fetch_add(nl, Ordering::SeqCst);
268270
out.push(FileChange {
269-
relpath: change.location.to_owned(),
271+
relpath: location.to_owned(),
270272
mode: FileMode::Modified,
271273
source_relpath: None,
272274
lines: Some(lines),
@@ -281,19 +283,25 @@ pub fn update(
281283
}
282284
}
283285
},
284-
Deletion { entry_mode, id } => {
286+
Deletion {
287+
entry_mode,
288+
id,
289+
location,
290+
..
291+
} => {
285292
if entry_mode.is_blob_or_symlink() {
286-
remove_lines(&mut out, change.location, &lines_counter, id);
293+
remove_lines(&mut out, location, &lines_counter, id);
287294
}
288295
}
289296
Rewrite {
290297
source_location,
291298
diff,
292299
copy,
300+
location,
293301
..
294302
} => {
295303
out.push(FileChange {
296-
relpath: change.location.to_owned(),
304+
relpath: location.to_owned(),
297305
source_relpath: Some(source_location.to_owned()),
298306
mode: if copy { FileMode::Copy } else { FileMode::Rename },
299307
lines: diff.map(|d| LineStats {
@@ -369,7 +377,7 @@ pub fn update(
369377
}
370378
}
371379

372-
impl<'a, Find> gix::prelude::Find for Db<'a, Find>
380+
impl<Find> gix::prelude::Find for Db<'_, Find>
373381
where
374382
Find: gix::prelude::Find + Clone,
375383
{

Diff for: gitoxide-core/src/repository/revision/explain.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'a> Explain<'a> {
5555
}
5656
}
5757

58-
impl<'a> delegate::Revision for Explain<'a> {
58+
impl delegate::Revision for Explain<'_> {
5959
fn find_ref(&mut self, name: &BStr) -> Option<()> {
6060
self.prefix()?;
6161
self.ref_name = Some(name.into());
@@ -121,7 +121,7 @@ impl<'a> delegate::Revision for Explain<'a> {
121121
}
122122
}
123123

124-
impl<'a> delegate::Navigate for Explain<'a> {
124+
impl delegate::Navigate for Explain<'_> {
125125
fn traverse(&mut self, kind: Traversal) -> Option<()> {
126126
self.prefix()?;
127127
let name = self.revision_name();
@@ -194,7 +194,7 @@ impl<'a> delegate::Navigate for Explain<'a> {
194194
}
195195
}
196196

197-
impl<'a> delegate::Kind for Explain<'a> {
197+
impl delegate::Kind for Explain<'_> {
198198
fn kind(&mut self, kind: spec::Kind) -> Option<()> {
199199
self.prefix()?;
200200
self.call = 0;
@@ -215,7 +215,7 @@ impl<'a> delegate::Kind for Explain<'a> {
215215
}
216216
}
217217

218-
impl<'a> Delegate for Explain<'a> {
218+
impl Delegate for Explain<'_> {
219219
fn done(&mut self) {
220220
if !self.has_implicit_anchor && self.ref_name.is_none() && self.oid_prefix.is_none() {
221221
self.err = Some("Incomplete specification lacks its anchor, like a reference or object name".into());

Diff for: gitoxide-core/src/repository/tree.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ mod entries {
6565
}
6666
}
6767

68-
impl<'repo, 'a> gix::traverse::tree::Visit for Traverse<'repo, 'a> {
68+
impl gix::traverse::tree::Visit for Traverse<'_, '_> {
6969
fn pop_front_tracked_path_and_set_current(&mut self) {
7070
self.path = self.path_deque.pop_front().expect("every parent is set only once");
7171
}

Diff for: gix-actor/src/identity.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ mod write {
4040
}
4141
}
4242

43-
impl<'a> IdentityRef<'a> {
43+
impl IdentityRef<'_> {
4444
/// Serialize this instance to `out` in the git serialization format for signatures (but without timestamp).
4545
pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> {
4646
out.write_all(validated_token(self.name)?)?;

Diff for: gix-actor/src/signature/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub(crate) mod write {
104104
}
105105
}
106106

107-
impl<'a> SignatureRef<'a> {
107+
impl SignatureRef<'_> {
108108
/// Serialize this instance to `out` in the git serialization format for actors.
109109
pub fn write_to(&self, out: &mut dyn std::io::Write) -> std::io::Result<()> {
110110
out.write_all(validated_token(self.name)?)?;

Diff for: gix-attributes/src/name.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{Name, NameRef};
22
use bstr::{BStr, BString, ByteSlice};
33
use kstring::KStringRef;
44

5-
impl<'a> NameRef<'a> {
5+
impl NameRef<'_> {
66
/// Turn this ref into its owned counterpart.
77
pub fn to_owned(self) -> Name {
88
Name(self.0.into())

Diff for: gix-attributes/src/state.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a> StateRef<'a> {
9696
}
9797

9898
/// Access
99-
impl<'a> StateRef<'a> {
99+
impl StateRef<'_> {
100100
/// Turn ourselves into our owned counterpart.
101101
pub fn to_owned(self) -> State {
102102
self.into()

0 commit comments

Comments
 (0)