Skip to main content
aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
14 daysSimplify comparator codeMichael Keppler1-8/+2
Use lambda style comparators where possible. They are easier to read. Change-Id: I21ce3ad901851f2fba70ea5d661ea31afd7b9b6d Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2019-11-22[tests] Try to stabilize IndexDiffCacheTestThomas Wolf1-24/+62
This test waits for a listener to be called. IndexDiff calculations happen in the background. So when several files are added to the workspace, several calculations may get scheduled, and the test may end up not waiting long enough to pick up the expected change but operate on an IndexDiff computed before the wanted file was added. Run multiple workspace changes in a workspace operation with IWorkspace.AVOID_UPDATE. Change-Id: Ia58db7a5f9ad1cf7dedec387d8b4499a87c69fbc Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-10-10Rely on synchronous ResourceRefreshHandler to refresh after checkoutMatthias Sohn1-12/+2
- Convert asynchronous ResourceRefreshJob to a synchronous ResourceRefreshHandler. - Move it to EGit core since it does not depend on the UI. - Remove merging of multiple WorkingTreeChanges and progress monitors since that's not necessary when refreshing synchronously. - Unconditionally refresh resources found, even when in projects not shared with EGit. Bug: 551289 Change-Id: I338e4eff366bf2300e347a1da00c2ab0eee6bc14 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-06-27Added option to create light weight tagsMarco Stornelli1-14/+87
When the tag has no message in CreateTagDialog create a lightweight tag instead of an annotated tag. Adds tests for both the UI and for the new "annotated" flag in TagOperation. (Since the lower-level TagOperation allows creating an annotated tag without message, an extra flag is needed.) Bug 438902 Change-Id: I99b53c08f94744f78aabe1c1e57b91d0da587bc7 Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-06-11Handle absolute paths to SSH identity filesThomas Wolf1-0/+65
The list of private keys in Eclipse may contain absolute paths. Only resolve relative paths relative to the configured SSH2 home directory. Bug: 548121 Change-Id: I7ace545e2736c451b625699d07cba438f0e3934b Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-06-10Remove pre-Mars adapter workaroundMichael Keppler1-9/+8
Since our minimum target is Mars, we no longer need the previous workaround for avoiding compiler warnings around adapters. This is not a git revert, but an inline refactoring of the previously introduced method. Also inline AdapterUtils.adapt() in such a way that Adapters.adapt() is called instead. Bug:460685 Change-Id: Idbbe4853f68a9b6d1ffff1f434bdbfb9bc705a80 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2019-05-15Use try-with-resourcesCarsten Hammer1-9/+10
Convert try finally block to try-with-resources Change-Id: I29a482e2bbfe5e9029b41c1fe7a5bf45308905c2 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
2019-04-27Use String.isEmpty() instead of comparing to ""Carsten Hammer1-2/+2
Use of String.equals("") can be replaced with with String.length() == 0 (for JDK5 and lower) or String.isEmpty() (for JDK6 and higher) Change-Id: I278bcc6e7095802469cfe2db24f029bb5dc870a9 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
2019-04-26Remove unnecessary type specificationsCarsten Hammer5-9/+9
Since Java 7 the diamond operator can be used instead of explicit typeparameters. Change-Id: I602e7b1bf45ca1c6612305e655fc4618742d0d4f Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
2019-03-17Fix type-safe warningsMichael Keppler1-4/+4
After the generifying of the adapter methods by Thomas, these were all remaining type-safe warnings. Change-Id: I7c5f485f80ebe6cfd185c0a026e00e27a4f46fbb Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2019-03-16Replace usages of deprecated Repository methodsThomas Wolf1-6/+4
getTags() and peel() are deprecated; replace by equivalent other methods. Change-Id: I1edc2ff88f0f79ea3749a53bf89ffac46d4b4c62 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2019-03-16Fix typo in test method nameMichael Keppler1-1/+1
Change-Id: I1f0a36d2180f9590102846934f96a03d7baa1a6b Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2019-02-05Avoid jobs still running at test shutdownMichael Keppler1-26/+14
Sometimes during tests we have jobs still running. Recent example is https://ci.eclipse.org/egit/job/egit/4991/consoleFull (search for "following jobs"). Therefore increase the timeout from 5 to 10 seconds. 10 seconds have already been used at other places in our tests, and they avoided the message for me locally when experimenting with different values. Since the log output occurs seldom, the increase in test runtime can be ignored (in most cases there will not be any increase). Also correct a Javadoc in that area, and inline one other method (to avoid one more duplication of wrong Javadoc). Change-Id: I14b16d33e493cc9d4a7fe833b1fd29a42f4822b5 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2019-01-03Replace FileInputStream and FileOutputStream with static Files methodsMatthias Sohn2-17/+7
FileInputStream and FileOutputStream rely on finalize() method to ensure resources are closed. This implies they are added to the finalizer queue which causes additional work for the JVM GC process. This is an open bug on the OpenJDK [1] and the recommended workaround is to use the Files.newInputStream and Files.newOutputStream static methods instead. [1] https://bugs.openjdk.java.net/browse/JDK-8080225 Change-Id: I59e72d0a12d70396a5cf558029c13e2a1b0d5741 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2019-01-02Enabled ignored testsMichael Keppler2-11/+4
Disabled tests should always be re-enabled as soon as possible (or deleted). ResourceUtilTest has been adapted to test for the most nested project, caused by the implementation of bug #476585. I'm not sure if we can eventually remove the "innermost" parameter of getFileForLocation by now. Change-Id: I9f343dbb371e124e8e1576dbe2f3693f3b2f1d71 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2019-01-01Fix path related failing tests on WindowsMichael Keppler1-8/+14
* DynamicVariablesTest: IPath.toString() uses a fixed separator "/", therefore the calculated variable value cannot be compared with the Windows file separator. * CommitFileRevisionTest: file revisions in commits are resolved using "/", therefore a relative Windows path cannot be located in the git storage. Change-Id: I9be225654fec285ddd1a4059fffac6058547b668 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-12-02Clear password of crypto API after usageMichael Keppler1-3/+6
The (internally cloned) password of a key spec needs to be cleared after usage. For this unit test this is not really relevant. However, we don't want someone to copy/paste our code into a real security relevant project without having the clearPassword(). Found with Cognicrypt plugin. Change-Id: Ic92a65ca14fc0d528049ba0534d73c4715597ffa Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-11-25Fix Mockito deprecation warningsMichael Keppler1-1/+1
The JUnit runner hierarchy has changed, and the new super class shall be used instead of the previous runner. Change-Id: Ia6fbf8bb875c6fdc7860ecd21e2a39da5af2bd51 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-11-20Have test base classes in new plugin for better reuseMichael Keppler7-1495/+2
* new plugin egit.core.junit * other test plugins/fragments can depend on it * non-test classes for all test bundles/fragments can be added here (moved 5 classes, which are used in multiple test bundles) Bug: 541008 Change-Id: Ib9a3c9c8856a97746c07ab307c0016332cd5f853 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-11-01ConfigureGerritAfterCloneTask - relax matching Gerrit versionMarkus Duft1-0/+29
Relax checking with regards to SSH port and additional suffixes to the version which might appear (-dirty) Change-Id: I95ff82525d034eb5d6804dff8cd5fb1fcdcedfae Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-10-20[releng] Fix deprecated GitBlobStorage constructor usageMichael Keppler1-5/+16
Use the chained constructor instead of the deprecated constructor. Change-Id: Ib2a2e32eca77a883f1ec0f6d76f8200b50293a66 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-10-06Fix typos in Javadoc and test namesMichael Keppler2-3/+3
No functional changes. Change-Id: Id3f0df9f5e33d50a2a1c60e6d05a53a9f3e97fca Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-08-13refactor: simplify collection.toArray()Michael Keppler5-6/+6
On recent VMs, collection.toArray(new T[0]) is faster than collection.toArray(new T[collection.size()]). Since it is also more readable, it should now be the preferred way of collection to array conversion. https://shipilev.net/blog/2016/arrays-wisdom-ancients/ Change-Id: If0c3202aa3ebb2d4e4ea68da8fe431cd8f363826 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-07-02Do not refresh projects that use a PessimisticResourceRuleFactoryThomas Wolf1-12/+10
With some setups where the Eclipse workspace is inside the git working tree EGit may end up trying to refresh a project that needs the workspace root as scheduling rule for a refresh. EGit generally uses multi-rules containing affected projects, though, and thus it may run into an IAE in that case. EGit-managed projects use an optimistic rule factory that uses the project itself as scheduling rule. So do normal unshared projects. So this can only occur if there are projects inside the git working tree that are not shared with EGit but with some other provider that does not use an optimistic rule factory. This is a rare occurrence, and such projects had better be git-ignored, too. Not refreshing such projects is a thus viable approach. Bug: 536472 Change-Id: I17c06fd69e232a7b864a98c4e95598fa7ab6b7b0 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-06-30Fix typo in test method nameMichael Keppler1-2/+2
Change-Id: Ifa2b84a2cda71c95cebccaef40bcbd525bf073c9 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-05-29Update license to EPL-2.0Matthias Sohn75-150/+300
Bug: 530393 Change-Id: Iea3b247253a97c28043187df0e35daecf518011e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2018-05-12Merge "Respect gitattributes in the compare editor"Matthias Sohn2-11/+344
2018-05-05Respect gitattributes in the compare editorThomas Wolf2-11/+344
Apply smudge/clean filters. Store the filters to be applied when we create the internal GitBlobStorage and apply them when the stream is opened. Unfortunately this requires quite a few interface changes to pass through CheckoutMetadata. Adds tests for the new behavior, including index edits. Bug: 520693 Change-Id: If7696501f3e1b8f6d99518915b7292e268d656bd Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2018-05-05Replace deprecated getRefs() callsMichael Keppler1-1/+2
getRefs() was recently deprecated for a new method getRefsByPrefix() in I4c92f852e8c1558095dd460b5fd7b602c1d82df1. This change redirects the majority of calls to the new method. 12 calls have not been replaced, since they are either part of public API or they actually use the keys of the formerly returned maps. Change-Id: Ie975212e7ebe4225de920043522d8d63a9bea229 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
2018-03-09Remove deprecated IgnoreOperation#IgnoreOperation(IResource[])Matthias Sohn1-2/+5
Use #IgnoreOperation(Collection) instead. Change-Id: If991ff4f89762dae5cf6caa892103e003441b93b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-09-26Partially revert "Remove repository from ListRemoteOperation"Thomas Wolf1-4/+7
This reverts commit f5264cfabfb2f921304536f4471bff469d9ba546. The repository, if available, provides additional context for running the ls-remote operation, such as http.* configuration settings in the repository config. Thus when we do have a repository, we should use it. Keep the good bits from commit f5264cf: add a new constructor to ListRemoteOperation that can work without repository, and use it in SourceBranchPage instead of creating an empty dummy repository (which may fail) there. Same in LocalRepositoryTestCase. Additionally remove the now unused message about not being able to create a temporary repository. Change-Id: I7128b3815d8b564a59fbe2a3bb4a21270b221fc4 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2017-08-19Remove repository from ListRemoteOperationMatthias Sohn1-7/+4
LsRemoteCommand can run ls-remote without a repository hence remove the unnecessary repository from ListRemoteOperation. SourceBranchPage created an unnecessary temporary repository in /tmp in order to run ls-remote before cloning a repository. This may fail if the user does not have write permissions in this folder. Bug: 521033 Change-Id: Id39107266551a3b7a9251cf9d26233f9bbfdc516 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-06-23Correct sync info calculation for foldersThomas Wolf1-2/+2
The folder handling in the git "Team synchonization" support was wrong since commit f46237a (bug 516426). That commit considered folders as supervised -- which is correct since otherwise some changes may be missed. It also tried to compensate for folders without changes showing up in the synchronize view by setting their sync state to IN_SYNC if they had only IN_SYNC descendants. That broke the display of "compacted folders" in the synchronize view. If a file is not IN_SYNC, the synchronize view is able to handle its parent containers fine without needing any SyncInfo for them. When we do supply sync info, the parent containers will be considered changed themselves, and will show up explicitly in the synchronize view. Therefore, simply return IN_SYNC for folders. The state recorded in the GitSyncObjCache is bogus anyway. Bug: 518646 Change-Id: I2970a50b2d11403b84dc1b9a000021f61ca92f90 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2017-06-08Merge branch 'stable-4.7' into stable-4.8Matthias Sohn1-1/+21
* stable-4.7: Prepare 4.7.2-SNAPSHOT builds EGit v4.7.1.201706071930-r Disable running autoGC in the background for EGit tests Change-Id: Ia2fea92792b262083a7bd4ff9e608f80ec310748 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-06-07Disable running autoGC in the background for EGit testsMatthias Sohn1-1/+21
If autoGC runs in the background this may lead to cleanup issues when tests are teared down. Change-Id: Ib6b6b6b9f8b70abf7ea3defa7b4fe6854b31e9cb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-05-13Fix synchronize with deleted resourcesThomas Wolf1-0/+100
ResourceVariantTreeSubscriber.members() must return *all* resources known to the subscriber, whether they exist in the "workspace" or not. Otherwise resources that were deleted will be missed. Git is a bit special in that we don't want to report .gitignored resources, and untracked resources only if the user so wishes. Thus our logic is a bit different and governed basically by what our 3-way diff cache contains, but in any case we must include files that only exist in the remote (i.e., in those caches). Furthermore, isSupervised() must also work for IContainers, not just for files. That was limited in commit 3fa9329 [1] to files to prevent folders showing up with wrong markers. However, this kind of fix is just plain wrong -- the new test could never work with that. But if we re-consider folders as supervised, they'll show up as modified even when they have no changes below. Our cache should contain IN_SYNC entries for such folders. ThreeWayDifFEntry.scan() produces MODIFIED entries, though. Since I'm unsure about the interactions between scans with path filters to partially update the EGit synchronization caches, I have not touched that scan--it would be non-trivial to make it produce IN_SYNC entries anyway, and then the cache update logic would probably also have to be non-trivially adapted. Instead I've chosen to perform a top-down check in GitSyncInfo and return IN_SYNC for any folder that does not contain at least one file that is itself not IN_SYNC. [1] Ib25bf43721ef4cc87dba33aa01909e50a4cbef48; bug 324604 Bug: 516426 Change-Id: Ia12309f52e5140ff058b4fee17b9c7d48d435290 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2017-05-06Throttle updates of the EclipseGitProgressTransformerThomas Wolf1-1/+29
This progress monitor updated its SubMonitor every time if total == UNKNOWN. This can be very inefficient since it may involve a UI update. Oxygen seems to include a progress monitor that optimizes for this, but on Neon and earlier Eclipses, this progress reporting may slow down operations. Most noticeably it occurred in the "counting objects" phase of a push operation, which would become unuseably slow if run in the foreground, but which would terminate quickly when run in the background. Bug: 516276 Change-Id: Ib3e37918f493da6a04eb51bcc7086ecd3eb2bc6f Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2017-03-16Open Git instances in try-with-resource in testsDavid Pursehouse19-179/+282
Change-Id: I881cab412475d692f02e2d5bf76677c08fb3ac54 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-03-16Add missing newlines at ends of Java filesDavid Pursehouse4-4/+4
Change-Id: Ibea4fae98811b36f0c56bcb88f858d008b2dd68a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-03-16Fix typos in initial commit creation commit messagesDavid Pursehouse2-2/+2
Change-Id: If6bd120add204a4604ec004ed3f45e6b4e1b71e7 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2017-02-01Auto-ignore the .metadata and .recommenders folders in the workspaceMatthias Sohn1-1/+2
Auto-ignore the .metadata and .recommenders folders in the workspace if the workspace root is located in a git repository's working tree (which is not recommended). Bug: 332834 Change-Id: Ied46005417810edd9312d5563c501f9999002068 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-01-30Don't rely on default locale when using toUpperCase() and toLowerCase()Matthias Sohn1-3/+4
Otherwise these methods may produce unexpected results if used for strings that are intended to be interpreted locale independently. Examples are programming language identifiers, protocol keys, and HTML tags. For instance, "TITLE".toLowerCase() in a Turkish locale returns "t\u0131tle", where '\u0131' is the LATIN SMALL LETTER DOTLESS I character. See https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#toLowerCase-- http://blog.thetaphi.de/2012/07/default-locales-default-charsets-and.html Bug: 511238 Change-Id: I5619ce1bde33d6ce2469506a915af9203bae0314 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2017-01-10Delete unused org.eclipse.egit.core.internal.mergeThomas Wolf5-1062/+0
These classes duplicate functionality in org.eclipse.core.synchronize. They were added in an abandoned attempt to move some functionality from EMF Compare into EGit, but they were never used, not even by EMF Compare. This attempt was later superseded by the "mergeStrategy" extension point. Bug: 418151 Change-Id: I8fcad2d2e9e11c681ce41fe99faa9745e79597b8 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2016-12-30[findbugs] Resolve ...SHOULD_BE_STATIC warningsThomas Wolf2-3/+3
Change-Id: I7e788e5e94e829e84d8d6bb99bb82e5cbb5998f1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
2016-12-23Validate target repository path entered by the userMatthias Sohn1-0/+64
Validate the repository path entered in NewRepositoryWizard or GitImportWizard to prevent we hit an InvalidPathException in JGit. Since it seems many users try to paste a git clone command or a URL instead of a local path raise a dedicated error messages for these cases. Bug: 496688 Change-Id: I7c40f2d47f5b37ce50d873dbd02e6365097d7110 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-12-19[findbugs] Do not rely on default character encodingMatthias Sohn2-3/+6
Change-Id: I5025874ef929e574459975d5a5c3108c4e1e4d6d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-12-12Make auto-staging of files being moved configurableMatthias Sohn1-63/+118
- by default auto-stage files being moved. This simplifies reverting a move using hard reset. If moved files aren't auto-staged hard reset does not fully revert the move since the new unstaged file isn't tracked by git - add an option to disable auto-staging of files being moved Change-Id: I1de114e90c26988bc83d4f4ef859cde1909f9ef4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-12-12Make auto-staging of files being deleted configurableMatthias Sohn2-4/+30
- by default do not auto-stage files being deleted - add an option to enable auto-staging of deleted files for those who want the old behavior. Bug: 507018 Change-Id: I5c906dd4fb7295f0ac153ada9be7ee341d8f46c8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-10-26Disabled unstable test caseAndrey Loskutov1-0/+13
Bug: 506544 Change-Id: I2523862aafd3e3da69c4188714a2a0e2f10be3ca Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2016-10-26Trying to make repository tests more stable (disconnect process)Andrey Loskutov1-3/+13
Bug: 506555 Change-Id: I4b4cf3cc71fcba34b858e47a499c4206deb17207 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>

Back to the top