Colby Ranger [Wed, 13 Nov 2013 23:19:03 +0000 (15:19 -0800)]
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.
Stefan Lay [Wed, 6 Nov 2013 10:16:34 +0000 (11:16 +0100)]
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>
* 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
Stefan Lay [Tue, 22 Oct 2013 14:01:18 +0000 (16:01 +0200)]
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>
Tobias Pfeifer [Wed, 7 Aug 2013 12:18:23 +0000 (14:18 +0200)]
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>
Matthias Sohn [Tue, 5 Nov 2013 08:29:13 +0000 (09:29 +0100)]
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>
Shawn Pearce [Fri, 1 Nov 2013 14:59:57 +0000 (15:59 +0100)]
Use absolute paths for file:// URIs in tests
When run under Buck the repository paths may be relative. Request
an absolute path to construct the URI, as relative paths are not
supported in file:// style URIs.
Shawn Pearce [Fri, 1 Nov 2013 17:14:14 +0000 (11:14 -0600)]
Move repeat() to utility class for tests
Avoid depending on AutoCRLFOutputStreamTest from within another
test such as AutoCRLFInputStreamTest. Breaking the dependency up
allows the test classes to be built and executed in parallel.
Shawn Pearce [Fri, 1 Nov 2013 15:04:44 +0000 (16:04 +0100)]
Remove hardcoded target/trash from test cases
Buck does not create a target directory for the build output, this
is Maven specific and the project unit tests should not rely on it.
Instead follow the pattern used by org.eclipse.jgit.test which is to
create a temporary directory in the system temporary folder, and
configure the Maven surefire plugin to use the target directory.
Tobias Pfeifer [Mon, 5 Aug 2013 10:54:23 +0000 (12:54 +0200)]
Parse commitId and shortMessage of a commented out line in rebase todo
A rebase todo file consists of regular non-comment action lines and
comment lines. In case that a regular action line has been commented out
(i.e. prefixed with a hash '#'), the RebaseTodoLine that is representing
this line should hold the values for commitId and shortMessage even
though it's a comment line. This allows to switch between comment and
non-comment easily even after the file has been persisted and reread.
Change-Id: I56ec2ba08eaf3772e2d74d937dd496209a744d4b Signed-off-by: Tobias Pfeifer <to.pfeifer@web.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Enhance reading of git-rebase-todo formatted files
Reading and writing files formatted like the git-rebase-todo files was
hidden in the RebaseCommand. Certain constructs (like leading tabs and
spaces) have not been handled as in native git. Also the upcoming
rebase interactive feature in EGit needs reading/writing these files
independently from a RebaseCommand.
Therefore reading and writing those files has been moved to the
Repository class. RebaseCommand gets smaller because of that and doesn't
have to deal with reading/writing files.
Additional tests for empty todo-list files, or files containing comments
have been added.
Change-Id: I323f3619952fecdf28ddf50139a88e0bea34f5ba Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Also-by: Tobias Pfeifer <to.pfeifer@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Michael Nelson [Mon, 26 Aug 2013 16:35:48 +0000 (09:35 -0700)]
Support extension of TransportHttp
This allows subclasses to configure the HTTP connection (for example,
to add headers to the request).
Bug: 400724
Change-Id: I6f9d699e158a7b9d813c8fa8d273992a28994e41 Signed-off-by: Michael Nelson <michael.nelson@tasktop.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Matthias Sohn [Wed, 10 Jul 2013 22:20:09 +0000 (00:20 +0200)]
Scripts to publish jgit artifacts on Maven central
- you need an account on oss.sonatype.org and permissions for group id
org.eclipse.jgit, see [1]
- install ruby [2] if necessary
- run download.rb to download the Maven artifacts from repo.eclipse.org
- then run deploy.rb to stage the artifacts on oss.sonatype.org
- follow [3] to close the staging repository which triggers some sanity
checks on Nexus
- ask community to test artifacts from staging repository
- if tests are ok release the staging repository as described in [4]
Kaloyan Raev [Wed, 9 Oct 2013 19:40:48 +0000 (22:40 +0300)]
CLI version command falls back to Bundle-Version
If the version command cannot read the Implementation-Version of the
containing JAR fall back to read the Bundle-Version header in
MANIFEST.MF. This makes the command working also from the
org.eclipse.jgit.pgm bundle and during development in a host IDE.
Colby Ranger [Tue, 8 Oct 2013 17:16:45 +0000 (10:16 -0700)]
Fix ServiceMayNotContinueException constructors for Java 1.5
IOException did not add a (String, Throwable) constructor until 1.5.
Instead use the String super constructor and initCause to initialize
the exception.
Colby Ranger [Mon, 7 Oct 2013 21:14:01 +0000 (14:14 -0700)]
Add constructors that take Throwable to ServiceMayNotContinueException.
ServiceMayNotContinueException usually wraps an underlying exception.
Add convenience constructors that take Throwable. In the case a
string is not provided, the message defaults to "internal server error",
since it may be reported to the client.
Colby Ranger [Mon, 7 Oct 2013 17:25:28 +0000 (10:25 -0700)]
Propagate IOException where possible when getting refs.
Currently, Repository.getAllRefs() and Repository.getTags() silently
ignores an IOException and instead returns an empty map. Repository
is a public API and as such cannot be changed until the next major
revision change. Where possible, update the internal jgit APIs to
use the RefDatabase directly, since it propagates the error.
Matthias Sohn [Thu, 3 Oct 2013 15:39:03 +0000 (17:39 +0200)]
Merge branch 'stable-3.1'
* stable-3.1:
Prepare post 3.1.0 builds
JGit v3.1.0.201310021548-r
Fix order of commits in rebase todo file header
Prepare post 3.1.0 RC1 builds
JGit v3.1.0.201309270735-rc1
Attempt to fix graph layout when new heads are introduced
Prepare re-signing pgm's ueberjar to avoid SecurityException
Use full branch name when getting ref in BranchTrackingStatus
Change-Id: Ida30175d0c058048cbe4b563aae7f85cd008db29 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Tue, 24 Sep 2013 07:11:47 +0000 (09:11 +0200)]
Prepare re-signing pgm's ueberjar to avoid SecurityException
Since we now sign all build artifacts immediately after creating them
we need to re-sign the ueberjar created for jgit command line tool
because the signatures of the individual jars are invalidated when
repacking them into the ueberjar. Hence we need to exclude the
signatures of the individual jars when using maven-shade-plugin to
create the ueberjar.
Also install the shaded plugin into maven repository and exclude osgi
framework sources which were included unintentionally.
See http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02277.html
Change-Id: Ia302e68a4b2a9399cb18025274574e31d3d3e407 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Jonathan Nieder [Tue, 24 Sep 2013 00:35:15 +0000 (17:35 -0700)]
Revert "Close unfinished archive entries on error"
This reverts commit 75d9b31f14d6226a535a80c05cffda29e55d2ceb.
Now that we do not try to close the ArchiveOutputStream in the error
path, there is no need to artificially close partial entries from
before the error.
Change-Id: I1f1cb08ec4e9b14c79bf4621f3fa959463034b82 Signed-off-by: Jonathan Nieder <jrn@google.com>
Jonathan Nieder [Tue, 24 Sep 2013 00:06:18 +0000 (17:06 -0700)]
Do not close ArchiveOutputStream on error
If we encounter an I/O error while writing an archive (for example due
to the reader of an HTTP stream closing the connection), the result is
an archive with unclosed entries, causing
TarArchiveOutputStream.finish() to throw IOException("This archives
contains unclosed entries"), hiding the IOException that caused the
early termination.
The unclosed entries are fine: the same exception that occured in the
first place will probably prevent closing the entries before finishing
this partial archive that should be discarded anyway.
It would be nicer to call TarArchiveOutputStream.finish and leave the
underlying OutputStream unclosed --- all callers close it already ---
but that would be a more invasive change so we hold off for now.
Change-Id: I328ced19aa8a1888e5353cdbb6106a85fd72d5d7 Signed-off-by: Jonathan Nieder <jrn@google.com>
Robin Stocker [Sun, 15 Sep 2013 21:26:35 +0000 (23:26 +0200)]
Use full branch name when getting ref in BranchTrackingStatus
In case there is both a tag and branch called "foo", the tag is returned
if calling getRef with the short name. By using refs/heads/foo, the
branch is returned.
Bug: 417158
Change-Id: I86b4f83955586bb24774fd621f5012499cf67909 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Ignore bitmap indexes that do not match the pack checksum
If `git gc` creates a new pack with the same file name, the
pack checksum may not match that in the .bitmap. Fix the PackFile
implementaion to silently ignore invalid bitmap indexes.
Robin Stocker [Mon, 12 Aug 2013 13:13:03 +0000 (15:13 +0200)]
ResetCommand: Allow reset on unborn branch when ref not specified
In C Git 1.8.2, "git reset" now also works on an unborn branch (no HEAD
yet) if no explicit ref was specified. In that case, it is treated as a
reset to an empty tree.
This can be useful for callers because "unborn branch" no longer has to
be special-cased to "git rm --cached".
Bug: 414870
Change-Id: Ied750116f767518ae4d48823cf00752b049a8477 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
OpenJDK 7 does not benefit from using an inflate stride on the input
array. The implementation of java.util.zip.Inflater supplies the
entire input byte[] to libz, with no regards for the bounds supplied.
Slicing at 512 byte increments in DfsBlock no longer has any benefit.
In OpenJDK 6 the native portion of Inflater used GetByteArrayRegion
to obtain a copy of the input buffer for libz. In this use case
supplying a small stride made sense, it avoided allocating space
for and copying data past the end of the object's compressed stream.
In OpenJDK 7 the native code uses GetPrimitiveArrayCritical,
which tries to avoid copying by freezing Java garbage collection
and accessing the byte[] contents in place. On OpenJDK 7 derived
JVMs it is likely more efficient to supply the entire DfsBlock.
Since OpenJDK 5 and 6 are deprecated and replaced by OpenJDK 7
it is reasonable to suggest any consumers running JGit with DFS
support use an OpenJDK 7 derived JVM. However, JGit still targets
local filesystem support on Java 5, so it is still not reasonble to
apply this same simplification to the internal.storage.file package.
Matthias Sohn [Fri, 30 Aug 2013 22:26:18 +0000 (00:26 +0200)]
Update build to use CBI jarsigner plugin
The dash signing plugin has been retired hence we need to update our
build to use the CBI jarsigner plugin for signing build results.
Pack test classes to enable signing them.
Also re-enable pack200 for bundle org.eclipse.jgit.
WORKAROUND: there is no easy way to run tests with maven-surefire-plugin
from signed test-jar so for a quick workaround we will have to add a
build step on Hudson so that we can run tests before signing:
- first step will do "clean, verify" to compile and run tests
- second step will do "install, deploy" with profile "eclipse-sign" and
use -DskipTests=true to skip tests since they would hit a
SecurityException when unsigned test classes are in same package as
signed classes under test
- third step will do "clean, install, deploy" on packaging reactor to
build features and p2 repository with profile "eclipse-sign" to sign
and pack200 all bundles.
TODO: Tycho doesn't suport picking up pack200 artifacts via
pomDependencies hence we need to find a way to copy them manually and
use tycho-extra's tycho-p2-extras-plugin:publish-features-and-bundles
to generate the missing p2 metadata.
Change-Id: Iec2c5ab3027a3e3f9ecc0d2f99193385177d9025 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Thu, 22 Aug 2013 20:50:43 +0000 (22:50 +0200)]
Merge branch 'stable-3.0'
* stable-3.0:
Update reflog like C Git during rebase (non-interactive)
Make sure checkout is not deleting folders outside the workingtree
Update to Jetty 7.6.11.v20130520
Fix bugs in TreeWalk#isPathSuffix used by PathSuffixFilter
Refactor PathSuffixFilterTest to remove duplication
Check parentFile is not null
Update HEAD in cherry-picking several commits
Fix HTTP response processing for WWW-Authenticate headers
Don't skip want validation when the client sends no haves
Fix tests for OS X when the tmpdir is the default /tmp
Fix running maven http tests on OS X
Recognize CRLF when parsing the short message of a commit or tag
Update build to use Tycho 0.18
Add jgit target platform to define dependencies more precisely
Prepare 3.0.2-SNAPSHOT builds
Change-Id: Icef0cd0cce9bbccf2b2cbb3471a3f4ce0655e22c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Make sure checkout is not deleting folders outside the workingtree
There was a chance that jgit deletes symbolic links which point to the
folder on top of the working tree. Make sure not to touch these
resources.
Thanks to Cedric Darloy who reported this bug on
http://www.eclipse.org/forums/index.php/m/776910/#msg_776910 and to
Ondrej Vrabec who reported bug 412489.
Bug: 412489
Change-Id: I81735ba0394ef6794e9b2b8bdd8bd7e8b9c6460f Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Robin Stocker <robin@nibor.org>