Thread (21 messages) flat view 21 messages, 3 authors, 2016-06-15
DORMANTno replies

[PATCH 1/4] Suppress spurious linefeeds in git-add--interactive

From: Wincent Colaiuta <hidden>
Date: 2016-06-15 22:43:53
Subsystem: the rest · Maintainer: Linus Torvalds

Eliminate the spurious linefeed echoed to the terminal when passing an
untracked or unchanged file as a parameter to git-add--interactive.

Signed-off-by: Wincent Colaiuta <redacted>
---
 git-add--interactive.perl |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 8f21c03..95e537c 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -336,6 +336,7 @@ sub add_untracked_cmd {
 sub parse_diff {
 	my ($path) = @_;
 	my @diff = run_cmd_pipe(qw(git diff-files -p --), $path);
+	return undef if ($#diff == -1);
 	my (@hunk) = { TEXT => [] };
 
 	for (@diff) {
@@ -571,6 +572,7 @@ sub patch_update_file {
 	my ($ix, $num);
 	my $path = shift;
 	my ($head, @hunk) = parse_diff($path);
+	return unless $head;
 	for (@{$head->{TEXT}}) {
 		print;
 	}
-- 
1.5.3.6.867.g539b6-dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help