Commit Graph

2891 Commits

Author SHA1 Message Date
Matthias Sohn b14a939718 Prepare 3.3.0-SNAPSHOT builds
Change-Id: I7c7e7c1beec0c5d15b96c14c73ce93e3f09855c8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-05 22:42:47 +01:00
Stefan Lay f86a488e32 Implement rebase.autostash
This feature was introduced in native git with version 1.8.4.

Bug: 422951
Change-Id: I42f194174d64d7ada6631e2156c2a7bf93b5e91c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-04 22:02:22 +01:00
Matthias Sohn ba0f50d7d3 Merge "CLI status should support --porcelain" 2013-12-04 09:26:16 -05:00
Kaloyan Raev 7026658ac8 CLI status should support --porcelain
Add support for the machine-readable output format along with the
existing default long format.

Bug: 419968
Change-Id: I37fe5121b4c9dbae1106b1d18e9fdc134070a9dd
Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
2013-12-04 11:13:27 +01:00
Christian Halstrick 77432969d3 Merge "More helpful InvalidPathException messages (include reason)" 2013-12-04 03:23:56 -05:00
Robin Stocker e0502ebb03 More helpful InvalidPathException messages (include reason)
Instead of just a generic "Invalid path: $path", add a reason for the
cases where it's not obvious what the problem is (e.g. "aux" being
reserved on Windows).

Bug: 413915
Change-Id: Ia6436bd2560e4f049c92d9aac907cb87348605e0
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-12-03 23:10:05 +01:00
Robin Stocker f4dae204a6 Fix IgnoreRule#isMatch returning wrong result due to missing reset
The matcher has to be reset before using it, as was already done in the
other cases.

Bug: 423039
Change-Id: I87abaa7ad7f0aac8651db6e88d41427cacb4d776
Also-by: Ondrej Vrabec <ovrabec@netbeans.org>
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-12-03 22:30:14 +01:00
Robin Stocker 7dc8a4f089 Fix exception on conflicts with recursive merge
When there are conflicts with a recursive merge, the conflicting paths
are stored in unmergedPaths (field in ResolveMerger). Later, when the
MergeResult is constructed in MergeCommand, getBaseCommit is called,
which computes the merge base a second time.

In case of RecursiveMerger, getBaseCommit merges the multiple merge
bases into one. It does this not by creating a new ResolveMerger but
instead calling mergeTrees. The problem with mergeTrees is that at the
end, it checks if unmergedPaths is non-empty and returns false in that
case.

Because unmergedPaths was already non-empty because of the real merge,
it thinks that there were conflicts when computing the merge base again,
when there really were none.

This can be fixed by storing the base commit when computing it and then
returning that instead of computing it a second time.

