From e7a31832bfcdc85b22edd53dc58c994acac175b9 Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 15 Apr 2019 12:09:00 -0700 Subject: [PATCH] Show a warning when "git" is too old to support filesize limits Summary: See Test Plan: {F6378519} Reviewers: amckinley, avivey Reviewed By: avivey Differential Revision: https://secure.phabricator.com/D20431 --- .../editor/DiffusionRepositoryEditEngine.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php index 8907a22ce5..4e02ee99a0 100644 --- a/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php +++ b/src/applications/diffusion/editor/DiffusionRepositoryEditEngine.php @@ -236,6 +236,22 @@ final class DiffusionRepositoryEditEngine 'you can set a path in **Import Only**. Phabricator will ignore '. 'commits which do not affect this path.'); + $filesize_warning = null; + if ($object->isGit()) { + $git_binary = PhutilBinaryAnalyzer::getForBinary('git'); + $git_version = $git_binary->getBinaryVersion(); + $filesize_version = '1.8.4'; + if (version_compare($git_version, $filesize_version, '<')) { + $filesize_warning = pht( + '(WARNING) {icon exclamation-triangle} The version of "git" ("%s") '. + 'installed on this server does not support '. + '"--batch-check=", a feature required to enforce filesize '. + 'limits. Upgrade to "git" %s or newer to use this feature.', + $git_version, + $filesize_version); + } + } + return array( id(new PhabricatorSelectEditField()) ->setKey('vcs') @@ -477,6 +493,7 @@ final class DiffusionRepositoryEditEngine ->setDescription(pht('Maximum permitted file size.')) ->setConduitDescription(pht('Change the filesize limit.')) ->setConduitTypeDescription(pht('New repository filesize limit.')) + ->setControlInstructions($filesize_warning) ->setValue($object->getFilesizeLimit()), id(new PhabricatorTextEditField()) ->setKey('copyTimeLimit')