Bug 472718 - Merge conflict resolved to empty is saved as newline
Summary: Merge conflict resolved to empty is saved as newline
Status: RESOLVED FIXED
Alias: None
Product: kdiff3
Classification: Applications
Component: application (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR grave
Target Milestone: ---
Assignee: michael
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-27 21:31 UTC by Karsten Düsterloh
Modified: 2023-08-15 02:07 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 1.10.6
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Düsterloh 2023-07-27 21:31:04 UTC
When resolving a merge conflict in line 1, and picking "no src line" as the solution, the result saved to file for this conflict is a newline.

This is a very grave problem, especially in automerge mode, since the merge result is not part of the input data. And in UI mode, the UI is even lying to you …

STEPS TO REPRODUCE
1. Create two input files "x" and "y" with the four lines of content each:

file "x":
a
b
c
e

file "y":
b
c
d
e

2.  Do a merge of these two files to a new file "z", eg. via

kdiff3 -m -o z x y

kdiff will complain about 2 merge conflicts.

3.  Resolve each conflict by choosing the empty block. Kdiff3 will mark these in the merge view as <No src line>

4. Save and quit Kdiff3.

OBSERVED RESULT

Look into the merge result file "z":
- the conflict solution "<No src line>" of merge line 1 was falsely written as an empty line
- the conflict solution "<No src line>" of merge line 4 was correctly not written

EXPECTED RESULT

The "<No src line>" of merge line 1 should not result in any output.


SOFTWARE/OS VERSIONS

KDiff3 Version 1.9.70 (64 bit) (and several older versions)
Lubuntu 23.04, i.e. Ubuntu 23.04 with LXDE desktop environment.
Comment 1 michael 2023-08-15 02:06:09 UTC
Git commit 546d17293bba213fc6b06d0e0b7f4a9688cd0650 by Michael Reeves.
Committed on 14/08/2023 at 05:31.
Pushed by mreeves into branch 'master'.

Account for deleted lines when determining first line of output.
FIXED-IN:1.10.6

M  +5    -3    src/mergeresultwindow.cpp

https://invent.kde.org/sdk/kdiff3/-/commit/546d17293bba213fc6b06d0e0b7f4a9688cd0650
Comment 2 michael 2023-08-15 02:07:17 UTC
Git commit 760d38c0d50c48d07e21f1ebf3b8e6443e8dbfd3 by Michael Reeves.
Committed on 14/08/2023 at 05:51.
Pushed by mreeves into branch '1.10'.

Account for deleted lines when determining first line of output.
FIXED-IN:1.10.6

M  +5    -3    src/mergeresultwindow.cpp

https://invent.kde.org/sdk/kdiff3/-/commit/760d38c0d50c48d07e21f1ebf3b8e6443e8dbfd3