]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Read default relative commit from scratch file with newline
authorGit user <git@fb.com>
Thu, 12 Apr 2012 00:22:07 +0000 (17:22 -0700)
committerNick Harper <nharper@fb.com>
Thu, 12 Apr 2012 00:44:57 +0000 (17:44 -0700)
Summary:
When people create the .arc/default-relative-commit scratchfile with $EDITOR of
choice, their editor usually puts a newline at the end, which breaks arc diff.
We should trim the newline before using the contents of the scratchfile.

Test Plan:
ran arc diff in a working copy that contained a .arc/default-relative-commit
with a newline

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran
Differential Revision: https://secure.phabricator.com/D2209

src/repository/api/git/ArcanistGitAPI.php

index bd2163f1e2acad4951a8a98ab6f41e2bd681c77b..1900e6626a61901e3a5b8fcba956e4e20e9af06b 100644 (file)
@@ -140,6 +140,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
 
       if (!$default_relative) {
         $default_relative = $this->readScratchFile('default-relative-commit');
+        $default_relative = trim($default_relative);
       }
 
       if (!$default_relative) {