Skip to content

Commit 5169947

Browse files
committed
feat!: replace tree::Options::allow_lossy_resolution with *::tree_conflicts.
That way it's possible to steer how to resolve tree-related conflicts while making it possible to detect that a conflict happened.
1 parent a57192c commit 5169947

File tree

3 files changed

+27
-19
lines changed

3 files changed

+27
-19
lines changed
Binary file not shown.

Diff for: gix-merge/tests/fixtures/tree-baseline.sh

+21-1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,26 @@ git init rename-add-symlink
222222
git commit -m "rename foo to bar"
223223
)
224224

225+
git init rename-add-same-symlink
226+
(cd rename-add-same-symlink
227+
touch target
228+
ln -s target link
229+
git add .
230+
git commit -m "original"
231+
232+
git branch A
233+
git branch B
234+
235+
git checkout A
236+
git mv link link-new
237+
git commit -m "rename link to link-new"
238+
239+
git checkout B
240+
ln -s target link-new
241+
git add link-new
242+
git commit -m "create link-new"
243+
)
244+
225245
git init rename-rename-plus-content
226246
(cd rename-rename-plus-content
227247
write_lines 1 2 3 4 5 >foo
@@ -993,7 +1013,7 @@ git init type-change-to-symlink
9931013

9941014

9951015

996-
# TODO: Git does not detect the conflict (one turns exe off, the other turns it on), and we do exactly the same.
1016+
baseline rename-add-same-symlink A-B A B
9971017
baseline rename-add-exe-bit-conflict A-B A B
9981018
baseline remove-executable-mode A-B A B
9991019
baseline simple side-1-3-without-conflict side1 side3

Diff for: gix-merge/tests/merge/tree/mod.rs

+6-18
Original file line numberDiff line numberDiff line change
@@ -130,27 +130,15 @@ fn run_baseline() -> crate::Result {
130130
actual.conflicts,
131131
merge_info.conflicts
132132
);
133-
// if case_name.starts_with("submodule-both-modify-A-B") {
134-
if false {
135-
assert!(
136-
!did_change,
137-
"{case_name}: We can't handle submodules, so there is no index change"
138-
);
139-
assert!(
140-
actual.has_unresolved_conflicts(conflicts_like_in_git),
141-
"{case_name}: submodules currently result in an unresolved (unknown) conflict"
142-
);
143-
} else {
144-
assert_eq!(
145-
did_change,
146-
actual.has_unresolved_conflicts(conflicts_like_in_git),
147-
"{case_name}: If there is any kind of conflict, the index should have been changed"
148-
);
149-
}
133+
assert_eq!(
134+
did_change,
135+
actual.has_unresolved_conflicts(conflicts_like_in_git),
136+
"{case_name}: If there is any kind of conflict, the index should have been changed"
137+
);
150138
}
151139

152140
assert_eq!(
153-
actual_cases, 107,
141+
actual_cases, 109,
154142
"BUG: update this number, and don't forget to remove a filter in the end"
155143
);
156144

0 commit comments

Comments
 (0)