]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Use binary safe diff in arc diff
authorJason Ge <jungejason@fb.com>
Tue, 3 Jul 2012 20:25:49 +0000 (13:25 -0700)
committerJason Ge <jungejason@fb.com>
Tue, 3 Jul 2012 20:33:28 +0000 (13:33 -0700)
Summary: Otherwise svn diff fails when the file is binary but the "svn:mime-type = application/x-shellscript" is missing in it.

Test Plan: arc diff succeeded against deleting a binary file which doesn't have svn:mime-type = application/x-shellscript.

Reviewers: epriestley

Reviewed By: epriestley

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

scripts/repository/binary_safe_diff.sh [new file with mode: 0755]
src/repository/api/ArcanistSubversionAPI.php

diff --git a/scripts/repository/binary_safe_diff.sh b/scripts/repository/binary_safe_diff.sh
new file mode 100755 (executable)
index 0000000..1473e80
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+diff "$@"
+if [ "$?" = "2" ]; then
+  exit 1
+fi
index eb1a263290994b738acea2dc974e08b9e58e5b2f..6c23727fbfb9c07b7ef42fa643fdc88cd6e9c5a3 100644 (file)
@@ -268,9 +268,12 @@ final class ArcanistSubversionAPI extends ArcanistRepositoryAPI {
     // itself (such as property changes) and also give us changes to any
     // files within the directory (basically, implicit recursion). We don't
     // want that, so prevent recursive diffing.
+    $root = phutil_get_library_root('arcanist');
+
     return new ExecFuture(
-      '(cd %s; svn diff --depth empty --diff-cmd diff -x -U%d %s)',
+      '(cd %s; svn diff --depth empty --diff-cmd %s -x -U%d %s)',
       $this->getPath(),
+      $root.'/../scripts/repository/binary_safe_diff.sh',
       $this->getDiffLinesOfContext(),
       $path);
   }