Chromium Code Reviews| Index: utils/pub/git_source.dart |
| diff --git a/utils/pub/git_source.dart b/utils/pub/git_source.dart |
| index a815feb2c7638dc47abaaf70223c5cb4524fb957..35f4947e4bb35973f14f93e02c4e05e14a0a6491 100644 |
| --- a/utils/pub/git_source.dart |
| +++ b/utils/pub/git_source.dart |
| @@ -52,7 +52,7 @@ class GitSource extends Source { |
| return exists(revisionCachePath); |
| }).chain((exists) { |
| if (exists) return new Future.immediate(null); |
| - return _clone(_repoCachePath(id), revisionCachePath); |
| + return _clone(_repoCachePath(id), revisionCachePath, mirror: false); |
| }).chain((_) { |
| var ref = _getEffectiveRef(id); |
| if (ref == 'HEAD') return new Future.immediate(null); |
| @@ -122,10 +122,12 @@ class GitSource extends Source { |
| Future _ensureRepoCache(PackageId id) { |
| var path = _repoCachePath(id); |
| return exists(path).chain((exists) { |
| - if (!exists) return _clone(_getUrl(id), path); |
| + if (!exists) return _clone(_getUrl(id), path, mirror: true); |
| - return runProcess("git", ["pull", "--force"], workingDir: path) |
| + return runProcess("git", ["fetch"], workingDir: path) |
| .transform((result) { |
| + print(result.stdout); |
| + print(result.stderr); |
|
Bob Nystrom
2012/09/05 00:56:04
Remove these.
nweiz
2012/09/05 21:10:42
Done.
|
| if (!result.success) throw 'Git failed.'; |
| return null; |
| }); |
| @@ -156,8 +158,10 @@ class GitSource extends Source { |
| /** |
| * Clones the repo at the URI [from] to the path [to] on the local filesystem. |
|
Bob Nystrom
2012/09/05 00:56:04
Can you explain what "mirror" is for here?
nweiz
2012/09/05 21:10:42
Done.
|
| */ |
| - Future _clone(String from, String to) { |
| - return runProcess("git", ["clone", from, to]).transform((result) { |
| + 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) { |
| if (!result.success) throw 'Git failed.'; |
| return null; |
| }); |