]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Using a temp file for git commit --amend instead of passing multi-line message to...
authorMarke Hallowell <indiefan@gmail.com>
Wed, 2 May 2012 19:39:12 +0000 (12:39 -0700)
committerepriestley <git@epriestley.com>
Wed, 2 May 2012 19:39:46 +0000 (12:39 -0700)
Test Plan: Run arc diff locally, verify via git log that the commit is amended afterwards (using the mutable history paradigm)

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2369

src/repository/api/git/ArcanistGitAPI.php
src/repository/api/git/__init__.php

index b47c0b0a60898aa3daadf14505c58c4bbfe021ab..611a3e5b568aca0a245db8c95117401d6960ba70 100644 (file)
@@ -412,9 +412,11 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
   }
 
   public function amendGitHeadCommit($message) {
+    $tmp_file = new TempFile();
+    Filesystem::writeFile($tmp_file, $message);
     $this->execxLocal(
-      'commit --amend --allow-empty --message %s',
-      $message);
+      'commit --amend --allow-empty -F %s',
+      $tmp_file);
   }
 
   public function getPreReceiveHookStatus($old_ref, $new_ref) {
index e57f80478b74cf4a5a8c1fe61807c7a166cc869e..64fcef4da295872c421dcf1689c12afa4a56ab48 100644 (file)
@@ -12,6 +12,8 @@ phutil_require_module('arcanist', 'parser/diff');
 phutil_require_module('arcanist', 'repository/api/base');
 
 phutil_require_module('phutil', 'console');
+phutil_require_module('phutil', 'filesystem');
+phutil_require_module('phutil', 'filesystem/tempfile');
 phutil_require_module('phutil', 'future');
 phutil_require_module('phutil', 'future/exec');
 phutil_require_module('phutil', 'utils');