Make "Remove from Index" work for initial repository (no HEAD)

Uses RmCommand with setCached(true) in case there is not yet a HEAD.

Bug: 395566
Change-Id: Idf6907d743f18a29dadff0d963f3c9780927849e
Improve precision of detached head decoration

For decorations in EGit we want to display the name used for checking
out a tag. If a tag was checked out HEAD points to a commitId directly,
but the reflog contains the tag name used. Scan the reflog and use the
latest checkout whose refname resolves to the same commit as HEAD.

If not try, as before, to find any matching ref and use the one last
updated.

Bug: 385392
Change-Id: Icb10545a1e503a98fd9ea98fbb6770c37a9e4bfe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Fix broken UI tests

GitRepositoriesViewBranchHandlingTest and MergeToolTest stopped working
recently. This was caused by fff7705c introducing a NPE when decorating
light-weight tags and a stale cashed SWTBot bot instance.

Bug: 397376
Change-Id: I8f7846ada5a0e240d3bd38ba7083016c04ec6a6c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Do not try to update indexdiff if workspace is closed

Bug: 396900
Change-Id: I7d8de513844649332552360f036221ad4a8bdc4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Robin Stocker <robin@nibor.org>
Also enable Merge Tool for conflicts caused by stash

Check index diff for conflicting files contained in the selection
instead of repository state. This should be more reliable.

This depends on the previous change for the ResourceUtil changes.

Bug: 376135
Change-Id: I9e14c491254ea1927c4b57989e8282d657945685
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Wait for index diff cache before calling merge tool in UI test

In I9e14c491254ea1927c4b57989e8282d657945685, MergeToolActionHandler was
changed to use the IndexDiffCache for enablement. So wait for that
before trying to use the action.

Change-Id: Ia122184c482e37bb8486221fbbd12814b336581b
Fix NPE when fetching from Gerrit

Bug: 397399
Change-Id: Ie0b6f0097e452c7c5d2dee5cf792a39271ca3988
Fix state of radio buttons in Fetch from Gerrit Page

The issue was when initializing from the clipboard

Change-Id: Ic3a11c0f5049ed7f698f93946897a130f9c02c4b
Show reason for failure in MergeResultDialog

Not seeing the reason for failure is very confusing for users. 

Change-Id: Icf7480a0b66df9d19b036bfde96b6ed89a8d51d5
Use compiler settings from JGit (mostly)

Change-Id: Id594dc712bf08d8b04e9340ab154b897b95d0819
Make Synchronize view UI tests stable

There were a few things contributing to the instability:

- The test setup was only done once in @BeforeClass and then "cleaned
  up" by doing a reset twice and waiting. Setup is now done in @Before
  and a complete cleanup is done in @After, so that test execution order
  does not affect the outcome.

- Switching between "Git Commits" and "Workspace" models was done by
  clicking on the drop down in the Synchronize view toolbar, which is
  very fragile. The desired model is now enabled via team API once for
  each test class.

With this, 2 tests no longer need to be ignored and all tests succeed
reliably on my machine.

Bug: 371633
Change-Id: I9270868e7ce8a599b7c42f3b9b7b3df37eff2c93
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Fix NPE in IndexDiffCacheEntry.calcIndexDiffData (incremental)

When an incremental refresh is done before any full refresh,
indexDiffData is null, which could lead to an NPE. So do a full refresh
instead when no prior indexDiffData is available.

This can happen because full reload jobs cancel each other, whereas an
incremental reload job is never cancelled. Whether this is desired
should be investigated separately.

This change also renames the methods for more clarity.

Bug: 396940
Change-Id: Icbacef742d498a91d579db41c27ae88d6a523729
Merge "Fix NPE in IndexDiffCacheEntry.calcIndexDiffData (incremental)"
Support git --no-ff as an EGit preference

Bug: 336933
Change-Id: I22471ee4c8be0ad094976137aa01c263e17f841d
Simplify Eclipse setup for EGit developers

This provides a quick way to install the tools typically used by
JGit/EGit contributors. In addition it provides an alternative to using
a target platform for provisioning 3rd party dependencies required to
compile and test JGit and EGit. Using a target platform is more accurate
as it allows to separate the dependencies of the workbench used for
development from the one used for testing. But using a target platform
is typically slower since PDE tries to communicate with p2 repositories
listed in the target platform.

In order to install dependencies and plugins typically used by EGit
developers click "Import... > Install > Install Software Items from
File" and select this p2f file, then select the bundles you want to
install and click OK.

Change-Id: I84709b302297e8ad9fb8c1b11d2edb85c7f03c57
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Merge "Simplify Eclipse setup for EGit developers"
Rephrase Open In Editor in the content menu in history filediff pane

The term editor implies `editable´ which is misleading since it's
read only.

Change-Id: If531678219c22a4b4c22e99c922a60c055f03ae9
Signed-off-by: Robin Stocker <robin@nibor.org>
Show untracked files if required by preferences

The "show untracked" dialog setting in the commit dialog is not
synchronized with the "include untracked" preference option. This is
wrong because both are related. If the preference setting is true then
untracked files are checked but they may not be visible in the commit
dialog.

This commits links the enabled states together. As a result, when
the preference is set to true, the action "show untracked" will always
be enabled when the commit dialog pops up.

Change-Id: I295b667469420a48299fd454f402c416e17aba27
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Signed-off-by: Robin Stocker <robin@nibor.org>
GitMoveDeleteHook: Cancel move if it would affect unmerged file

Before this change, the index entries belonging to the unmerged path
would get into a "funny" state.

The only good alternative to canceling the move would be to preserve the
index entries under the new path. C Git aborts with an error when doing
"git mv", so we do the same now.

Bug: 391857
Change-Id: I0477f62c9f4997890ea15f1228413f33473577c8
Use model compare input if possible

The implementation of 'asCompareInput' may hijacked any comparison
using model providers through the synchronize view. Even when
double-clicking on files that are part of a model, only the "git" model
would have been allowed to provide comparison input. This is a
limitation of the current synchronize model that happens when a file
from the local workspace is compared but without considering the working
copy contents (i.e. HEAD).

This commits works around the limitation by allowing the model compare
adapter to be used when possible, i.e. a comparison with the local
workspace is performed.

Bug: 393225
Also-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Change-Id: I69c3e36b74f8eee7755a55ec9f8f4cc42149fef7