You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
submodule - name of repository which is submodule of repo
After updating to v10.0.0 MERGE_* files are lost when merging branch with conflicts in case of repository with submodules. I think it is connected to #756 .
Normally when using git repository /Users/path-to-repo/repo/.git/ is a folder and MERGE_* files are created inside it. But when using submodules feature /Users/pathpath-to-repo/repo/submodule/.git is a file containing path to actual .git directory, for example gitdir: ../.git/modules/submodule. So /Users/path-to-repo/repo/submodule/.git is a file, containing path to /Users/path-to-repo/repo/.git/modules/submodule/ which is a proper directory where all MERGE_* files are really kept.
From the debug logs I can see that lint-staged is reading MERGE_* files from wrong path: lint-staged:file Reading buffer from file '/Users/path-to-repo/repo/submodule/.git/MERGE_HEAD'
but it should read it from /Users/path-to-repo/repo/.git/modules/submodule/MERGE_HEAD
Steps to reproduce
Have repository which is using submodules
In one of the modules merge branch with conflicts
after lint-staged is run MERGE message and MERGE_HEAD are lost
if you fill in commit message you should also get fatal: could not open '/Users/path-to-repo/repo/.git/modules/submodule/MERGE_HEAD' for reading: No such file or directory
Thanks for the good issue description, @armata007! I'll take a look. Should be straightforward as long as we can detect that the current dir is a submodule.
@armata007 Do you think you could manually test that my fix works? You can clone this GitHub repo locally, then check out the branch submodule-merge-conflict and then swap the lint-staged bin to point to the checked out repo like <repo_location>/bin/lint-staged.
So something like:
cd /path/to/github-repositories
git clone git@github.com:okonet/lint-staged.git
cd lint-staged
git checkout submodule-merge-conflict
yarn
After this edit your husky/whatever script to run /path/to/github-repositories/lint-staged/bin/lint-staged.
Description
Some naming I use in issue below:
After updating to v10.0.0 MERGE_* files are lost when merging branch with conflicts in case of repository with submodules. I think it is connected to #756 .
Normally when using git repository /Users/path-to-repo/repo/.git/ is a folder and MERGE_* files are created inside it. But when using submodules feature /Users/pathpath-to-repo/repo/submodule/.git is a file containing path to actual .git directory, for example
gitdir: ../.git/modules/submodule
. So /Users/path-to-repo/repo/submodule/.git is a file, containing path to /Users/path-to-repo/repo/.git/modules/submodule/ which is a proper directory where all MERGE_* files are really kept.From the debug logs I can see that lint-staged is reading MERGE_* files from wrong path:
lint-staged:file Reading buffer from file '/Users/path-to-repo/repo/submodule/.git/MERGE_HEAD'
but it should read it from /Users/path-to-repo/repo/.git/modules/submodule/MERGE_HEAD
Steps to reproduce
fatal: could not open '/Users/path-to-repo/repo/.git/modules/submodule/MERGE_HEAD' for reading: No such file or directory
Debug Logs
expand to view
Environment
lint-staged
: v10.0.0The text was updated successfully, but these errors were encountered: