Nice!
I explored a little more about it and made a small study case.
The silly user (this guy here), has to be a bit smarter where the split occurs.
Lets assume this file:
aaaaaaaaa
aaaaaaaa
aaaaaaaa
aaaaaaaa
bbbbbbb
bbbbbbb
bbbbbb
bbbbbb
aaaaaaa
aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaa
Commit this, now modify this file to this:
aaaaaaaaa
aaaaaaaa
aaaaaaaa
aaaaaaaa
bbbbbbb (modified)
bbbbbbb (modified)
bbbbbb
bbbbbb
aaaaaaaa
aaaaaaaaa
aaaaaaaa
added
added
This is the diff:
text.md | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/text.md b/text.md
index 1836903..a87959f 100644
--- a/text.md
+++ b/text.md
@@ -2,12 +2,24 @@ aaaaaaaaa
aaaaaaaa
aaaaaaaa
aaaaaaaa
-bbbbbbb
-bbbbbbb
+bbbbbbb (modified)
+bbbbbbb (modified)
bbbbbb
bbbbbb
-aaaaaaa
-aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaa
+
+
+
+
+
+
+
+
+
+
+
+
+added
+added
\ No newline at end of file
This is a valid split:
text.md | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/text.md b/text.md
index 1836903..a87959f 100644
--- a/text.md
+++ b/text.md
@@ -2,6 +2,6 @@ aaaaaaaaa
aaaaaaaa
aaaaaaaa
aaaaaaaa
-bbbbbbb
-bbbbbbb
+bbbbbbb (modified)
+bbbbbbb (modified)
bbbbbb
@@ -8,6 +8,18 @@
bbbbbb
-aaaaaaa
-aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaa
+
+
+
+
+
+
+
+
+
+
+
+
+added
+added
\ No newline at end of file
This is not:
text.md | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/text.md b/text.md
index 1836903..a87959f 100644
--- a/text.md
+++ b/text.md
@@ -2,5 +2,5 @@ aaaaaaaaa
aaaaaaaa
aaaaaaaa
aaaaaaaa
-bbbbbbb
-bbbbbbb
+bbbbbbb (modified)
+bbbbbbb (modified)
@@ -7,7 +7,19 @@
bbbbbb
bbbbbb
-aaaaaaa
-aaaaaaa
aaaaaaaa
aaaaaaaaa
aaaaaaaa
+
+
+
+
+
+
+
+
+
+
+
+
+added
+added
\ No newline at end of file
If we try to split this with lazygit
(or magit). You can see it alters the diff a bit differently.
It keeps a copy of the last line content and properly adjusts the “set of changes” (the @@ header), for this specific case.
I’ll try to pay more attention to other edge splits I make in the future, but this is one case where “it is not just split”, you have to know where to split, and make proper edits to the “set of changes” if vc-mode haven’t read your mind and done it right for you.