Commit Graph

2122 Commits

Author SHA1 Message Date
Matthias Sohn 447002b303 Revert Jetty from 8.1.3.v20120416 to 7.6.0.v20120127
This reverts commit 24a0f47e32 and
updates JGit dependencies to use the latest available Jetty 7.x
release. We can't use Jetty 8.x since it depends on Servlet API 3.0
which requires Java 6 but JGit still wants to support Java 5.
Use one of the target platforms defined in
Ibf67a6d3539fa0708a3e5dbe44fb899c56fbd8ed to work with that in Eclipse.

Change-Id: I343273d994dc7b6e0287c604e5926ff77d5b585b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-06-03 08:32:38 +02:00
Matthias Sohn ac98c29df9 Use default thread pool to prevent thread pool starvation
Bug: 380302
Change-Id: Ie66d495481776469ff2aa603c550557cff82cafc
Suggested-By: Joakim Erdfelt <joakim@intalio.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-06-03 08:00:48 +02:00
Robin Rosenberg 23b8136f8c Merge "Reduce number of hard-coded maven artifact versions" into stable-2.0 2012-05-31 17:49:29 -04:00
Robin Rosenberg 76514a3450 Remove obsolete GitlinksNotSupportedException
Change-Id: Idddd86818858b229e68b4a46597fc67547bcce17
2012-05-31 23:46:06 +02:00
Kevin Sawicki 058c74d8ad Update ORIG_HEAD when resetting
Write the old object id from the RefUpdate to the
ORIG_HEAD file after the update completes.

Add two new convenience methods to Repository to read
and write the ORIG_HEAD reference similar to the methods
for reading/writing CHERRY_PICK_HEAD and MERGE_HEAD.

Bug: 375525
Change-Id: I120b3b2cd3b1ddae88fce435285bae15cbf96f5e
2012-05-31 21:52:31 +02:00
Matthias Sohn b0531ee180 Reduce number of hard-coded maven artifact versions
This reduces the number of hard-coded version numbers we have to touch
with every release.

Change-Id: I0f2e910423d3db081b644968cd0d6a89178ba12a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-31 01:50:55 +02:00
Matthias Sohn 9bd9d9a698 Prepare next 2.0.0-SNAPSHOT builds
Change-Id: Iffc57d6b25dafb72272d1957116c19ab45ba2c54
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-31 01:39:57 +02:00
Matthias Sohn 4aa550f7cc JGit v2.0.0.201205301645-rc2
Change-Id: Ic4f84f1a11c93863c229c0089f2e4edc7c7a36b7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-30 23:08:15 +02:00
Robin Rosenberg 4e1454ded6 Git API does not declare GitAPIException call() and related cleanups
All commands should throw a GitAPIException so new exceptions can be
added without breaking the builds of old code, i.e. anyone that calls
a Git API should catch GitAPIException and not just the currently known
exceptions.

Now the only checked exceptions on Git API calls are GitException and
subclasses of it. New checked exceptions that are subclasses of
GitException may be added without breaking the API.

Javadoc for GitAPIException is declared on GitCommand and
inherited to subclasses. JGitInternalException is not explicitly
documented anymore.

Unfortunately this change itself breaks the API. The intention is
that it shall be possible to add new checked subclasses of
GitAPIException without breaking the API.

Bug: 366914
EGit-Change-Id: I50380f13fc82c22d0036f47c7859cc3a77e767c5
Change-Id: I50380f13fc82c22d0036f47c7859cc3a77e767c5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-30 22:08:49 +02:00
Robin Rosenberg 629e7cd926 Merge "Retain file length and mod time when doing a mixed reset" into stable-2.0 2012-05-30 15:57:04 -04:00
Robin Rosenberg 875247e24b Merge "Update smudged entries when writing index" into stable-2.0 2012-05-30 15:56:30 -04:00
Matthias Sohn 59d2ef9470 Enable loading history until a given commit
This is needed to allow jumping to a selected commit when loading
history incrementally.

Change-Id: Id3b97d88d3b4b2d67561b11f8810cb88fe040823
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-30 10:26:21 +02:00
Kevin Sawicki 91f5ce3a15 Only increment mod count if packed-refs file changes
Previously if a packed-refs file was racily clean then there
was a 2.5 second window in which each call to getPackedRefs
would increment the mod count causing a RefsChangedEvent to be
fired since the FileSnapshot would report the file as modified.

If a RefsChangedListener called getRef/getRefs from the
onRefsChanged method then a StackOverflowError could occur
since the stack could be exhausted before the 2.5 second
window expired and the packed-refs file would no longer
report being modified.

