Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Unified Diff: utils/pub/git_source.dart

Issue 10913077: Use a bare git repository for the repo cache. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | utils/tests/pub/pub_install_git_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
});
« no previous file with comments | « no previous file | utils/tests/pub/pub_install_git_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698