OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /// Helper functionality for invoking Git. | 5 /// Helper functionality for invoking Git. |
6 library pub.git; | 6 library pub.git; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 /// Checks whether [command] is the Git command for this computer. | 110 /// Checks whether [command] is the Git command for this computer. |
111 bool _tryGitCommand(String command) { | 111 bool _tryGitCommand(String command) { |
112 // If "git --version" prints something familiar, git is working. | 112 // If "git --version" prints something familiar, git is working. |
113 try { | 113 try { |
114 var result = runProcessSync(command, ["--version"]); | 114 var result = runProcessSync(command, ["--version"]); |
115 var regexp = new RegExp("^git version"); | 115 var regexp = new RegExp("^git version"); |
116 return result.stdout.length == 1 && regexp.hasMatch(result.stdout.single); | 116 return result.stdout.length == 1 && regexp.hasMatch(result.stdout.single); |
117 } on ProcessException catch (error, stackTrace) { | 117 } on ProcessException catch (error, stackTrace) { |
118 var chain = new Chain.forTrace(stackTrace); | 118 var chain = new Chain.forTrace(stackTrace); |
119 // If the process failed, they probably don't have it. | 119 // If the process failed, they probably don't have it. |
120 log.message('Git command is not "$command": $error\n$chain'); | 120 log.error('Git command is not "$command": $error\n$chain'); |
121 return false; | 121 return false; |
122 } | 122 } |
123 } | 123 } |
OLD | NEW |