Now a SHA-1 is computed of the packed-refs file and the
mod count is only incremented when the packed refs are
successfully set and the id of the new packed-refs file
does not match the id of the old packed-refs file.

Change-Id: I8cab6e5929479ed748812b8598c7628370e79697
2012-05-28 14:06:12 -07:00
Kevin Sawicki 531db82f38 Retain file length and mod time when doing a mixed reset
Previously the index was cleared and updated with a new tree.

Now the commit being reset to and the index are iterated over
in a tree walk and the current index mod time and file length
are copied over to the new dir cache entry being written if
the object ids are the same.

Change-Id: Iaf9e624efb0bf90f9e05fcb0587dde4dec50000c
2012-05-28 14:01:37 -07:00
Kevin Sawicki dac66672df Update smudged entries when writing index
Overload DirCache.lock to take a repository that is
used for updating smudged index entries with information
from the repository's working tree.

New unit tests are also added for updating smudged index
entries on reset, checkout, and commit.

Change-Id: I88689f26000e4e57e77931e5ace7c804d92af1b6
2012-05-28 14:01:14 -07:00
Stefan Lay e3bb6ae3fd Merge "Enable loading history until a given commit" 2012-05-25 03:51:21 -04:00
Matthias Sohn 24a0f47e32 Update Jetty to 8.1.3.v20120416
Jetty 8.1.3 comes with Juno M7 and this version can be installed from
http://download.eclipse.org/jetty/updates/jetty-bundles-8.x/8.1.3.v20120416/

Change-Id: Ifc4bfbb3efbab0f5bfbde74f0b2ddc5a2f9ee6a5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-23 22:21:58 +02:00
Tomasz Zarna 23e0a3e734 Add config --list command to pgm
Currently, only --list option is supported with --global, --system,
--local and --file switches.

Change-Id: I9b179b162996520e95c4e001dccd65c566a4bd27
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-23 16:35:08 +02:00
Dariusz Luksza 1bec1f2fae Ensure resetting on commit id
When reset command was called with tag name as parameter the resulting
HEAD was set to the tag's SHA-1 which is a bug. This patch ensures that
repository.resolve() call always returns commit id.

Change-Id: I219b898c620a75c497c8652dbf4735fd094c4d7c
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-23 16:18:33 +02:00
Shawn O. Pearce 3da13473f7 Use BatchRefUpdate for tracking refs in FetchProcess
If there are a lot of references to modify, using BatchRefUpdate can
save time if the underlying storage is able to combine these updates
together. This should speed up initial clone or fetch into an empty
repository, as some projects can have hundreds of release tags, or
hundreds of branch heads.

Change-Id: Iee9af8d5fa19080077d88357c18853540936e940
2012-05-22 20:39:59 -07:00
Shawn O. Pearce 17be66acdb Batch reference updates together for storage
clone, fetch and push can all update multiple references in a single
command invocation. Rather than performing sequential iteration
of each reference change inside of the application code, push this
down into the reference database where the implementation can take
advantage of the batch size and optimize itself.

For the local filesystem implementation the obvious optimization
is to write a packed-refs file when the repository is completely
empty. The initial clone, fetch or push into the destination may
have hundreds of new references. Writing all of these as loose
files is not efficient. This optimization is not implemented in
this commit and is left as an exercise for the reader to supply
in a future commit to JGit.

To make the API changes simple, define the BatchRefUpdate type and
implementation using the existing sequential behavior.

Change-Id: I8e1674f091e05e24e3ff56ccbc687a6d18a6a61e
2012-05-22 16:45:06 -07:00
Shawn O. Pearce d8d649a43e Expose ReceiveCommand.updateType to check for UPDATE_NONFASTFORWARD
When a command's type is UPDATE, JGit might not yet be sure if it
is a fast-forward or not. Expose a utility method to compute the
exact type by performing the merge base test, allowing the type
to be switched to UPDATE_NONFASTFORWARD if old ObjectId is not
contained in new ObjectId.

BaseReceivePack already does this test when validating the incoming
command list, so provide a package level backdoor to set the type
and avoid needing to redo the merge test later.

Change-Id: If5a6fcc50dc4d6f96e9bb0bb7bba15ebe8b86377
2012-05-22 16:28:34 -07:00
Shawn O. Pearce 04fa307a70 Reject non-fast-forwards earlier in BaseReceivePack
If BaseReceivePack has setAllowNonFastForwards(false) configured
(such as by receive.denynonfastforwards), automatically reject
any command that attempts a non-fast-forward update before it goes
further in processing.

