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; |