Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357860

Summary: [client][status] Failed merges cannot be resolved
Product: [ECD] Orion Reporter: John Arthorne <john.arthorne>
Component: GitAssignee: Tomasz Zarna <tomasz.zarna>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: johnjbarton, malgorzata.tomczyk, susan, Szymon.Brandys
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Screen shot none

Description John Arthorne CLA 2011-09-15 14:56:29 EDT
I20110914

Lately I have been getting frequent merge failures when trying to merge remote master when I have commits I have not pushed. The message simply says "FAILED. Go to Git Status page". However I am already on the Git Status page and there is no clear way to resolve the merge. Nothing is showing in unstaged/staged.

At this point I always have to drop to command line and do a "git pull", which generally succeeds without any failure. I can then refresh in Orion and finally push my changes.

Obviously this workflow is blocked if I cannot ssh into the server to perform the command line pull.
Comment 1 John Arthorne CLA 2011-09-15 14:57:08 EDT
Created attachment 203436 [details]
Screen shot
Comment 2 Szymon Brandys CLA 2011-09-26 10:33:34 EDT
Of course the message "FAILED. Go to Git Status page" makes sense only for the git log or git clone pages. On git status, the page should be just refreshed. 

(In reply to comment #0)
> Lately I have been getting frequent merge failures when trying to merge remote
> master when I have commits I have not pushed. The message simply says "FAILED.
> Go to Git Status page". However I am already on the Git Status page and there
> is no clear way to resolve the merge. Nothing is showing in unstaged/staged.

John, do you see any changes to resolve when you refresh the page (F5)?
Comment 3 John Arthorne CLA 2011-09-28 16:26:39 EDT
*** Bug 359259 has been marked as a duplicate of this bug. ***
Comment 4 Tomasz Zarna CLA 2011-09-29 04:57:11 EDT
For the record, in bug 359259 comment 3 Susan suggested that "For 0.3 we could have the FAIL message link to a tips and tricks page. See bug 359271.". Sounds like a good idea to me.
Comment 5 John Arthorne CLA 2011-10-03 13:51:01 EDT
(In reply to comment #2)
> John, do you see any changes to resolve when you refresh the page (F5)?

No. This happened again today, and refreshing showed me nothing. In the browser debugger I can see this JSON response object:

{
  "FailingPaths": {"bundles/org.eclipse.orion.server.authentication.form.core/src/org/eclipse/orion/server/authentication/form/core/FormAuthHelper.java": "DIRTY_WORKTREE"},
  "Result": "FAILED"
}

However I don't see any unstaged or staged changes when I refresh the status page. Using Git command line I get this:

C:\1target\eclipseweb\org.eclipse.orion.server>git status
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 4 and 9 different commit(s) each, respectively.
#
nothing to commit (working directory clean)
Comment 6 John Arthorne CLA 2011-10-03 13:57:35 EDT
In this case invoking merge on the command line succeeded with no conflict. So it looks like JGit believed there was a conflict and there wasn't. Perhaps a line terminator problem?
Comment 7 John Arthorne CLA 2011-10-04 10:22:45 EDT
I noticed in this case the error response to the client includes "DIRTY_WORKTREE". This suggests to me we can do slightly better than a link to a wiki page of hints and tricks. In this case if we know the problem is a dirty working tree, we can offer a message similar to what you get on the command line in this case (Merge failed because you have uncommitted changes in your working tree. Commit or reset your changes and try again).
Comment 8 Tomasz Zarna CLA 2011-10-05 07:46:32 EDT
(In reply to comment #6)
> In this case invoking merge on the command line succeeded with no conflict. So
> it looks like JGit believed there was a conflict and there wasn't. Perhaps a
> line terminator problem?

May be, however, if you had cloned the repo with Orion this shouldn't be an issue. It's when you link a repo cloned with CGit, you're asking for trouble.

I tried to reproduce it by setting my repo as described in comment 5:

git checkout c42295bdf1338dc6e21a4996cc5ff4961f03ab2f
git branch -b john1
git checkout 617fd5ac2c037e1b023076bc4e414549da77bc65 
git branch -b master1
git checkout john1

Then I switched to  Orion and merged "john1" (active) with "master1". It went fine. The only glitch I noticed was a progress message saying "MERGED. Go to Git Status page.", which makes little sense if the merge was successful.
Comment 9 Susan McCourt CLA 2012-02-07 13:28:57 EST
*** Bug 370853 has been marked as a duplicate of this bug. ***
Comment 10 John J. Barton CLA 2012-02-07 13:37:13 EST
Just my experience with this one:
  I had three commits. I used the CherryPick to apply two of them successfully, then checked out one file related to the third commit and then the merge was successful.

I think the model of "FAILED Go to Git Status Page" is itself a bug: I'm already on the Git Status page.
Comment 11 Susan McCourt CLA 2012-02-07 13:40:21 EST
(In reply to comment #10)
> Just my experience with this one:
>   I had three commits. I used the CherryPick to apply two of them successfully,
> then checked out one file related to the third commit and then the merge was
> successful.
> 
> I think the model of "FAILED Go to Git Status Page" is itself a bug: I'm
> already on the Git Status page.

agree.  So is "Merged.  Go to Git Status Page"
We should at least fix these messages for the git status case.
Comment 12 John Arthorne CLA 2012-02-10 12:43:53 EST
The case that still fails badly is when you attempt a merge or rebase when you have staged but uncommitted changes. In this case you click "Fetch" or "Rebase" and absolutely nothing happens. No error message and it seems to do nothing. Just hit this again today in I20120210.
Comment 13 Tomasz Zarna CLA 2012-02-14 10:13:53 EST
(In reply to comment #12)
> The case that still fails badly is when you attempt a merge or rebase when you
> have staged but uncommitted changes. 

I've tried some trivial cases today and they all worked for me. They either succeeded or failed with a message about conflicts. John it would be great if you could help me with some steps.

> In this case you click "Fetch" or "Rebase"
> and absolutely nothing happens. No error message and it seems to do nothing.

"Fetch" should be neutral to your active branch as it affects a remote branch. I'm not following the current shape of the progress handling, but I would assume "nothing happens" is a signal that all went well, Gosia? Unless you know that there are commits on the remote and the "Fetch" doesn't fetch them.

As for "Rebase", again from a quick look it worked fine to me, but obviously I'm missing a real life situation.

Is the Git console and git support in Orion (JGit) divergence, mentioned in comment 6 still an issue?
Comment 14 John J. Barton CLA 2012-02-14 11:55:21 EST
(In reply to comment #13)t seems to do nothing.
> 
> "Fetch" should be neutral to your active branch as it affects a remote branch.
> I'm not following the current shape of the progress handling, but I would
> assume "nothing happens" is a signal that all went well, Gosia? Unless you know
> that there are commits on the remote and the "Fetch" doesn't fetch them

No, this is a bug. Users need feedback, even the command line says "already up to date". How can I tell if I'm update date, the Fetch never succeeded or the tool is just broken?
Comment 15 Tomasz Zarna CLA 2012-02-15 05:28:08 EST
(In reply to comment #14)
> No, this is a bug. Users need feedback, even the command line says "already up
> to date".

You're right. I asked Szymon about it and he confirmed the "Ok" responses are not displayed to the user. You can find them after clicking on the operations spinner in the top right corner, but I agree they should be more visible. Please leave a comment mentioning it on bug 371261 which is more about handling progress messages, while this one is for failing merge/rebase.
Comment 16 Malgorzata Janczarska CLA 2012-02-15 05:29:27 EST
If fetch was run as a task then you'll see the task as completed in the task list for about 5 minutes. The rest depends on the command implementation.
Comment 17 John Arthorne CLA 2012-02-15 10:55:01 EST
I meant to say merge and rebase.. not fetch. The case is very simple:

 - On Git Status page, stage a change but don't commit
 - On Repositories page, click Fetch and then Merge on same branch

-> Fails. There is no message shown to the user, or in the console. Reviewing the network traffic, I can see the POST method has a 200 OK response, but has this body:

{
  "FailingPaths": {"bundles/org.eclipse.orion.client.core/about.html": "DIRTY_INDEX"},
  "Result": "FAILED"
}
Comment 18 John Arthorne CLA 2012-02-15 10:56:38 EST
Same use case, but using Rebase:

POST request looks like this:

{"Rebase":"origin/master","Operation":"BEGIN"}:

POST response is 200 OK with this body:

{"Result": "FAILED"}

Nothing is shown to the user or in the console.
Comment 19 John Arthorne CLA 2012-02-15 10:58:19 EST
*** Bug 371617 has been marked as a duplicate of this bug. ***
Comment 20 Tomasz Zarna CLA 2012-02-16 08:59:25 EST
Szymon has fixed it yesterday[1]. For merge the message now stays on and says: "FAILED: Go to Git Status page.", for a failed rebase it does even better job saying: "FAILED_PENDING_CHANGES. Repository contains pending changes. Please commit or stash them. Go to Git Status page."

[1] bug 370235

*** This bug has been marked as a duplicate of bug 370235 ***