This matches with other checks in validateCommands(), such as the
early failure of delete attempts when isAllowDeletes() is false.

Change-Id: I3bb28e4dd6d17cb31ede09eb84ceb67cdb17ea5d
2012-05-22 16:28:34 -07:00
Shawn O. Pearce 3da4c6fc58 Move NLS test for HttpServerText to http.test
This never should have been in the core library test suite, as that
test suite never should depend upon the HTTP server module.

Change-Id: Ie0528c4d1c755823303d138e327a3a2f4caccc32
2012-05-22 14:52:32 -07:00
Matthias Sohn 8c73245fd0 Fix JGit source bundle packaging
Due to Tycho bug 368596 we didn't package the correct JGit source bundle
anymore. Instead of sources it contained the binary bundle. As a
workaround fall back to use packaging type eclipse-update-site which
doesn't seem to have this problem.

Bug: 368596
Bug: 379402
Change-Id: I3192dbd00b51e6ee6596d2301050b2a6f7028e3b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-21 20:51:10 +02:00
Robin Rosenberg 1953ae6aee Smudge index entries on first write (too), as well when reading
That happens when the index and a new file is created within the same
second and becomes a problem if we then modify the newly created file
within the same second after adding it to the index. Without smudging
JGit will, on later reads, think the file is unchanged.

The accompanying test passed with the smuding on read.

Change-Id: I4dfecf5c93993ef690e7f0dddb3f3e6125daae15
2012-05-21 10:48:40 -07:00
Matthias Sohn b14aa4df99 Enable loading history until a given commit
This is needed to allow jumping to a selected commit when loading
history incrementally.

Change-Id: Id3b97d88d3b4b2d67561b11f8810cb88fe040823
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-21 15:17:31 +02:00
Mikael Karlsson 15147a273f Add user friendly output from jgit commit command
Instead of printing the stack trace from the JGitInternalException
thrown from CommitMessage.call(), print just the exception
message, using the Die exception.

Change-Id: I9ec3eb02eb001813fa15ac6f90a606223dcdafdc
2012-05-18 22:07:50 +02:00
Dariusz Luksza 28d48b87ad Don't swallow JSchException "Auth fail" exception
"Auth fail" exception was swallowed during retrying, this leads to
"Session down" exception during clone operation with invalid SSH keys.

Bug: 336795
Change-Id: Id8d9e83b10f4f2a01e0cf89819190bb23a04a2b9
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
2012-05-16 07:55:03 +02:00
Dave Borowitz 37307af6b4 Enable call chaining on LsRemoteCommand methods
Change-Id: I706332386415892d7a964b241442832ad79fa223
2012-05-14 11:52:48 -07:00
Dave Borowitz cc37cb777e Factor a base class out of ReceivePack
We are working on a publish/subscribe based git protocol, and we want to
reuse several parts of the ReceivePack-like code for reading commands
and processing a pack. In this new implementation, the connection
management will be very different, in particular, there may be multiple
packs received on a single open connection. So, hoist out as much as we
can from ReceivePack, mostly just leaving behind the single-connection
version in that class.

Change-Id: I5567aad6ae77951f73f59c1f91996d934ea88334
2012-05-14 11:41:25 -07:00
Tomasz Zarna 94285e691a Add --all switch to org.eclipse.jgit.pgm.Commit
Change-Id: Iab52f995676daf60e0dfa043cc9e022f6e32a758
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-05-10 18:31:33 -07:00
Tomasz Zarna ef98c3ec86 Cleanup MergeResult constructors
'mergeStrategy' should be 5th argument, after 'mergeStatus'. Pass
'description' if available.

Change-Id: I97cebfe5d7db6247fe899075d917b82955906f85
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-05-10 18:23:56 -07:00
Matthias Sohn c394d05a47 Add missing @since tags to mark API added in 2.0
Change-Id: I0a86ce0e393dfde9bb27f0b29e036e76c856396e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
2012-05-10 18:17:24 -07:00
Matthias Sohn 43543e79a4 Update tycho version to 0.14.1
Tycho 0.14.1 enforces that artifactId and feature/bundle SymbolicName
must match, hence follow recommended migration practice and change
groupId of feature projects in order not to change the feature names as
this would require a feature migration.

Also migrate the p2 repository build from the deprecated packaging type
eclipse-update-site to packaging type eclipse-repository.

Change-Id: I99fc6c2bbb20efbd6514bdd9940f3535707c21bc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-10 00:48:59 +02:00
Matthias Sohn c3709f4ef0 Update packaging project to build using Indigo platform
Change-Id: I4c07112a6723d90d3677761f5476af00ead58282
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-10 00:48:59 +02:00
Kevin Sawicki d72a459f93 Remove throws IOException declaration on filterClean
This method only creates an EolCanonicalizingInputStream
which does not throw an IOException and so the throws
declaration on the method is unneeded.