Note that another possible fix would be to just use a new ResolveMerger
for merging the merge bases instead. This would also remove the need to
remember the old value of dircache, inCore and workingTreeIterator (see
RecursiveMerger#getBaseCommit).

Bug: 419641
Change-Id: Ib2ebf4e177498c22a9098aa225e3cfcf16bbd958
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-12-03 21:05:37 +01:00
Axel Richard 1128326add Add pgm test for checkout of existing branch with checkout conflict
Add a test that checks out an existing branch with a dirty working tree
and involves a checkout conflict. This test should pass with a message:
"error: Your local changes to the following files would be overwritten
by checkout: a".

Change-Id: I5428a04a7630d9e0101404ea1aedd796f127bd7d
Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-02 22:55:55 +01:00
John Ross 99608f0b9a Fix broken symbolic links on Cygwin.
Bad files from symbolic links were being generated on Cygwin and
required resolution by the appropriate FS. Pass FS to getSymRef and call
FS.resolve before asking if the file is absolute.

Bug: 419494
Change-Id: I74aa7a285954cade77f41df6f813b6dafb5d6cd7
Signed-off-by: John Ross <jwross@us.ibm.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-02 16:31:45 +01:00
Stefan Lay 591998c2d6 Do not allow non-ff-rebase if there are uncommitted changes
With this change jgit checks for uncommitted changes before a rebase is
started. This is also done by native git. One reason is that an abort
would override such changes. The check is skipped for a non-interactive
rebase when it will result in a fast-forward. In this case there can be
only checkout conflicts but no merge conflicts, so there cannot be an
abort which overrides uncommitted changes.

Bug: 422352
Change-Id: I1e0b59b2a4d80a686b67a6729e441924362b1236
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-12-02 09:45:15 +01:00
Axel Richard c95e4fb909 Manage CheckoutConflictException in pgm
Change-Id: I49f92bf7cafc80404f0bd07d62ff4b25e4db6e7c
Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-29 23:42:08 +01:00
Christian Halstrick af40635aba Fix handling of file/folder conflicts during a checkout
JGit was not handling certain file/folder conflicts during a checkout
correctly. This was reported by Axel Richard in
http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02358.html.
This commit fixes this problem.

Still JGit behaves intentionally different than native git.
If HEAD contains a tree, and workingtree, Index and Merge contain a file
with same content ... then JGit allows a conflict free checkout of
Merge. Native git always complains that it doesn't want to overwrite
local changes. But there is no need to update the working tree because
Index and Merge are already equal.

A shell script which shows how native git behaves can be found here.
https://gist.github.com/chalstrick/7694959#file-gistfile1-sh

Change-Id: Ifd6a68974d61cd4fa23bc575f3a40773db66cafc
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
2013-11-29 22:32:36 +01:00
Robin Stocker 53c8ac0c60 Mention null return in Javadoc of Config#getString
Change-Id: Ibf09395fb3ac4d5d8f47872ed8f239c821bbee7a
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-11-29 17:16:23 +01:00
Stefan Lay dcd0dd4d9e Fix applying stash on other commit
Applying a stash on another commit failed because the merge base for the
cherry-pick of the stashed index state was not corectly set.

Bug: 422684
Change-Id: I9355352b2b9a7abefa3248ca3c17a9301177d0d6
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2013-11-29 10:36:53 -05:00
Stefan Lay ec0d78d093 Use static factory methods instead of overloaded constructors
Change-Id: Ib10e0798dcfb9f1b611caec393926c95eff4c2a2
2013-11-29 09:34:03 +01:00
Shawn Pearce 53616a85ef Break up GCTest to run in parallel
Separate some sections of the GC tests into different test classes.
Individual classes permits running in parallel under Buck, reducing
test latency if there are sufficient CPUs available.

Change-Id: I5eb177f78efd4aa8ac857d0d8b1a1fd81ca07790
2013-11-24 11:37:49 +01:00
Shawn Pearce 531d577658 Modify T0004_PackReaderTest to use existing pack
Instead of making a new PackFile from a resource, lookup
the existing PackFile that was already created by the base
class SampleDataRepositoryTestCase.

Change-Id: Ib5da18c832ae0cb29703706b99e99503f5cc819d
2013-11-24 05:27:21 -05:00
Shawn Pearce d54d19740a Move SampleDataRepositoryTestCase to org.eclipse.jgit.test
This class requires resources which are private to another
bundle. Move the class next to its resources, removing an
odd cross bundle dependency.

Change-Id: I30d5568b09ea5fb3bd3bb60b602f149c0867f49a
2013-11-24 05:27:14 -05:00
Shawn Pearce 573d36a464 Support running from JARs in JGitTestUtil
Buck invokes JUnit tests from compiled JARs, not class directories.
When copying a resource back to the filesystem a jar: style URL is
obtained from the ClassLoader.

Change-Id: I28d702484ec13b0b309b87990da867050e4b5ec6
2013-11-24 05:27:00 -05:00
Matthias Sohn 7f7dd171df Cache SimpleDateFormat in GitDateParser per locale
Otherwise switching to another locale yields wrong results when parsing
date strings in GitDateParser. Since the MockSystemReader explicitly
uses english locale the tests need to specify the locale to be used when
parsing date strings.

Bug: 420772
Change-Id: I313ef6b1e9ef3bfb43d929ce34712ebd21f2cd9c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-23 22:06:08 -05:00
Stefan Lay 8339a07e83 Fix FIXUP error for blank lines in interactive rebase
Empty lines of discarded commit messages were added to the commit
message because they were not commented out properly.

Bug: 422246
Change-Id: I263e8a6b30a3392d8b4f09c0695505068a0a485d
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2013-11-22 16:50:44 -05:00
Stefan Lay 4feace2b9e Fix parsing Rebase todo lines when commit message is missing
Bug: 422253
Change-Id: I9739b16c91d2df31a481360a712d3479a4eeee2e
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2013-11-21 14:47:24 +01:00
Christian Halstrick 7dce16018e Add close() method to API
The API in org.eclipse.jgit.api does allow to open repositories but it
did not allow to close them. This commit fixes this and allows
API users to close a repository without having to use lower-level
classes.

Bug: 420502
Change-Id: I866225cc8534ae5916113fa24eb1c7513fd4472e
Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-20 00:16:39 +01:00
Matthias Sohn 3cf2a8542a Update Jetty to 7.6.14.v20131031
Change-Id: Icb7f91e40d2a216fda519c64a94d5ad18eac683c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-18 17:57:30 +01:00
Robin Rosenberg 216d9981f5 Merge "Don't delete .idx file if .pack file can't be deleted" 2013-11-17 23:50:41 -05:00
Robin Stocker 97b8115be4 Document that path parameters should use '/' as separator
Bug: 421600
Change-Id: I505d994518aa608aaa797252433b6c97e2def5b4
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-11-15 19:20:02 +01:00
Robin Stocker 04f19353fd Improve Javadoc for typeHint parameter
Link to an example type constant.

Change-Id: I214ab834fa02901a38e6048a94a5224b30c5d93f
Signed-off-by: Robin Stocker <robin@nibor.org>
2013-11-14 11:12:29 +01:00
Colby Ranger f3b80f1a74 Do not update the ref hot bit when checking isIndexLoaded
DfsPackFile.isIndexLoaded() uses the DfsBlockCache.Ref.get() method
to check if the index loaded. However, using the get() method marks
a hot bit in the cache, which can cause the index to never be unloaded
and seem hotter than it really is. Add a has() method which only
checks if the value is not null and does not update the hot bit.

Change-Id: I7e9ed216f6e273e8f5d79ae573973197654419b4
2013-11-13 15:19:03 -08:00
Christian Halstrick 8da939221c Don't delete .idx file if .pack file can't be deleted
If during an garbage collection old packfiles are deleted it could
happen that on certain platforms the index file can be deleted but the
packfile can't be deleted (because someone locked the file). This led
to repositories with packfiles without corresponding index files. Those
zombie-packfiles potentially consume a lot of space on disk and it is
never tried to delete them again. Try to avoid this situation by
deleting packfiles first and don't try to delete the other files if we
can't delete the packfile. This gives us the chance to delete the
packfile during next GC.

This commit only improves the situation - there is still the chance for
orphan files during packfile deletion. We don't have an atomic delete
of multiple files .

Change-Id: I0a19ae630186f07d0cc7fe9df246fa1cedeca8f6
2013-11-13 08:59:43 +01:00
Matthias Sohn 371e1a02bd Update to Ant 1.9.2
CQ: 7698
Change-Id: I2ae580041eb334c613969bc9d66d169d08c12c4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-12 18:09:35 -05:00
Matthias Sohn 05f308af48 Merge "Add missing @since tags" 2013-11-12 18:09:02 -05:00
Matthias Sohn b41b5d723e Add uses directives to ensure OSGi wires jgit bundles correctly
See
http://spring.io/blog/2008/10/20/understanding-the-osgi-uses-directive/

Bug: 420903
Change-Id: I3706a2b8f695d4ce0ee2333722ed7b8d31032f1e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-12 23:11:16 +01:00
Matthias Sohn 8399a9bcde Introduce Kepler and Luna target platform
We need this to enable building jgit with dependencies from Orbit
version used by Luna.

Default target platform is Kepler. In order to use Luna run

mvn clean install -P platform-luna -f org.eclipse.jgit.packaging/pom.xml

Change-Id: I544516d97067f45d1034929b534ad1600136614d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-12 23:11:15 +01:00
Matthias Sohn 7948903a84 Update build to use Tycho 0.19
Change-Id: I90f71f2612a934e83a0af8dccfe08592e4532ddf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-11 11:58:19 +01:00
Matthias Sohn f1c086f692 [findBugs] Remove nonsense call
Result of c.containsAll(c)  is always true for any collection c.

Change-Id: I853cbb44bdc03e2b54229bb9c36ae42e02dcc4d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 16:01:09 -05:00
Matthias Sohn 1ec72e9a1c Remove unnecessary @SuppressWarnings("null")
Change-Id: I5bddcdab2c5cc92622144a7b207bad90cb601609
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 16:00:12 -05:00
Matthias Sohn 2765cc1871 Grant access to internal jgit package to org.eclipse.jgit.junit
This silences some discouraged access warnings issued since
TestRepository uses PackWriter which is in an internal package.

Change-Id: Ic9c4631e237c2fe1996c518328ecc2a9ab5c348b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 15:59:41 -05:00
Matthias Sohn d4a42f472a Remove duplicate package export
Change-Id: I185610f12069cd4ce1b27650581375b6b3019d2f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 15:59:04 -05:00
Matthias Sohn b6cf49b2bd Don't import non-existing package org.eclipse.jgit.java7
Change-Id: Idc48cb1995050913498d2bad97a8e6e330dee94c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-10 00:01:51 +01:00
Matthias Sohn 7cae388118 Add missing @since tags
Change-Id: Ic4fabec818d6fe336d3256ddc95934271272914a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-09 01:16:46 +01:00
Stefan Lay 979e346711 Interactive Rebase: Do actions if there were conflicts
If a commit was marked for edit, reword, squash or fixup, but the
interactive rebase stopped because of a conflict, the step was not done
after conflict resolution. This is done now.

Change-Id: If8e7ccc50469165744f2b8a53d180f9ba0f72330
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-08 23:43:11 +01:00
Stefan Lay 18069ffe8c Rebase interactive should finish if last step is edit
When the last step was an edit step, rebase interactive did not finish
after continuing the rebase. Instead, it returned with the status
FAST_FORWARD.

Change-Id: Ib19857474ac089dfeaae665ad5e95c66c21099b0
2013-11-06 09:43:31 +01:00
Matthias Sohn 34fbd814d4 Merge changes I40f2311c,I3c419094
* changes:
  Add additional RebaseResult for editing commits
  Add Squash/Fixup support for rebase interactive in RebaseCommand
2013-11-05 17:03:35 -05:00
Shawn Pearce b8eac43c0f Merge changes I85470d1d,I43711486,Ie6ade781,Ic9ab2b6e,Iebe50933,Id6fac253,Ia6becf30,I2af8b0ac
* changes:
  Use absolute paths for file:// URIs in tests
  Use getPath() in FileResolverTest
  Extract protocol constants to a common class
  Move repeat() to utility class for tests
  Remove hardcoded target/trash from test cases
  Remove dependency on StatusCommandTest
  Remove dependency on DiffFormatterReflowTest
  Remove unnecessary import of BaseConnection in MessageWriter
2013-11-05 12:41:12 -05:00
Stefan Lay cce2561e9f Add additional RebaseResult for editing commits
With the new RebaseResult.EDIT a client can now distinguish if rebase
stopped due to a conflict or because the commit was marked for edit in
an interactive rebase.

Change-Id: I40f2311cf43ed5f290dcda65a7bd85ba770a85f5
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2013-11-05 18:05:03 +01:00
Tobias Pfeifer 765896febb Add Squash/Fixup support for rebase interactive in RebaseCommand
The rebase command now supports squash and fixup. Both actions are not
allowed as the first step of the rebase.

In JGit, before any rebase step is performed, the next commit is
already cherry-picked. This commit keeps that behaviour. In case of
squash or fixup a soft reset to the parent is perfomed afterwards.

CQ: 7684
Bug: 396510
Change-Id: I3c4190940b4d7f19860e223d647fc78705e57203
Signed-off-by: Tobias Pfeifer <to.pfeifer@web.de>
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-05 18:05:02 +01:00
Matthias Sohn 01b5b999a5 Merge "Declare that org.eclipse.jgit.transport uses com.jcraft.jsch" 2013-11-05 11:53:17 -05:00
Matthias Sohn 6e3e5e4809 Declare that org.eclipse.jgit.transport uses com.jcraft.jsch
This should prevent class cast problems caused by jgit and egit bundles
wiring to different versions of com.jcraft.jsch.

Bug: 420903
Change-Id: Icabe40209ea07369e2b7eee31952d131aef3fbf1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-05 10:39:10 +01:00
Matthias Sohn 35331a916a Also use MockSystemReader in GitDateParserBadlyFormattedTest
All tests should use MockSystemReader to isolate them from the
underlying platform specifics.

GitDateParserBadlyFormattedTest wasn't using MockSystemReader which
induced Bug 420772 as a side effect since GitDateParser caches
SimpleDateFormat instances without regarding their locale. This will be
fixed in another change

Bug: 420772
Change-Id: I798e55d05730a71bb0326f80aea5488541d6c1f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2013-11-05 09:29:13 +01:00