Change By: Andre Dietisheim (13/Jun/12 10:17 AM)
Description: Steps to reproduce:

1) EXEC: create myapp in tools with openshift in ~/git/myapp
2) EXEC: take the git url and clone the app into a separate directory (to simulate other changes)
mkdir temp
cd temp
git clone ssh:<specifichost>/myapp.git/ 
cd myapp
3) EXEC: edit README or some other existing file
4) EXEC: git commit -m "external change" README
5) EXEC: git push
<ton of output>

6) ASSERT: push now fails: cd ~/git/myapp
git push will now fail with something like:

$ git push ~/git/appmy
To ssh://b8ab8a46a2984d16b1666f3b172c4199@appmy-man.rhcloud.com/~/git/appmy.git/
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'ssh://b8ab8a46a2984d16b1666f3b172c4199@appmy-man.rhcloud.com/~/git/appmy.git/'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.

Thus when trying to publish from tools it should not let you push and it should ask you before pushing with force.

7) EXEC: Publish your app with the server adapter:
After [https://issues.jboss.org/browse/JBIDE-12138] has been fixed, user is prompted with a dialog that proposes to perform a "push force".
While the operation seems to execute correctly, the following error is reported in the Error Log:

{code}
org.eclipse.jgit.api.errors.JGitInternalException: Exception caught during execution of push command
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:156)
at org.eclipse.egit.core.op.PushOperation.run(PushOperation.java:194)
at org.jboss.tools.openshift.egit.core.EGitUtils.push(EGitUtils.java:429)
at org.jboss.tools.openshift.egit.core.EGitUtils.pushForce(EGitUtils.java:418)
at org.jboss.tools.openshift.express.internal.core.behaviour.ExpressPublishMethod.commitAndPushProject(ExpressPublishMethod.java:237)
at org.jboss.tools.openshift.express.internal.core.behaviour.ExpressPublishMethod.publishFinish(ExpressPublishMethod.java:80)
at org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior.publishFinish(DeployableServerBehavior.java:94)
at org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior.publishFinish(DelegatingServerBehavior.java:147)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:974)
at org.jboss.tools.openshift.express.internal.core.behaviour.ExpressBehaviour.publish(ExpressBehaviour.java:27)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
at org.jboss.tools.openshift.express.internal.core.behaviour.ExpressBehaviour.publish(ExpressBehaviour.java:34)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3087)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.errors.TransportException: ssh://7ddb1e3809e54c969a568dd03889e90f@as-minipaas.example.com/~/git/as.git/: Missing tree ecdd261c53993ae777f379662b52ceec35c2f7ed
at org.eclipse.jgit.transport.BasePackPushConnection.doPush(BasePackPushConnection.java:186)
at org.eclipse.jgit.transport.BasePackPushConnection.push(BasePackPushConnection.java:126)
at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:141)
at org.eclipse.jgit.transport.Transport.push(Transport.java:1120)
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:152)
... 14 more
Caused by: org.eclipse.jgit.errors.MissingObjectException: Missing tree ecdd261c53993ae777f379662b52ceec35c2f7ed
at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:126)
at org.eclipse.jgit.revwalk.ObjectWalk.newTreeVisit(ObjectWalk.java:726)
at org.eclipse.jgit.revwalk.ObjectWalk.nextObject(ObjectWalk.java:378)
at org.eclipse.jgit.storage.pack.PackWriter.findObjectsToPack(PackWriter.java:1706)
at org.eclipse.jgit.storage.pack.PackWriter.preparePack(PackWriter.java:707)
at org.eclipse.jgit.storage.pack.PackWriter.preparePack(PackWriter.java:670)
at org.eclipse.jgit.transport.BasePackPushConnection.writePack(BasePackPushConnection.java:265)
at org.eclipse.jgit.transport.BasePackPushConnection.doPush(BasePackPushConnection.java:168)
... 18 more
{code}

Result:
Going back to cmdline, it seems that the git repository is corrupted:
{code}
$ git fsck
broken link from  commit 70b2d1cf4705c118e5cac62d0c754df69f09fa32
              to    tree b0e5eab13c7d5ca0d3e5b22418234bfb2b57e91e
missing blob 244cfe40684de36646d426ace17041cd25605cb2
missing tree b0e5eab13c7d5ca0d3e5b22418234bfb2b57e91e
{code}

In the UI you'll see the following:
The *.settings* folder is not tracked, while the *.jsdtscope* within it is added & committed:

!settings-untracked-jsdtscope-committed.png!
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira