Index: utils/pub/git_source.dart |
diff --git a/utils/pub/git_source.dart b/utils/pub/git_source.dart |
index 5437ece8ef73eda473bb72c84453eb3ea6d26ae7..f38f753798fc48402466864ac9b1e25cb4367cb3 100644 |
--- a/utils/pub/git_source.dart |
+++ b/utils/pub/git_source.dart |
@@ -124,8 +124,7 @@ class GitSource extends Source { |
return exists(path).chain((exists) { |
if (!exists) return _clone(_getUrl(id), path, mirror: true); |
- return runProcess("git", ["fetch"], workingDir: path) |
- .transform((result) { |
+ return _runGit(["fetch"], workingDir: path).transform((result) { |
if (!result.success) throw 'Git failed.'; |
return null; |
}); |
@@ -136,7 +135,7 @@ class GitSource extends Source { |
* Returns a future that completes to the revision hash of [id]. |
*/ |
Future<String> _revisionAt(PackageId id) { |
- return runProcess("git", ["rev-parse", _getEffectiveRef(id)], |
+ return _runGit(["rev-parse", _getEffectiveRef(id)], |
workingDir: _repoCachePath(id)).transform((result) { |
if (!result.success) throw 'Git failed.'; |
return result.stdout[0]; |
@@ -163,7 +162,7 @@ class GitSource extends Source { |
Future _clone(String from, String to, [bool mirror=false]) { |
var args = ["clone", from, to]; |
if (mirror) args.insertRange(1, 1, "--mirror"); |
- return runProcess("git", args).transform((result) { |
+ return _runGit(args).transform((result) { |
if (!result.success) throw 'Git failed.'; |
return null; |
}); |
@@ -173,8 +172,7 @@ class GitSource extends Source { |
* Checks out the reference [ref] in [repoPath]. |
*/ |
Future _checkOut(String repoPath, String ref) { |
- return runProcess("git", ["checkout", ref], workingDir: repoPath) |
- .transform((result) { |
+ return _runGit(["checkout", ref], workingDir: repoPath).transform((result) { |
if (!result.success) throw 'Git failed.'; |
return null; |
}); |
@@ -238,4 +236,8 @@ class GitSource extends Source { |
if (description is PackageId) return description.description; |
return description; |
} |
+ |
+ /// Run a git process with [args] from [workingDir]. |
+ Future<PubProcessResult> _runGit(List<String> args, [String workingDir]) => |
Bob Nystrom
2012/09/11 16:18:55
How about moving this into io.dart? There's alread
nweiz
2012/09/11 19:25:11
Done.
|
+ gitCommand.chain((git) => runProcess(git, args, workingDir)); |
} |