Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » EGit ignores my attempt to stage files in one repository
EGit ignores my attempt to stage files in one repository [message #1823385] Wed, 25 March 2020 22:42 Go to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
I seem to have a new egit problem in 2020-03.

In the last hour I've been making code changes in three different repositories. I've been watching files appear in the staging view from time to time. I was about done with making a set of changes, so I started to set up to push those changes to the remote feature branch.

When I move files from "Unstaged changes" to "Staged changes", I use whatever action is convenient. Sometimes I select individual files and click the +, sometimes I click the ++ and then sometimes move extraneous files back to unstaged with the -. This normally works perfectly fine. Sometimes there is a short delay between clicking the action and seeing the files move from unstaged to staged.

When I did this with the three repositories, two of them worked perfectly fine. The third one is doing something really odd. The delay from clicking the action to move from unstaged to staged is very long. Like, infinite. It's not moving the files. There is no error message, it just takes my request to move the files and ignores me. There is no error in the error log.

At this point, I thought to go to the shell and see if there was something odd about the files. This is a repository that is similar to the one that I saw the weird "crlf execute" bug that I posted about in a separate thread. On that note, I'm pretty sure I don't have that problem with any of these files.

The first thing I did was a "git status". The result confused me a bit. It listed files in the "Changes to be committed:". In fact, all of the files listed there were the files I was attempting to copy to staged files. This makes it seem like egit was moving those files to staged files, but just not displaying them. However, it's more than just not displaying them, because when I now try to "Commit and Push...", it says there are no staged files.

At this point, I guess I'll try a couple of things. I will restart Eclipse and see if that fixes its brain damage. If that doesn't work, I can commit from the shell and then push the branch.

Returning to real time, restarting Eclipse WORKED. I went back to that repository, and now the unstaged changes list was empty, and the staged changes list had all my desired changes. I was able to commit and push.
Re: EGit ignores my attempt to stage files in one repository [message #1823412 is a reply to message #1823385] Thu, 26 March 2020 08:57 Go to previous messageGo to next message
Christian Halstrick is currently offline Christian HalstrickFriend
Messages: 274
Registered: July 2009
Senior Member
One tip to find out what is happening is to use pure JGit to call git status etc. Then we get hints whether we have problems in EGit or JGit. I would download [1] and whenever such problems exist open a commandline, cd to the root of your working tree and call 'jgit.sh status' and 'jgit-sh debug-show-dir-cache'.

EGit will present an empty staged area in staging view not when files are missing but when for every path the staged content matches what is currently in HEAD. Therefore it is ok sometimes that you have for a path something in unstaged changes and when you stage it it vanishes from unstaged changes and is also no mentioned in staged changes (because what you have staged matches HEAD content). Like in
git init; echo 1>a; git add a; git commit -m addA; echo 2>a; git add a; git status; echo 1>a; git add a; git status


[1] https://repo.eclipse.org/content/groups/releases//org/eclipse/jgit/org.eclipse.jgit.pgm/5.7.0.202003110725-r/org.eclipse.jgit.pgm-5.7.0.202003110725-r.sh


Ciao
Chris
Re: EGit ignores my attempt to stage files in one repository [message #1855654 is a reply to message #1823412] Tue, 25 October 2022 20:43 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
I am running into this again. I downloaded jgit, but it shows me basically the same thing "git" does. When I ran "status", it showed that the file I changed was in the "modified" list, but not "staged". I ran "jgit debug-show-dir-cache", but I'm not sure what I should see there. I did see one line in that corresponding to the file I had changed, but I didn't see anything unusual in it.

The scenario you describe about a file disappearing from both unstaged and staged does not apply here. The file is in "Unstaged Changes" and refuses to go to "Staged Changes". I've tried all the gestures for moving it.

I was just able to do this successfully a little earlier today, even in the same repository.

There is also nothing significant in the error log.
Re: EGit ignores my attempt to stage files in one repository [message #1855655 is a reply to message #1855654] Tue, 25 October 2022 20:58 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
Ah, ok, looking closer I now understand that if it shows up in the "Changes to be committed" list, that means the file IS staged. It's just not displaying that way in Eclipse. I wonder what will happen if I push this commit from the "Git Staging" view with the "Staged Changes" section empty. I have a feeling it will commit that change.
Re: EGit ignores my attempt to stage files in one repository [message #1855656 is a reply to message #1855655] Tue, 25 October 2022 21:07 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
And .. I was wrong. Despite the fact that git and jgit says the file is in "Changes to be committed:", pushing this did what is shown on the Eclipse display, which is nothing. Running git status again still shows the file in "Changes to be committed:". I have a feeling I will be resetting this repository and doing the changes again. Fortunately, I can just copy the changed file out of the repo and copy it in later.
Re: EGit ignores my attempt to stage files in one repository [message #1855657 is a reply to message #1855656] Tue, 25 October 2022 21:10 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
Actually, I just had to do the commit from the command line, and then I did a "Reset (Hard)" for good measure. Dunno if this is going to happen again.
Re: EGit ignores my attempt to stage files in one repository [message #1855658 is a reply to message #1855657] Tue, 25 October 2022 21:37 Go to previous message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
And when I went on to make additional changes, it was doing it again. I finally just restarted Eclipse, and that fixed the problem.

[Updated on: Tue, 25 October 2022 21:37]

Report message to a moderator

Previous Topic:Could not connect to SSH agent via socket
Next Topic:Jgit pgm cli
Goto Forum:
  


Current Time: Sat Apr 20 04:23:46 GMT 2024

Powered by FUDForum. Page generated in 0.03656 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top