Re: Bug report: "Use of uninitialized value $_ in print"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 2, 2018, 17:48 UTC
- Message-ID
- <xmqqefl2cqsd.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180302104232.GA11074@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Unfortunately, I don't think there's an easy way to do what you want > (show word-diffs but apply the full diff).
The current "word-diff" discards the information on where the lines end, and it is pretty much hopeless/useless in the context of "add -p". It would be a good addition to revamp it so that it keeps the original lines in pre/post images but only colors/highlights the byte ranges in such a way that (1) on a pre-image line, paint only the byte range that do not appear in the post-image, and (2) on a post-image line, paint only the byte range that do not appear in the pre-image.
E.g. Given these two
diff --git a/1 b/2
index aa49234b68..1cd9f6b5fd 100644
--- a/1
+++ b/2
@@ -1,2 +1 @@
-a b c e
-f g i j
+a b d f g hthe current word-diff would give (I cannot do colors here, so I'll upcase the colored letters):
@@ -1,2 +1 @@
a b C ED f g I JHas the output, but if we produced
@@ -1,2 +1 @@
-a b C E
-f g I J
+a b D f g Hinstead, then colored "add -p" would become easier to see.
And that would be useful outside the context of "add -p", which is a huge plus.