Issue when IDE should manage subfolder's Git but not topfolder Git

Answered

My PhpStorm project is made of several subfolders of a bigger folder. These subfolders have a .git repo each with different origins. And there is a .git repo at the root of the bigger folder, and
I want PhpStorm to only deal with the subfolder's files and with the subfolder's Git repo. The top folder is NOT included in any of the projects directories because I dont want the IDE to deal with the upper folder's GIT at all.

But this is not the case. PhpStorm commits to the subfolder's GITs and when this is done it requests to commit to the upfolder's GIT !

More precisely this happens :
When changes have been commited (to subfolder's GIT by chance), PhpStorm still proposes to commit them to top folder's GIT, which i do not want.
As long as they have not been pushed to subfolder's git, doubleclicking on a file in the changemost produces an error "fatal: Not a valid object name" followed by an unknown revision number and the filename, and i cannot edit the file anymore.
When i have pushed (to subfolder's git, by chance), then the changelist is still there, but at least i can doubleclick on a file and edit it.

On the command line, all I do in subfolder's subtree goes to subfolder's GIT and when i go upper, than commits and pushes go to upper folder's GIT.
I would like to have the same behaviour with PhpStorm and so as to enable this, top folder's GIT is not included in any of the directories that are included in the PhpStorm project.

So question is : how can I tell PhpStorm to not manage upper folder GIT at all ?

Moreover an issue is : there is no git info displayed in the commit or push window -- or i couldnt see any. Am I requested to commit and push blindly without knowing whereto ?
Or is there a way to remind which is the destination repo ?

8 comments
Comment actions Permalink

it looks like the opposite to https://intellij-support.jetbrains.com/hc/en-us/community/posts/207052265-Multiple-git-repositories  except i never want to commit with IDE to the upper level folder's Git repo.

 

0
Comment actions Permalink

Just edit mappings in Settings | Version control. Leave only the root you want to manage.

-1
Comment actions Permalink

@Dmitriy  : The "Settings | Version control" detects and lists the  faulty root repo in the second list as "Unregistered root", so shouldnt it NOT interfere ?? While it's in this "unregistered root" list, I can neither delete nor edit it. All I can do is add it to the active Directory list, which i dont want of course.

BTW In "Settings > Version control > Ignored files", there is no way i can set the top ".git" to be ignored : it's not even listed there, even with "List hiden files" option. Anyway the issue is not to not commit that .git repo as a versionned file, but to ignore it as a repo.

Just in case, I also unchecked "Execute branch operation on all roots" in "Settings > Version control > Git", but it has no effect on this issue.

Beside, in "Settings | Directories", only subfolders are listed. The topfolder with faulty .git is not listed anywhere. 

After PhpStorm has commited to the subfolder's Git repo(s), it keeps detecting the top folder Git repo and wants to commit to it

FYI : the subfolder's gits follow the specific projects i'm working on. The top folder git is the one provided by the webhoster, which i dont use for detailed versionning but for rare global tags.

0
Comment actions Permalink

It seems to be not possible :-/


So as to not bump after every commit into this PhpStorm issue, i rename the topfolder `.git` repo into `.git_hiden` so phpstorm doesnt recognize it as a .git folder. And each time i want to commit to it with the command line i temporarily rename it to . git

0
Comment actions Permalink

> It seems to be not possible

IntelliJ only manages roots that are mapped. So it should be possible and there is some misconfiguration, I believe.

> list as "Unregistered root", so shouldn't it NOT interfere

Yes, Unversioned node is there to make it easy registering roots if necessary. It should not execute any commands against the repo, track changes from it, etc

> I also unchecked "Execute branch operation on all roots"

The checkbox is there only when there are several roots mapped. If only one root is mapped, it is hidden, so looks like there are at least two roots - probably the root one is registered?

> After PhpStorm has committed to the subfolder's Git repo(s), it keeps detecting the top folder Git repo and wants to commit to it

Do you mean that the change is listed in the Local changes, or some prompt appears?

 

Please share a bit info about your project structure, and the content of .idea/vcs.xml from the project folder.

0
Comment actions Permalink

AMOF 2 news, one not so good specialy in this issue's context, one good.

1) even when renamed .git_sav, the .git folder of the top folder is discovered by phpstorm

2) when the project IS the topfolder, this issue doesnt happen anymore !

@Dmitriy-Smirnov To answer your question the situation is as follow :

- htdocs/ site root folder with production host .git (should be ignored by phpStorm)
- several subfolders, some of them having a dedicated .git or .svn repo
- other subfolders phpStorm should never deal with 

At first, i declared the various subfolder to phpStorm, adding each sub-folder as a directory. And the top folder was NOT declared at all to phpStorm.
In this setting, the topfolder's .git was used for secondary commits, even when displayed as "unregistered root".

Then, i deleted all .ideas folders and created a new project anew, this time declaring the top folder as main root and specifying various subfolders to be ignored or not. Since then, the issue does not show anymore.

So the issue only raises when the top folder is not declared to phpstorm as a working directory.

0
Comment actions Permalink
+---.gradle
| +--- [...]
+---.idea
| +--- [...]
+---my-infrastructure
| +--- [...]
+---config
| +--- [...]
+---services
| +---pythonservice1 (Project)
| +---[...]
| +---projectname
| +---src
| | +--- [...]
| \---tests
| +---integration
| \---__pycache__
\ ...

This is the error I get in Contextual Menu > Git > Show history. Which seems to suggest that routing is not being correctly done, because folder "tests", lays way beyond the root of the project (that top folder).

I personally have this problem in both intellij and pycharm.

files 

`fatal: Not a valid object name [commit no.]:tests/my_module.py`

0
Comment actions Permalink

@Miguel Likely there is a separate git root in tests, or at least its traces. Check if there is test/.git folder present, that can be causing the issue. And this is a different issue from what Jluc described

@Jluc sorry for lack of response, I somehow missed your last post. I tried reproducing the issue with a project structure as you described, but it works fine for me. Unless there is a mapping for the root, no changes are recognized there, and all changes in subfolders get committed to respective roots.

Probably, while having the root repo as Unregistered root, you still have a <Project> - Git mapping that results in such behavior, though it should commit to the respective repo even in this case. There is definitely something specific with the configuration in this case, and unfortunately, without logs and some configuration details, it is impossible to troubleshoot.

If it still happens to you, please submit a request to https://youtrack.jetbrains.com/issues/IDEA and attach logs

 

0

Please sign in to leave a comment.