Commit graph

12 commits

Author SHA1 Message Date
Stefan Haller d0078bf05c Recognize conflict markers that have no label
Git only writes the space after a marker when there is a label to write
after it, and the label can be empty: `git checkout -m` with the diff3
conflict style, for instance, has no name for the common ancestor, so it
writes a bare "|||||||" line.
2026-08-08 12:43:42 +02:00
Stefan Haller bc9fafff02 Make the conflict marker size a parameter of our marker matching
Git doesn't always write conflict markers of seven characters: the
conflict-marker-size gitattribute overrides that per file, and it is set
for good reasons — for file types whose regular content tends to contain
marker-looking lines, such as documentation about merging, or test
scripts. We hard-code seven characters everywhere we look for markers,
so none of that works.

Prepare for honoring the attribute by threading the marker size through
everything that recognizes a marker, carried on the file model. Nothing
fills it in yet, so we still use git's default size of seven everywhere,
and matching is unchanged: a marker consists of exactly that many marker
characters, and all but the "=======" one are followed by a space and a
label.
2026-08-08 12:43:42 +02:00
Stefan Haller 8dbdd74400 Fix linter warnings about ignoring errors from bufio.Scanner 2026-05-03 16:57:24 +02:00
Stefan Haller f69eb6dc48 Use ScanLinesAndTruncateWhenLongerThanBuffer instead of bufio.ScanLines 2024-05-15 13:27:01 +02:00
Jesse Duffield a34bdf1a04 update linters 2022-03-19 12:12:57 +11:00
Jesse Duffield c8cc18920f improve merge conflict flow 2022-01-26 14:50:47 +11:00
Ryooooooga a0e7604f61 Support git config merge.conflictStyle diff3 2021-08-25 22:23:55 +10:00
Ryooooooga 0af0e66586
Fix panic in merge conflict 2021-08-21 18:34:30 +09:00
Jesse Duffield 90983aae65 not importing regexp 2021-06-05 13:53:25 +10:00
Jesse Duffield f71b23b890 more explicit 2021-06-05 13:53:25 +10:00
Cristian Betivu 05a23f0e1e Discard value after END marker 2021-06-05 13:53:25 +10:00
Jesse Duffield 258eedb38c refactor 2021-06-02 20:33:52 +10:00