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: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>
Robin Stocker [Mon, 8 Jul 2013 08:51:52 +0000 (10:51 +0200)]
Fix bugs in TreeWalk#isPathSuffix used by PathSuffixFilter
* It didn't check the first character in the pattern due to a off-by-one
error. Spotted by James Roper.
* It returned true even when pattern was longer than current path, e.g.
it returned that ".txt" is suffix of "txt".
Bug: 411999
Change-Id: I9fbcd68a11fb57cc49956b70c387a47271a0424f Signed-off-by: Robin Stocker <robin@nibor.org>
Alex Rukhlin [Wed, 6 Mar 2013 21:35:52 +0000 (16:35 -0500)]
Fix HTTP response processing for WWW-Authenticate headers
The original code was able to process only one WWW-Authenticate
header in an HTTP response, and if this header was not one of
two expected, authentication failed regardless of that there
could be other headers in the response.
All WWW-Authenticate headers in an HTTP response have to be
browsed to find one of supported, i.e. Basic or Digest.
By that if both are present, the Digest one should be used
as more preferable.
Bug: 357719
Change-Id: Icf601a41fec63f7d40308f3c85aaa4f71a7c095b Signed-off-by: Alex Rukhlin <arukhlin@microsoft.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Robin Rosenberg [Sun, 16 Jun 2013 10:02:14 +0000 (12:02 +0200)]
Fix tests for OS X when the tmpdir is the default /tmp
/tmp is a symbolic link and some tests break when the path
gets canonicalized by JGit or Jetty. Allow Jetty to serve
symlinks by setting init parameter "aliases" to true [1].
Robin Rosenberg [Sun, 16 Jun 2013 09:28:36 +0000 (11:28 +0200)]
Fix running maven http tests on OS X
In 36144e12d8 tests were changed to use the system tmp directory as defined
by java.io.tmpdir, which was then overridden in the pom files to usea custom
directory that made som tests work, but not all.
Matthias Sohn [Fri, 31 May 2013 22:36:17 +0000 (00:36 +0200)]
Add jgit target platform to define dependencies more precisely
Avoid that the packaging build picks an older jgit version coming with
eclipse platform by using a target platform which allows to define the
dependencies more precisely.
Change-Id: I39bba3baa4517e2b5e5fe0de096e756f2904e3e9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Lars Vogel [Thu, 25 Jul 2013 21:28:05 +0000 (23:28 +0200)]
Add missing @since tags
Change-Id: I9754e2124c0fe6ad2dbde5597c3ed10f1c3efef5 Signed-off-by: Lars Vogel <Lars.Vogel@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Colby Ranger [Thu, 8 Aug 2013 14:57:49 +0000 (07:57 -0700)]
Advertise capabilities with no refs in upload service.
With reference hiding, it is possible for a repository to appear
empty when all refs are hidden. This causes capabilities to not be
advertised either, since they are published with the first reference,
breaking fetch by SHA1 support.
Always advertise the capabilites by publishing the symbolic capabilities
reference when the repository has no references to advertise (similar to
the receive service).
Shawn Pearce [Wed, 7 Aug 2013 22:43:58 +0000 (15:43 -0700)]
Allow UploadPack requests with no options
UploadPack can be invoked with no capabilities selected by the
client if the client is an ancient version of Git that nobody in
their right mind should still be using. Or if the client is very
broken and does not want to use any of the newer features added to
the protocol since its inception.
Greg Hill [Fri, 26 Jul 2013 19:08:31 +0000 (12:08 -0700)]
Change RequestValidator parameter to ObjectId list
Instead of RevObject list, this allows a custom request validator to be called
on SHA-1's corresponding to objects that may not exist in repository storage
Change-Id: I19bb667beff0d0c144150a61d7a1dc6c9703be7f Signed-off-by: Greg Hill <greghill@google.com>
Christian Trutz [Thu, 25 Jul 2013 21:28:05 +0000 (23:28 +0200)]
Add setter for ProgressMonitor to StatusCommand
This is useful if Git.status() is a long running command.
Change-Id: I6bdbf347a688043d549c1f091fb4a264a6c7024e Signed-off-by: Christian Trutz <christian.trutz@gmail.com> Signed-off-by: Robin Stocker <robin@nibor.org>
Robin Stocker [Sat, 20 Jul 2013 14:26:05 +0000 (16:26 +0200)]
Fix NPE in openFetch on Transport without local repository
Setting the walk and other fields to null will result in NPEs when the
user e.g. calls fetch on the connection, but at least the advertised
refs can be read like that without having a local repository.
Bug: 413389
Change-Id: I39c8363e81a1c7e6cb3412ba88542ead669e69ed Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Robin Stocker [Mon, 15 Jul 2013 15:20:53 +0000 (17:20 +0200)]
Improve documentation of PathSuffixFilter
Change-Id: I1077dbb1f10c7cc687c0d1b8a8e8f763ca96977c Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
Allow filtering of the status. Only files which match given paths are
inspected and only their state is reported.
Change-Id: I3c4b1b46bf297cd4ebdb4997cfa14c8752a36411 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>