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

Unified Diff: sdk/lib/_internal/pub/lib/src/entrypoint.dart

Issue 342553002: Respect git's ignore rules pervasively in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review, performance improvements Created 6 years, 6 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/lib/src/command/lish.dart ('k') | sdk/lib/_internal/pub/lib/src/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/entrypoint.dart
diff --git a/sdk/lib/_internal/pub/lib/src/entrypoint.dart b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
index ce4d11f614433e0d5ebc2f772e82ceb2d993c0f2..346a077b54653bfe5a48f9316811c8a6535a7bdf 100644
--- a/sdk/lib/_internal/pub/lib/src/entrypoint.dart
+++ b/sdk/lib/_internal/pub/lib/src/entrypoint.dart
@@ -8,7 +8,6 @@ import 'dart:async';
import 'package:path/path.dart' as path;
-import 'git.dart' as git;
import 'io.dart';
import 'lock_file.dart';
import 'log.dart' as log;
@@ -326,50 +325,4 @@ class Entrypoint {
if (entryExists(symlink)) deleteEntry(symlink);
createSymlink(packagesDir, symlink, relative: true);
}
-
- /// The basenames of files that are automatically excluded from archives.
- final _BLACKLISTED_FILES = const ['pubspec.lock'];
-
- /// The basenames of directories that are automatically excluded from
- /// archives.
- final _BLACKLISTED_DIRS = const ['packages'];
-
- /// Returns a list of files that are considered to be part of this package.
- ///
- /// If this is a Git repository, this will respect .gitignore; otherwise, it
- /// will return all non-hidden, non-blacklisted files.
- ///
- /// If [beneath] is passed, this will only return files beneath that path.
- List<String> packageFiles({String beneath}) {
- if (beneath == null) beneath = root.dir;
-
- var files;
- if (git.isInstalled && dirExists(path.join(root.dir, '.git'))) {
- // Later versions of git do not allow a path for ls-files that appears to
- // be outside of the repo, so make sure we give it a relative path.
- var relativeBeneath = path.relative(beneath, from: root.dir);
-
- // List all files that aren't gitignored, including those not checked in
- // to Git.
- files = git.runSync(
- ["ls-files", "--cached", "--others", "--exclude-standard",
- relativeBeneath],
- workingDir: root.dir);
- // Git always prints files relative to the project root, but we want them
- // relative to the working directory. It also prints forward slashes on
- // Windows which we normalize away for easier testing.
- files = files.map((file) => path.normalize(path.join(root.dir, file)));
- } else {
- files = listDir(beneath, recursive: true);
- }
-
- return files.where((file) {
- // Skip directories and broken symlinks.
- if (!fileExists(file)) return false;
-
- var relative = path.relative(file, from: beneath);
- if (_BLACKLISTED_FILES.contains(path.basename(relative))) return false;
- return !path.split(relative).any(_BLACKLISTED_DIRS.contains);
- }).toList();
- }
}
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/command/lish.dart ('k') | sdk/lib/_internal/pub/lib/src/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698