Unable to add subproject to commit [message #1835488] |
Fri, 04 December 2020 15:38 |
Jonathan Pierre Messages: 2 Registered: December 2020 |
Junior Member |
|
|
For a while, I've had a java project in my Eclipse workspace that is connected to a Git repository owned/controlled by my organization (hosted by Bitbucket). Then I created another java project and tried to include that with the branch the first project was a part of (it was months ago, so I don't remember how I linked it).
The problem I've been having is when I try to commit and push the second project. Changes to the first project are handled correctly and are included when pushed to the repo. The second project, however, appears in the list of unstaged changes (one listing for the whole project) and when I try to add it to the index, nothing happens; it stays in the list of unstaged changes. However, the project display shows that it is part of the branch I try to push it to.
When I try to change something in one of the files in the second project, there is no visible indication that a change has been made (no right arrow at the start of the file name). When I downloaded the last commit of the branch from the repo, the first project folder was fine and contained the contents of the project, but the second project folder was just empty. When I look at the commit in which I first committed the second project I see the addition of it as a subproject (though the second project is not within the first, but on the same level as it) , but nothing else.
Is this a bug or is there something I've been doing wrong?
The Eclipse version is 2019-06 (4.12.0)
|
|
|
|
Re: Unable to add subproject to commit [message #1835519 is a reply to message #1835488] |
Sat, 05 December 2020 16:35 |
Thomas Wolf Messages: 576 Registered: August 2016 |
Senior Member |
|
|
I suspect this is the clue:
Jonathan Pierre wrote on Fri, 04 December 2020 15:38... (it was months ago, so I don't remember how I linked it).
What do mean by "linked it"? Where on the disk is your second project? If it is not in the git working tree, git will not commit it, and won't be aware of changes you make in it.
I'd expect to see what you describe if you had used a symbolic link. (Single entry in unstaged changes for the whole project.) The next bit ("when I try to add it to the index, nothing happens; it stays in the list of unstaged changes") is a bit of a mystery, unless you're on Windows, where JGit cannot handle "symbolic links". (JGit is the Java git library used in Eclipse. Windows doesn't really have symbolic links; I think for directories they have something called "junctions", and JGit definitely cannot handle those.)
Generally, you'd create the second project by choosing New...->Project in the context menu of Eclipse's package or project explorer. Once the project is set up, you'd then choose Team...->Share Project... and share it with the git repository you want it to be in. That operation will move the project's files and directories inside the git working tree directory. (In Eclipse, the project will still appear unchanged, unless you examine the on-disk paths via Properties.)
Then commit.
|
|
|
|
Re: Unable to add subproject to commit [message #1837437 is a reply to message #1837411] |
Fri, 29 January 2021 22:37 |
Thomas Wolf Messages: 576 Registered: August 2016 |
Senior Member |
|
|
Team->Disconnect won't move the project, so you'll likely end up in the same situation. I'm not equipped to track this down on Windows (I have no Windows machine available, only a super-slow VM; working normally on OS X or Linux). To really figure this out you'd need someone to examine this is situ on your machine.
My next best suggestion would be:
- zip the whole project directory, put this zip file aside.
- Then delete the project in Eclipse, then delete the whole project directory in Windows Explorer.
- Unzip the previously created zip archive somewhere, say, in some subfolder of your home directory.
- In Eclipse, choose "Import..."->"Import existing projects". Choose the just unzipped folder, and "copy into workspace".
- Once the project is in Eclipse again, do the Team->Share Project process.
If it really was some symbolic link or junction problem, it should be gone then, and the directory should be a real directory.
If that also doesn't help, find someone who knows git and who can sit down with you to figure this out directly on the machine.
|
|
|
Powered by
FUDForum. Page generated in 0.04302 seconds