-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Describe the bug
With this line:
betterer/packages/betterer/src/fs/git.ts
Line 19 in 1823818
| this._rootDir = path.dirname(this._gitDir); |
It assumes the rootDir must be the parent of the gitDir, which is not the case for git submodule.
In a git submodule, the gitDir is ../.git/modules/<submodule>, while the baseDir is ../.git/modules.
Since the value of the baseDir is wrong, hence encountering this git error when running betterer:
fatal: Not a valid object name HEAD
The error above is encountered when this line is executed:
betterer/packages/betterer/src/fs/git.ts
Line 90 in 1823818
| const tree = await this._git.raw(['ls-tree', '--full-tree', '-r', 'HEAD']); |
To Reproduce
Run betterer inside a git submodule.
Expected behavior
Betterer should run without the error mentioned above in a git submodule.
Screenshots
Versions (please complete the following information):
- OS: [e.g. Windows, MacOS]
macOS 10.15.6 - Betterer Version [e.g. 4.*]
v4.4.0 - Node Version [e.g. 14.*]
v12.22.2
Debug log:
$ cross-env NODE_OPTIONS="--max_old_space_size=4608" betterer --tsconfig tsconfig.betterer.json --strict --debug
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Additional context
N/A
