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

Unified Diff: utils/tests/pub/test_pub.dart

Issue 11266027: Explicitly create a git config in the test repos. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/test_pub.dart
diff --git a/utils/tests/pub/test_pub.dart b/utils/tests/pub/test_pub.dart
index 6b464097bf8060229758efe2f770a59d02d713ef..5a018c611901313f3228b0eb8515d942fe5d9f06 100644
--- a/utils/tests/pub/test_pub.dart
+++ b/utils/tests/pub/test_pub.dart
@@ -992,30 +992,21 @@ class GitRepoDescriptor extends DirectoryDescriptor {
* Creates the Git repository and commits the contents.
*/
Future<Directory> create(parentDir) {
- var workingDir;
- Future runGit(List<String> args) => _runGit(args, workingDir);
-
- return super.create(parentDir).chain((rootDir) {
- workingDir = rootDir;
- return runGit(['init']);
- }).chain((_) => runGit(['add', '.']))
- .chain((_) => runGit(['commit', '-m', 'initial commit',
- '--author="Pub Test <pub@dartlang.org>"']))
- .transform((_) => workingDir);
+ return _runGitCommands(parentDir, [
+ ['init'],
+ ['add', '.'],
+ ['commit', '-m', 'initial commit']
+ ]);
}
/**
* Commits any changes to the Git repository.
*/
Future commit(parentDir) {
- var workingDir;
- Future runGit(List<String> args) => _runGit(args, workingDir);
-
- return super.create(parentDir).chain((rootDir) {
- workingDir = rootDir;
- return runGit(['add', '.']);
- }).chain((_) => runGit(['commit', '-m', 'update',
- '--author="Pub Test <pub@dartlang.org>"']));
+ return _runGitCommands(parentDir, [
+ ['add', '.'],
+ ['commit', '-m', 'update']
+ ]);
}
/**
@@ -1029,10 +1020,8 @@ class GitRepoDescriptor extends DirectoryDescriptor {
*/
Future<String> revParse(String ref) {
var completer = new Completer<String>();
- // TODO(nweiz): inline this once issue 3197 is fixed
- var superCreate = super.create;
_schedule((parentDir) {
- return superCreate(parentDir).chain((rootDir) {
+ return super.create(parentDir).chain((rootDir) {
return _runGit(['rev-parse', ref], rootDir);
}).transform((output) {
completer.complete(output[0]);
@@ -1050,6 +1039,25 @@ class GitRepoDescriptor extends DirectoryDescriptor {
});
}
+ Future _runGitCommands(String parentDir, List<List<String>> commands) {
+ var workingDir;
+
+ Future runGitStep(_) {
+ if (commands.isEmpty) return new Future.immediate(workingDir);
+ var command = commands.removeAt(0);
+ return _runGit(command, workingDir).chain(runGitStep);
+ }
+
+ return super.create(parentDir).chain((rootDir) {
+ workingDir = rootDir;
+ return writeTextFile(join(parentDir, '.gitconfig'), '''
+[user]
+ name = Test Pub
+ email = pub@dartlang.org
+''');
+ }).chain(runGitStep);
+ }
+
Future<String> _runGit(List<String> args, Directory workingDir) {
return runGit(args, workingDir: workingDir.path).transform((result) {
if (!result.success) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698