未验证 提交 7cf35c9d 编写于 作者: Z Zachary Anderson 提交者: GitHub

Re-route githook for Windows (#27532)

上级 2165cdcf
......@@ -23,10 +23,10 @@ class PrePushCommand extends Command<bool> {
final Stopwatch sw = Stopwatch()..start();
final bool verbose = globalResults!['verbose']! as bool;
final String flutterRoot = globalResults!['flutter']! as String;
final List<bool> checkResults = await Future.wait<bool>(<Future<bool>>[
_runClangTidy(flutterRoot, verbose),
_runFormatter(flutterRoot, verbose),
]);
final List<bool> checkResults = <bool>[
await _runClangTidy(flutterRoot, verbose),
await _runFormatter(flutterRoot, verbose),
];
sw.stop();
io.stdout.writeln('pre-push checks finished in ${sw.elapsed}');
return !checkResults.contains(false);
......
......@@ -16,15 +16,23 @@ SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.pa
FLUTTER_DIR = os.path.join(SRC_ROOT, 'flutter')
def IsWindows():
os_id = sys.platform
return os_id.startswith('win32') or os_id.startswith('cygwin')
def Main(argv):
githooks = os.path.join(FLUTTER_DIR, 'tools', 'githooks')
if IsWindows():
githooks = os.path.join(githooks, 'windows')
result = subprocess.run([
'git',
'config',
'core.hooksPath',
os.path.join(FLUTTER_DIR, 'tools', 'githooks'),
githooks,
], cwd=FLUTTER_DIR)
return result.returncode
if __name__ == '__main__':
sys.exit(Main(sys.argv))
sys.exit(Main(sys.argv))
#!/bin/sh
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
RED=''
NC=''
BOLD=''
echo "${BOLD}${RED}Warning:${NC} ${BOLD}Pre-push checks not supported on Windows${NC}"
echo "${BOLD}See: https://github.com/flutter/flutter/issues/86506${NC}"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册