summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2016-08-10 10:39:33 +0100
committerThibault Saunier <thibault.saunier@osg.samsung.com>2016-11-09 09:54:47 -0300
commit5293c3dc41cc32f095397bfe4102fef3cad94b79 (patch)
treef876040643c30f39347b2b728b80012d31f84302
parentc2a4964f0876fdda8646ab433ebd8474dafa9cce (diff)
git-phab: Pass --keep-cr to git-am to avoid breaking on CRLF patches
If a patch (and the file it is patching) use CRLF line endings, git-am will not work, as it normalises the line endings in the file (but not the patch) before applying. Pass --keep-cr to git-am to avoid this — it will now apply the patches, but will spew warnings about trailing whitespace (the CR characters), which seems fair. Signed-off-by: Philip Withnall <philip.withnall@collabora.co.uk> Reviewed-by: Thibault Saunier <tsaunier@gnome.org> Differential Revision: https://phabricator.freedesktop.org/D1266
-rwxr-xr-xgit-phab6
1 files changed, 5 insertions, 1 deletions
diff --git a/git-phab b/git-phab
index 2479e23..96ace89 100755
--- a/git-phab
+++ b/git-phab
@@ -1414,7 +1414,11 @@ Paste API Token from that page and press <enter>: """ % self.phabricator_uri)
1414 1414
1415 def am_patch(self, filename, base_commit): 1415 def am_patch(self, filename, base_commit):
1416 try: 1416 try:
1417 self.repo.git.am(filename) 1417 # Pass --keep-cr to avoid breaking on patches for code which uses
1418 # CRLF line endings, due to automatically removing them before
1419 # applying the patch. See
1420 # http://stackoverflow.com/a/16144559/2931197
1421 self.repo.git.am(filename, keep_cr=True)
1418 return 1422 return
1419 except git.exc.GitCommandError as e: 1423 except git.exc.GitCommandError as e:
1420 self.repo.git.am("--abort") 1424 self.repo.git.am("--abort")