feat: support %L conflict marker size option #136

Merged
ada4a merged 8 commits from ada4a/mergiraf:conflict_marker_size into main 2025-01-26 12:38:53 +01:00
Contributor

closes #128

I thought I'd make my work so far publicly available. Thoughts welcome!

WIP because of

closes #128 I thought I'd make my work so far publicly available. Thoughts welcome! WIP because of - [ ] Add a test (as described in https://codeberg.org/mergiraf/mergiraf/issues/128#issuecomment-2568247)
ugur-a force-pushed conflict_marker_size from 560d1f0666 to 13d54f36c6 2025-01-10 08:09:52 +01:00 Compare
ugur-a closed this pull request 2025-01-10 14:01:45 +01:00
ada4a reopened this pull request 2025-01-11 12:56:22 +01:00
ada4a force-pushed conflict_marker_size from 7e5a149c1e to 85a3226db4 2025-01-11 13:27:38 +01:00 Compare
ada4a force-pushed conflict_marker_size from 85a3226db4 to 855f19c973 2025-01-12 22:33:14 +01:00 Compare
ada4a force-pushed conflict_marker_size from f1cf8c679b to dc1de7fea3 2025-01-13 10:51:53 +01:00 Compare
Owner

oh, it seems like we don't actually get to use DisplaySettings's methods, since, we may get an incomplete settings (with *_revision_name still being at default values). Having such incomplete structs passed around is really an anti-pattern, so I'd say we try to get rid of that first

oh, it seems like we don't actually get to use `DisplaySettings`'s methods, since, we may get an incomplete `settings` (with `*_revision_name` still being at default values). Having such incomplete structs passed around is really an anti-pattern, so I'd say we try to get rid of that first
ada4a force-pushed conflict_marker_size from 2ee2a96d1e to 136dbfe756 2025-01-13 15:17:07 +01:00 Compare
ada4a force-pushed conflict_marker_size from 136dbfe756 to d745a700bf 2025-01-22 11:21:52 +01:00 Compare
Owner

cleaned up the commit history a little

cleaned up the commit history a little
ada4a force-pushed conflict_marker_size from d745a700bf to 3c85cd4af7 2025-01-22 12:09:46 +01:00 Compare
Owner

got rid of the whole builder thing, rebased onto main

got rid of the whole builder thing, rebased onto main
ada4a force-pushed conflict_marker_size from 3c85cd4af7 to e52dabdc35 2025-01-22 22:18:19 +01:00 Compare
ada4a changed title from WIP: feat: support %L conflict marker size option to feat: support %L conflict marker size option 2025-01-22 22:25:13 +01:00
requested review from wetneb 2025-01-22 22:25:57 +01:00
Owner

I'm still unsure about how this should interact with ParsedMerge::parse – isn't it the case that even if mergiraf merge gets called on a file wtih conflicts properly annotated with markers of some non-standard size, Mergiraf will still try to parse the file with the marker length assumed to be 7 (by virtue of the marker regex), and get totally confused? Because of this, I have first changed parse to make it also take DisplaySettings as input, but then reverted this change

I'm still unsure about how this should interact with `ParsedMerge::parse` – isn't it the case that even if `mergiraf merge` gets called on a file wtih conflicts properly annotated with markers of some non-standard size, Mergiraf will still try to parse the file with the marker length assumed to be 7 (by virtue of the marker regex), and get totally confused? Because of this, I have first changed `parse` to make it also take `DisplaySettings` as input, but then reverted this change
Owner

I've experimented with a test Git repo a little, and am now pretty sure that we indeed need to respect conflict-marker-size during parsing. I'll revert the revert then

I've experimented with a test Git repo a little, and am now pretty sure that we indeed need to respect `conflict-marker-size` during parsing. I'll revert the revert then
ada4a force-pushed conflict_marker_size from 138a83caca to 8a2a4f192f 2025-01-25 19:23:27 +01:00 Compare
Owner

rebased onto main

rebased onto main
the newly required argument necessitated function signature changes
elsewhere as well
Owner

I now realize that 8a2a4f192f actually doesn't have anything to do with this PR per se (what I wanted to was 979ac4e77c9d5c9878b42debd6907fe7c1bf8caa), but I guess I'll just leave it be

I now realize that 8a2a4f192f17b1d8038ab744658e2f44410a2532 actually doesn't have anything to do with this PR per se (what I wanted to was 979ac4e77c9d5c9878b42debd6907fe7c1bf8caa), but I guess I'll just leave it be
ada4a force-pushed conflict_marker_size from 9ec1450056 to d0026890fd 2025-01-25 19:54:03 +01:00 Compare
Owner

Fixed the test

Fixed the test
wetneb approved these changes 2025-01-26 10:56:30 +01:00
wetneb left a comment
Owner

It looks great to me!

It looks great to me!
Owner

By the way, I made a quick test to understand better how the conflict marker size is picked by git. I was hoping that it would be able to dynamically pick a size that made conflict markers distinct from the lines already contained in the files involved, but that doesn't seem to be the case (it can be configured in gitattributes). Maybe it wouldn't be so useful anyway, because the reader would still have a hard time understanding which marker is what if the size of the conflict markers produced by git varies depending on the contents.

By the way, I made a quick test to understand better how the conflict marker size is picked by git. I was hoping that it would be able to dynamically pick a size that made conflict markers distinct from the lines already contained in the files involved, but that doesn't seem to be the case (it can be configured in `gitattributes`). Maybe it wouldn't be so useful anyway, because the reader would still have a hard time understanding which marker is what if the size of the conflict markers produced by git varies depending on the contents.
Owner

I was hoping that it would be able to dynamically pick a size that made conflict markers distinct from the lines already contained in the files involved

I think it's also not often that you even have what-looks-like-conflict-markers lying around in your codebase. Rather, that would be expected in exactly the software that deals with the parsing/creation of those, e.g. diffy or mergiraf for that matter.

So I think that's another reason why such auto-detection functionality wouldn't be of much use anyway, and handling the exceptions explicitly by using .gitattributes would be exactly the right escape hatch. Speaking of which... that's exactly what my follow-up PR will consist of!

> I was hoping that it would be able to dynamically pick a size that made conflict markers distinct from the lines already contained in the files involved I think it's also not often that you even have what-looks-like-conflict-markers lying around in your codebase. Rather, that would be expected in exactly the software that deals with the parsing/creation of those, e.g. diffy or mergiraf for that matter. So I think that's another reason why such auto-detection functionality wouldn't be of much use anyway, and handling the exceptions explicitly by using `.gitattributes` would be exactly the right escape hatch. Speaking of which... that's exactly what my follow-up PR will consist of!
ada4a merged commit b80e97f135 into main 2025-01-26 12:38:53 +01:00
ada4a deleted branch conflict_marker_size 2025-01-26 12:38:56 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: mergiraf/mergiraf#136
No description provided.