]> khamidou — GitHub mirrors - arcanist.git/commitdiff
add support for using Arcanist with git's log.decorate setting enabled
authorEhren Kret <ehren@fb.com>
Mon, 30 Apr 2012 21:14:23 +0000 (14:14 -0700)
committerEhren Kret <ehren@fb.com>
Mon, 30 Apr 2012 21:14:23 +0000 (14:14 -0700)
Summary:
Arcanist fails to find git's 'commit <hash>' header when log.decorate is
set in one of git's config files. git adds the named refs that point to
the commit in parentheses following the hash. This changes the regex
used by arcanist to match git commit headers to optionally match the
branch names in parentheses following the hash.

Test Plan:
Run `git config --global log.decorate short` and check that `arc diff`
runs successfully.

Reviewers: epriestley

Reviewed By: epriestley

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

src/parser/diff/ArcanistDiffParser.php
src/parser/diff/__tests__/ArcanistDiffParserTestCase.php
src/parser/diff/__tests__/data/git-commit-logdecorate.gitdiff [new file with mode: 0644]
src/repository/api/git/ArcanistGitAPI.php

index 344c72c269cd23dadd8265cb7aee501cc4b6c2bc..7a93b524ab90d963f14c701649adf944880c35f9 100644 (file)
@@ -215,7 +215,7 @@ final class ArcanistDiffParser {
         // This is an SVN property change, probably from "svn diff".
         '(?P<type>Property changes on): (?P<cur>.+)',
         // This is a git commit message, probably from "git show".
-        '(?P<type>commit) (?P<hash>[a-f0-9]+)',
+        '(?P<type>commit) (?P<hash>[a-f0-9]+)(?: \(.*\))?',
         // This is a git diff, probably from "git show" or "git diff".
         // Note that the filenames may appear quoted.
         '(?P<type>diff --git) '.
index 450cc7a5ba6d5eb9771beda711fefc98479ba9fd..bdfa724cbbc6a773e4ad47505398052aaa6f9f76 100644 (file)
@@ -428,6 +428,7 @@ EOTEXT
         $this->assertEqual(1, count(reset($changes)->getHunks()));
         break;
       case 'git-commit.gitdiff':
+      case 'git-commit-logdecorate.gitdiff':
         $this->assertEqual(1, count($changes));
         $change = reset($changes);
         $this->assertEqual(
diff --git a/src/parser/diff/__tests__/data/git-commit-logdecorate.gitdiff b/src/parser/diff/__tests__/data/git-commit-logdecorate.gitdiff
new file mode 100644 (file)
index 0000000..70b64fd
--- /dev/null
@@ -0,0 +1,31 @@
+commit 76e2f1339c298c748aa0b52030799ed202a6537b (HEAD, refs/heads/master)
+Author: ngao <ngao@2c7ba8d8-a2f7-0310-a573-de162e16dcc7>
+Date:   Wed Mar 3 20:39:39 2010 +0000
+
+    Deprecating UIActionButton (Part 1)
+
+    Summary: Replaces calls to UIActionButton with <ui:button>.  I tested most
+             of these calls, but there were some that I didn't know how to
+             reach, so if you are one of the owners of this code, please test
+             your feature in my sandbox: www.ngao.devrs013.facebook.com
+
+             @brosenthal, I removed some logic that was setting a disabled state
+             on a UIActionButton, which is actually a no-op.
+
+    Reviewed By: brosenthal
+
+    Other Commenters: sparker, egiovanola
+
+    Test Plan: www.ngao.devrs013.facebook.com
+
+               Explicitly tested:
+               * ads creation flow (add keyword)
+               * ads manager (conversion tracking)
+               * help center (create a discussion)
+               * new user wizard (next step button)
+
+    Revert: OK
+
+    DiffCamp Revision: 94064
+
+    git-svn-id: svn+ssh://tubbs/svnroot/tfb/trunk/www@223593 2c7ba8d8
index 3511e7156bd5c649e66cc63d1e741ca3f7cfa2a9..d4ba6c3178ed7dd71525e73aa5c2accb858ff1e5 100644 (file)
@@ -281,11 +281,12 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
       return '';
     } else if ($relative == self::GIT_MAGIC_ROOT_COMMIT) {
       // First commit.
-      list($stdout) = $this->execxLocal('log --format=medium HEAD');
+      list($stdout) = $this->execxLocal(
+        'log --no-decorate --format=medium HEAD');
     } else {
       // 2..N commits.
       list($stdout) = $this->execxLocal(
-        'log --first-parent --format=medium %s..HEAD',
+        'log --no-decorate --first-parent --format=medium %s..HEAD',
         $this->getRelativeCommit());
     }
     return $stdout;