git-subline-merge icon indicating copy to clipboard operation
git-subline-merge copied to clipboard

Add ability to edit subline merge result

Open paulaltin opened this issue 4 years ago • 0 comments

Sometimes it would be useful to run a subline merge but then manually tweak the result before committing it.

For example, given a conflicted hunk where one branch renamed a variable and another branch used that same variable a second time:

<<<<<<<
result = varA * 100;
|||||||
result = var1 * 100;
=======
result = (var1 ? var1 : 1) * 100;
>>>>>>>

With this input, git-subline-merge will succeed but produce this output, which is not correct since the second use of var1 also needs to be renamed.

result = (varA ? var1 : 1) * 100;

In this case, the desired result could easily be achieved using the manually resolve option (m), however in more complex cases it would be convenient to run the subline merge first and do manual corrections to the result.

It should be straightforward to add an option to manually edit the result of a subline merge using the default editor. This could be a third option when prompting for confirmation, e.g. "Accept sub-line merge (y/n/e)?".

paulaltin avatar Jul 16 '20 01:07 paulaltin