Skip to content

Commit

Permalink
feat!: replace tree::Options::allow_lossy_resolution with `*::tree_…
Browse files Browse the repository at this point in the history
…conflicts`.

That way it's possible to steer how to resolve tree-related conflicts while
making it possible to detect that a conflict happened.
  • Loading branch information
Byron committed Nov 25, 2024
1 parent a57192c commit 5169947
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
Binary file modified gix-merge/tests/fixtures/generated-archives/tree-baseline.tar
Binary file not shown.
22 changes: 21 additions & 1 deletion gix-merge/tests/fixtures/tree-baseline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,26 @@ git init rename-add-symlink
git commit -m "rename foo to bar"
)

git init rename-add-same-symlink
(cd rename-add-same-symlink
touch target
ln -s target link
git add .
git commit -m "original"

git branch A
git branch B

git checkout A
git mv link link-new
git commit -m "rename link to link-new"

git checkout B
ln -s target link-new
git add link-new
git commit -m "create link-new"
)

git init rename-rename-plus-content
(cd rename-rename-plus-content
write_lines 1 2 3 4 5 >foo
Expand Down Expand Up @@ -993,7 +1013,7 @@ git init type-change-to-symlink



# TODO: Git does not detect the conflict (one turns exe off, the other turns it on), and we do exactly the same.
baseline rename-add-same-symlink A-B A B
baseline rename-add-exe-bit-conflict A-B A B
baseline remove-executable-mode A-B A B
baseline simple side-1-3-without-conflict side1 side3
Expand Down
24 changes: 6 additions & 18 deletions gix-merge/tests/merge/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,27 +130,15 @@ fn run_baseline() -> crate::Result {
actual.conflicts,
merge_info.conflicts
);
// if case_name.starts_with("submodule-both-modify-A-B") {
if false {
assert!(
!did_change,
"{case_name}: We can't handle submodules, so there is no index change"
);
assert!(
actual.has_unresolved_conflicts(conflicts_like_in_git),
"{case_name}: submodules currently result in an unresolved (unknown) conflict"
);
} else {
assert_eq!(
did_change,
actual.has_unresolved_conflicts(conflicts_like_in_git),
"{case_name}: If there is any kind of conflict, the index should have been changed"
);
}
assert_eq!(
did_change,
actual.has_unresolved_conflicts(conflicts_like_in_git),
"{case_name}: If there is any kind of conflict, the index should have been changed"
);
}

assert_eq!(
actual_cases, 107,
actual_cases, 109,
"BUG: update this number, and don't forget to remove a filter in the end"
);

Expand Down

0 comments on commit 5169947

Please sign in to comment.