[PATCH 1/4] Suppress spurious linefeeds in git-add--interactive
- From
Wincent Colaiuta <win@wincent.com>
- Date
- Nov 22, 2007, 00:02 UTC
- Message-ID
- <1195689773-28601-2-git-send-email-win@wincent.com>
- In-Reply-To
- <1195689773-28601-1-git-send-email-win@wincent.com>
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 <win@wincent.com> --- 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