Change-Id: Icae8b80006c5e3ffcf3b69790a1a45c505be0f05
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-10 00:33:03 +02:00
Kevin Sawicki a9133e55a4 Add Object type to Comparable implements declaration
This removes unchecked warnings when a List of
AnyObjectId objects or any of its subclasses are
passed to Collections.sort such as in PackWriter

Change-Id: I806732cee24349c75c0357a655df55b070f2f213
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-10 00:32:47 +02:00
Kevin Sawicki e3335cfa6b Remove 4 unboxed warnings
Use Integer.intValue to explicitly convert to an int

Change-Id: I1135ed01af4e274b26d6b07d1a50f48ef0a30d91
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-10 00:32:27 +02:00
Kevin Sawicki 6ebc477c0b Make output stream optional in DiffCommand
Use the NullOutputStream.INSTANCE value when the
configured output stream is null or the command is
configured to only show name and status.

Also only set the context and prefix options if
formatting is actually being performed.

Bug: 377157
Change-Id: I333cfcc82ee746f3c6a8e94c09dcc803ffbb4b3a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-05-10 00:19:04 +02:00
Kevin Sawicki c403d0b187 Compare modes before comparing ids in ResolveMerger
Comparing ids can be more expensive so do the cheap
mode check first and short circuit the id comparison
when modes are non-equal

Change-Id: I671eda51c74a411cc27de9d6077cc76e816ebe2b
2012-05-09 14:31:59 -07:00
Kevin Sawicki 17fb542e9e Remove 86 boxing warnings
Use Integer, Character, and Long valueOf methods when
passing parameters to MessageFormat and other places
that expect objects instead of primitives

Change-Id: I5942fbdbca6a378136c00d951ce61167f2366ca4
2012-05-08 21:42:53 -07:00
Kevin Sawicki e4effd25c5 Remove unnecessary boxing SuppressWarnings annotation
Change-Id: Id8a6d9f96860742f9094efdb4f31a952be7d3025
2012-05-08 20:42:19 -07:00
Kevin Sawicki 6f432673c1 Remove unneeded catch block and null checks
The catched exception was just rethrown and the
null check of the locked dir cache was unneeded if
the assignment was done outside the try block.

Change-Id: If2ee1f3eff3849f8da51eab825057fc56e166a94
2012-05-04 14:37:40 -07:00
Tomasz Zarna e5633ba2d3 Fix two typos in CLIText.properties
Change-Id: Id1429d52c88a9e2b888e6c6906cf8148945bd2ca
2012-05-02 11:35:13 +02:00
Matthias Sohn 92991aeee9 Merge "Update README regarding CRLF conversion, /etc and $HOME" 2012-04-30 16:07:38 -04:00
Robin Rosenberg bf41eb0aed Update README regarding CRLF conversion, /etc and $HOME
Change-Id: I3c41a8ee7f500e2c39df94eaf5d87c234934b741
2012-04-29 00:37:54 +02:00
Robin Rosenberg 42d7565ba9 Validate paths during DirCheckout
DirCacheCheckout and CanonicalTreeParser cooperate. CanonicalTreeParser
can detect malformed, potentially malicious tree entries and sets a
flag, while DirCacheCheckout refuses to work with such paths.

Malicious tree entries are ".", "..", ".git" (case insensitive), any
name containing '/' and (on Windows '\') and also (on Windows)
any paths ending in a combination of '.' or space or containing a ':'.
We also forbid all special names like "con" etc on Windows.

Some of the test can execute on any platform by enabling partial
platform emulation.

A new runtime exception, InvalidPathException, is introduced. For
backwards compatibility it extends InvalidArgumentException.

Change-Id: I86199105814b63d4340e5de0e471d0da6b579ead
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-04-23 22:37:50 +02:00
Robin Rosenberg 9c5b31703f Enable large file support
Allow adding files with size over 2 GB. The drawback is that the tests
for huge file support adds roughly 10 minutes of execution time.
For that reason we @Ignore the test in the standard test execution.

Change-Id: I5788e8009899203b346f353297166825b3744575
2012-04-18 21:59:15 +02:00
Tomasz Zarna a2dac2c78d Allow to write tests with CLI syntax
CQ: 6385
Bug: 365444
Change-Id: I2d5164cd92429673fe3c37e9f5f9bc565192cc12
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-04-18 18:57:36 +02:00