]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Add missing newline in arc export
authorvrana <jakubv@fb.com>
Wed, 10 Oct 2012 00:11:41 +0000 (17:11 -0700)
committervrana <jakubv@fb.com>
Wed, 10 Oct 2012 20:43:59 +0000 (13:43 -0700)
Summary:
Hunk may be missing newline at end of file. It produces exports like this:

  lang=diff
  --- a/third-party
  +++ b/third-party
  @@ -1 +1 @@
  -/mnt/gvfs/third-party/90cb1654197e56261b1733c704b387285f36208e
  \ No newline at end of file
  +/mnt/gvfs/third-party/7097083d10d37251218531da398545658872a47a
  \ No newline at end of filediff --git a/ti/proxygen/TARGETS b/ti/proxygen/TARGETS

Test Plan:
  $ arc export --git --diff 1

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, lesliepc16
Differential Revision: https://secure.phabricator.com/D3672

src/parser/ArcanistBundle.php

index 4589cdfacef6b004e8afe59943c856a05455ae68..ca89659df36ae099092b131f3e95a92749cfc499 100644 (file)
@@ -600,6 +600,11 @@ final class ArcanistBundle {
 
         $result[] = "@@ -{$o_head} +{$n_head} @@".PHP_EOL;
         $result[] = $corpus;
+
+        $last = substr($corpus, -1);
+        if ($last !== false && $last != "\r" && $last != "\n") {
+          $result[] = PHP_EOL;
+        }
       }
     }
     return implode('', $result);