Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: [PATCH] add-interactive: fix bogus diff header line ordering

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:19

Possibly related (same subject, not in this thread)

Jeff King [off-list ref] writes:
quoted hunk
 git-add--interactive.perl |   17 ++++++++++++++++-
 t/t2016-checkout-patch.sh |    8 ++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index bfd1003..4173200 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -979,6 +979,21 @@ sub coalesce_overlapping_hunks {
 	return @out;
 }
 
+sub reassemble_patch {
+	my $head = shift;
+	return (
+		# Include everything in the header except the beginning of the
+		# diff.
+		(grep { !/^[-+]{3}/ } @$head),
+		# Then include any other non-diff header lines from the hunks.
+		(grep { !/^[@ +-]/ } @_),
+		# Then begin the diff.
+		(grep { /^[-+]{3}/ } @$head),
+		# And then the hunk diff lines.
+		(grep { /^[@ +-]/ } @_)
Hmm.  Are you handling "\No newline at the end of the file" correctly?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help