-
-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to detect a source control manager in worktree outside of source repo #93
Comments
For now, I'm using the following patch (with diff --git a/node_modules/pretty-quick/dist/scms/git.js b/node_modules/pretty-quick/dist/scms/git.js
index 13ef4fd..5a1936b 100644
--- a/node_modules/pretty-quick/dist/scms/git.js
+++ b/node_modules/pretty-quick/dist/scms/git.js
@@ -10,6 +10,7 @@ var _findUp = _interopRequireDefault(require("find-up"));
var _execa = _interopRequireDefault(require("execa"));
var _path = require("path");
+var _fs = require("fs");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -17,13 +18,19 @@ const name = 'git';
exports.name = name;
const detect = directory => {
- const gitDirectory = _findUp.default.sync('.git', {
+ const gitDirectory = _findUp.default.sync((p) => {
+ try {
+ _fs.statSync(`${p}/.git`)
+ return '.';
+ } catch (err) {}
+ return undefined;
+ }, {
cwd: directory,
type: 'directory'
});
if (gitDirectory) {
- return (0, _path.dirname)(gitDirectory);
+ return gitDirectory;
}
}; |
I'm having the same problem since git 2.24.0.windows.2 and node v12.13.0.
|
Maybe pretty-quick should use the following commands to find toplevel and git path. git rev-parse --show-toplevel
git rev-parse --git-dir |
This can be closed, as it is fixed in v2.0.1 |
Happening to me with 2.2.1 and Node 13.7.0 |
This is still an issue for me as of 3.1.0. It works for me if I use the patch from @forivall above. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Similar to #90.
git worktree
allows one to use a single git repo with multiple working directories.The
.git
in the worktree is a file that looks like this:and the worktree can be in a different directory than inside the repo, so the
findup
solution doesn't work.The text was updated successfully, but these errors were encountered: