]> khamidou — GitHub mirrors - arcanist.git/commitdiff
staging repo compatibility for older git versions
authorcburroughs <chris.burroughs@gmail.com>
Wed, 2 Sep 2015 13:52:11 +0000 (06:52 -0700)
committerepriestley <git@epriestley.com>
Wed, 2 Sep 2015 13:58:42 +0000 (06:58 -0700)
Summary:
The `--no-verify` flag was not added until git 1.8.2.  This
flag is used to avoid running local pre-push hooks.  This is likely a
rare configuration and is safe to omit the flag on older versions.
Users with local pre-push hooks **and** older git version may need to
adjust their workfow.

fixes T9310

Test Plan:
 * Ran `arc diff` with my real git 1.7.10.4 and succeeded with `STAGING
   PUSHED`.
 * Edited `getGitVersion` to be > 1.8.2 and pushed again.  Got
   `STAGING FAILED` because `error: unknown option`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: joshuaspence, epriestley

Maniphest Tasks: T9310

Differential Revision: https://secure.phabricator.com/D14033

src/workflow/ArcanistDiffWorkflow.php

index 6c75f482a9b2433e75c830e6c4e23faf1d3f5040..16811e206ca79bd9bf3c2982abd789ef6fbec09d 100644 (file)
@@ -2667,8 +2667,13 @@ EOTEXT
       pht('PUSH STAGING'),
       pht('Pushing changes to staging area...'));
 
+    $push_flags = array();
+    if (version_compare($api->getGitVersion(), '1.8.2', '>=')) {
+      $push_flags[] = '--no-verify';
+    }
     $err = phutil_passthru(
-      'git push --no-verify -- %s %s:refs/tags/%s',
+      'git push %Ls -- %s %s:refs/tags/%s',
+      $push_flags,
       $staging_uri,
       $commit,
       $tag);