]> Sergey Matveev's repositories - public-inbox.git/commitdiff
solvergit: use --unidiff-zero with git-apply(1)
authorEric Wong <e@80x24.org>
Thu, 14 Nov 2019 01:03:38 +0000 (01:03 +0000)
committerEric Wong <e@80x24.org>
Thu, 14 Nov 2019 06:42:32 +0000 (06:42 +0000)
I sometimes post context-free documentation patches generated
with "-U0" to reduce size and bandwidth overhead when replacing
URLs or updating copyright notices.  git-apply(1) needs the
--unidiff-zero switch to work properly with context-free
patches.

Given our search looks for blob OIDs, and we're never going
to be running the code we regenerate, "--unidiff-zero" ought
to be safe.

lib/PublicInbox/SolverGit.pm

index b7327ffa99a7543b7dff77b8c71ca27299712a49..95334d7a8eeb4364738c4482ed457ec0dc27461d 100644 (file)
@@ -450,7 +450,7 @@ sub do_git_apply ($) {
 
        # we need --ignore-whitespace because some patches are CRLF
        my @cmd = (qw(git -C), $dn, qw(apply --cached --ignore-whitespace
-                       --whitespace=warn --verbose));
+                       --unidiff-zero --whitespace=warn --verbose));
        my $len = length(join(' ', @cmd));
        my $total = $self->{tot};
        my $di; # keep track of the last one for "git ls-files"