]> khamidou — GitHub mirrors - arcanist.git/commit
Fix arc diff / arc patch to handle files with missing trailing newlines properly
authorepriestley <git@epriestley.com>
Wed, 7 Mar 2012 21:19:58 +0000 (13:19 -0800)
committerepriestley <git@epriestley.com>
Wed, 7 Mar 2012 21:19:58 +0000 (13:19 -0800)
commit54c3ad316e7d7f3e68339514e70d53047816f687
tree1ea44139be5c1d1bd9f5392f39aed564d271fe16
parent276b013d8758becf6634049b9eda3d723343c0f3
Fix arc diff / arc patch to handle files with missing trailing newlines properly

Summary:
  - When you try to "arc patch" a change which adds or removes a trailing newline or alters a file with a trailing newline near the newline, the patch fails because we fail to reconstuct the "\ No newline at end of file" line.
  - We don't currently record enough information about these diffs to reconstruct them with a sensible amount of effort. Store the "\ No newline at end of file" line instead of just a flag.
  - There are some special rules for these lines; implement them.

NOTE: This causes some display glitching in Differential, but nothing major; I'll fix that in a followup patch.

Test Plan:
  - Created a diff which added a trailing newline, removed a trailing newline, and altered a file without a trailing newline near the end of the file.
  - Verified that the git version of this patch and the 'arc export --git' version of this patch are (essentially) identical.
  - Verified that "arc diff" + "arc patch" can apply these changes.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, epriestley
Maniphest Tasks: T533

Differential Revision: https://secure.phabricator.com/D1810
src/parser/bundle/ArcanistBundle.php
src/parser/diff/ArcanistDiffParser.php