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

Unified Diff: lib/src/package.dart

Issue 1317043002: React gracefully to a fully-.gitignored package. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 4 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 | « lib/src/git.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/package.dart
diff --git a/lib/src/package.dart b/lib/src/package.dart
index 28af288d66e38e29e11a25a44a410d2e59a7bcc6..1a192c400c3e1b37666e92952bb78ab84ce1afb5 100644
--- a/lib/src/package.dart
+++ b/lib/src/package.dart
@@ -115,12 +115,12 @@ class Package {
if (dir == null || !git.isInstalled) {
_inGitRepoCache = false;
} else {
- try {
- git.runSync(['rev-parse'], workingDir: dir);
- _inGitRepoCache = true;
- } on git.GitException catch (_) {
- _inGitRepoCache = false;
- }
+ // If the entire package directory is ignored, don't consider it part of a
+ // git repo. `git check-ignore` will return a status code of 0 for
+ // ignored, 1 for not ignored, and 128 for not a Git repo.
+ var result = runProcessSync(git.command, ['check-ignore', '--quiet', '.'],
+ workingDir: dir);
+ _inGitRepoCache = result.exitCode == 1;
Bob Nystrom 2015/08/26 23:19:02 Instead of making git.command public, how about mo
nweiz 2015/08/27 19:04:33 I'll do this if you want, but I think a lot of the
}
return _inGitRepoCache;
« no previous file with comments | « lib/src/git.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698