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

Unified Diff: sdk/lib/_internal/pub_generated/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart

Issue 831983005: Properly detect if git revisions aren't in a git repository. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | « sdk/lib/_internal/pub_generated/lib/src/source/git.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub_generated/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
diff --git a/sdk/lib/_internal/pub_generated/test/get/git/check_out_and_upgrade_test.dart b/sdk/lib/_internal/pub_generated/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
similarity index 55%
copy from sdk/lib/_internal/pub_generated/test/get/git/check_out_and_upgrade_test.dart
copy to sdk/lib/_internal/pub_generated/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
index 99366642bac835a7ea66c896beca5681eea36a59..277f2d189a60934f6ddb077085ed2314dce494be 100644
--- a/sdk/lib/_internal/pub_generated/test/get/git/check_out_and_upgrade_test.dart
+++ b/sdk/lib/_internal/pub_generated/test/get/git/check_out_unfetched_revision_of_cached_repo_test.dart
@@ -4,16 +4,24 @@
library pub_tests;
+import 'package:path/path.dart' as p;
import 'package:scheduled_test/scheduled_test.dart';
+import '../../../lib/src/io.dart';
import '../../descriptor.dart' as d;
import '../../test_pub.dart';
main() {
initConfig();
- integration('checks out and upgrades a package from Git', () {
+ // Regression test for issue 20947.
+ integration(
+ 'checks out an unfetched and locked revision of a cached ' 'repository',
+ () {
ensureGit();
+ // In order to get a lockfile that refers to a newer revision than is in the
+ // cache, we'll switch between two caches. First we ensure that the repo is
+ // in the first cache.
d.git('foo.git', [d.libDir('foo'), d.libPubspec('foo', '1.0.0')]).create();
d.appDir({
@@ -24,27 +32,28 @@ main() {
pubGet();
- d.dir(
- cachePath,
- [
- d.dir(
- 'git',
- [
- d.dir('cache', [d.gitPackageRepoCacheDir('foo')]),
- d.gitPackageRevisionCacheDir('foo')])]).validate();
-
- d.dir(
- packagesPath,
- [d.dir('foo', [d.file('foo.dart', 'main() => "foo";')])]).validate();
+ // Switch to a new cache.
+ schedule(
+ () =>
+ renameDir(p.join(sandboxDir, cachePath), p.join(sandboxDir, "$cachePath.old")));
+ // Make the lockfile point to a new revision of the git repository.
d.git(
'foo.git',
[d.libDir('foo', 'foo 2'), d.libPubspec('foo', '1.0.0')]).commit();
pubUpgrade(output: contains("Changed 1 dependency!"));
- // When we download a new version of the git package, we should re-use the
- // git/cache directory but create a new git/ directory.
+ // Switch back to the old cache.
+ schedule(() {
+ var cacheDir = p.join(sandboxDir, cachePath);
+ deleteEntry(cacheDir);
+ renameDir(p.join(sandboxDir, "$cachePath.old"), cacheDir);
+ });
+
+ // Get the updated version of the git dependency based on the lockfile.
+ pubGet();
+
d.dir(
cachePath,
[
« no previous file with comments | « sdk/lib/_internal/pub_generated/lib/src/source/git.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698