Commit Graph

2259 Commits

Author SHA1 Message Date
Robin Rosenberg 7de1154d21 Remove uses of TextBuiltin.out in favor of outw
These came from patches in review in parallel with the introduction
of the exception throwing print writer.

Change-Id: I1c27fa276eb1fcf12ad19792049c35cb52518c16
2012-09-23 23:00:35 +02:00
Robin Rosenberg 094df5a916 Allow @ in branch names and tighten syntax checking
Valid refs are defined by git-check-ref-format(1). In addition
we will not try to perform a lookup of an invalid ref name in
Repository.resolve().

Reported by R Shapiro in the Eclipse JGit Forum.

Change-Id: I0b098eec9ecb98a9ce16b1cfb476729aaf2fb190
2012-09-23 15:18:19 +02:00
Robin Rosenberg 78c8659428 Merge "The constructor CmdLineException(String) is deprecated" 2012-09-23 04:59:33 -04:00
Tomasz Zarna 07f9936257 The constructor CmdLineException(String) is deprecated
Use CmdLineException(CmdLineParser, String) instead. The new constructor
has been added in args4j 2.0.12, so in pom.xml that would be the minimum
version. Set the upper boundary in pom.xml to 2.1.0 (exclusive), just
like in the MANIFEST.MF.

Change-Id: If45d809e4ffa11a3572d958ce121422fb03cf8f3
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-09-23 10:49:50 +02:00
Robin Stocker ac805874f7 Refuse to checkout unmerged paths from index
Without this check, the checkout was done but the result was a "both
deleted" status when inspecting it with C Git.

Found this while working on bug 390147.

Change-Id: Ic3693f2c651827239e838bf7f37da842a7ae9707
2012-09-23 02:41:51 +02:00
Shawn O. Pearce eb5b506acd Merge changes Ic2b78ba9,Ia13e63ed
* changes:
  Use '406 Not Acceptable' when info/refs is disabled
  Compress large /info/refs responses on HTTP
2012-09-22 19:53:52 -04:00
Robin Rosenberg c3f1fac03f Suppress boxing warnings where we know they are ok
Invoke the wrapper types' valueOf via static imports.
For booleans used in asserts, add a new assert in
the JUnit utility package since out current version of JUnit
does not have the assert(boolean, boolean) method.

Change-Id: I9099bd8efbc8c133479344d51ce7dabed8958a2b
2012-09-22 01:21:00 +02:00
Matthias Sohn 46d42404d3 Merge "Fixed instability in some GC tests." 2012-09-20 16:29:03 -04:00
Sasa Zivkov 87346556d3 Fixed instability in some GC tests.
Some GC tests were sporadically failing. The reason was that they used
the setExpireAgeMillis method to define object expiration before
invoking the prune method. Depending on the CPU load during the test
run, the prune method may reach an object (which is considered
non-expired by the test) too late and actually prune it.

To make the test stable we now use the setExpire(Date expire) method and
define a time instant before which objects are considered to be expired.
This way the outcome of the prune method doesn't depend on the CPU load.

Change-Id: Ifc3323ca55ae56dbccdbc90a282ec3cf18ad7297
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2012-09-20 16:50:25 +02:00
Sasa Zivkov 7ad88afeb8 Fix the javadoc for GC.setExpire
Clarify expiration of objects with the modification time exactly at the
given time instant.

Change-Id: I2000aec89c8d6a95700380b0a32275d2d658f67e
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2012-09-20 16:20:19 +02:00
Shawn O. Pearce b3e8f29fe9 Use '406 Not Acceptable' when info/refs is disabled
Instead of a confusing 403 Forbidden error indicating the dumb file
service is disabled on this server, use 406 Not Acceptable to mean
the client sent a request for content (the plain info/refs file)
that this server does not want to provide.

The stock C Git client will report HTTP 406 error if it predates
1.6.6 or something goes wrong with the smart request and it tried
falling back to the dumb request. This may help to debug cases where
a broken proxy server exists between the client and the server and
has mangled a prior smart info/refs response.

Change-Id: Ic2b78ba9502e4bbdff7cc3ba1fd284cf7616412b
2012-09-19 19:19:20 -07:00
Shawn O. Pearce f93a6a7229 Compress large /info/refs responses on HTTP
Enable streaming compression for any response that is bigger than
the 32 KiB buffer used by SmartOutputStream. This is useful on the
info/refs file which can have many branches and tags listed, and
is often bigger than 32 KiB, but also compresses by at least 50%.

Disable streaming compression on large git-upload-pack responses,
as these are usually highly compressed Git pack data. Trying to
compress these with gzip will only waste CPU time and additional
transfer space with the gzip wrapper. Small git-upload-pack data
is usually text based negotiation responses and can be squeezed
smaller with a little bit of CPU usage.

Change-Id: Ia13e63ed334f594d5e1ab53a97240eb2e8f550e2
2012-09-19 17:33:07 -07:00
Robin Rosenberg c9cce254c7 Use x-friends instead of x-internal to expose jgit for internal use
This prevents a lot of unnecessary warnings about disouraged usage of
the org.eclipse.jgit.internal package within JGit itself.

Change-Id: Ia6683902809425fd7245e7d5d344c2ff8f317ebb
2012-09-19 23:53:53 +02:00
Matthias Sohn 4b3c0f8aba Prepare 2.2.0 builds
Change-Id: I386ba70541d644e58661d26713b309371e0f9257
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-19 09:10:12 +02:00
Matthias Sohn 555ad1f93c Merge branch 'stable-2.1'
* stable-2.1:
  Prepare for 2.1 maintenance changes
  JGit v2.1.0.201209190230-r
  Introduce "never" as parseable date
  Introduce ParseExceptions for GitDateParser
  Support config param "gc.pruneexpire"

Change-Id: If149d7f968a3425d9425f6ba9ce135a8341776a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-19 09:02:31 +02:00
Matthias Sohn 54c4eb69ac Prepare for 2.1 maintenance changes
Change-Id: I436f36a7c6dc86916eb4cde038b27f9fb183465a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-19 09:00:33 +02:00
Matthias Sohn c466bc2ddf JGit v2.1.0.201209190230-r
Change-Id: I9f94bce9a25644575a068c8fa459f74e06b02030
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-19 08:56:17 +02:00
Robin Rosenberg 1f19d0a834 Merge "Fix resolving expression with ~ and ^ than extends beyond history" 2012-09-18 18:00:38 -04:00
Dave Borowitz 70ae16d708 Fix resolving expression with ~ and ^ than extends beyond history
resolve("foo~X") where X is greater than the distance from foo to the
root should return null, but 2a2362fb introduced a bug causing it to
either return resolve("foo") or NPE. Add a test for the correct
behavior.

Also add an analogous test for foo^X where X is greater than the
number of parents (which was not broken by that commit).

Change-Id: Ic580081ece57c8c2df29b652897b425ecb34e11f
2012-09-18 19:51:57 +02:00
Robin Rosenberg e0a3091af7 Introduce "never" as parseable date
For configuration parameter like "gc.pruneexpire" we need to understand
the value "never". Never is handled as a date so far into the future
that it will never happen. The actual value currently used is the
constant GitDateParser.NEVER.

Change-Id: I7744eaee9bf5026da517151c212c88325c348d6c
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-09-18 19:23:17 +02:00
Christian Halstrick 84e171fbab Introduce ParseExceptions for GitDateParser
Instead of just returning null when something was not parseable we
should throw a real ParseException. This allows us to distinguish
between specifications which are unparseable and those which represent
no date (e.g. "never")

Change-Id: Ib3c1aa64b65ed0e0270791a365f2fa72ab78a3f4
2012-09-17 22:41:06 +02:00
Christian Halstrick 27b791c591 Support config param "gc.pruneexpire"
Make GC honor the config parameter gc.pruneexpire. If the parameter is
not set then the default is "2.weeks.ago"

Change-Id: I0ae0ca85993cafb4bc75ba80504da18544894ec3
2012-09-17 22:41:06 +02:00
Tomasz Zarna f7b644df66 Add tests for output result of merging -- org.eclipse.jgit.pgm.Merge
Change-Id: I888c7e80503b869d65a9617e6a07e01d1ff5f197
2012-09-17 07:07:00 -07:00
Shawn Pearce 18e020218b Merge "Suppress two resource warnings" 2012-09-16 21:13:15 -04:00
Sasa Zivkov a551493240 Additional unit tests for the GC
Change-Id: Id5b578f7040c6c896ab9386a6b5ed62b0f495ed5
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-16 23:57:18 +02:00
Robin Rosenberg caa362f20d Check for write errors in standard out and exit with error
The underlying problem is that System.out is a PrintWriter and
as such it does not throw exceptions on error, but rather just
sets a flag and continues.

This changes replaces the use of System.out with a PrintWriter-like
writer that does not catch error, but instead throw them to the
caller.

Bug: 366243
Change-Id: I44405edc4416e943b87f09a0f6ed041c6c51b046
2012-09-16 11:12:47 -07:00
Shawn Pearce 1a07ddca85 Merge changes I8449695e,Idecd8018
* changes:
  Use assertEquals instead of == for literal primitives
  Use assertTrue/False instead of equals with boolean literals
2012-09-16 14:11:30 -04:00
Robin Rosenberg d92287bcc2 Use assertEquals instead of == for literal primitives
Change-Id: I8449695ecc94a423369a7644a6ec93cf0cacef5d
2012-09-16 00:23:51 +02:00
Robin Rosenberg a7b0641b96 Use assertTrue/False instead of equals with boolean literals
This include replacing assertTrue(!..) with assertFalse()

Change-Id: Idecd8018641454e10127d82ea3ddda3f671489ef
2012-09-16 00:23:23 +02:00
Robin Rosenberg 28adbb3500 Merge "Ignore non-commit refs when in RevWalkUtils.findBranchesReachableFrom" 2012-09-14 18:59:38 -04:00
Robin Stocker 187101808c [findBugs] Silence warning about Transport initialization
Change-Id: I98fc9720106bcd873b330090bafde276508f8a40
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-14 00:01:47 +02:00
Tommi Siivola 0e56f34752 Fix ResolveMerger issue with submodule conflict
ResolveMerger throws a MissingObjectException when it encounters
a submodule conflict while merging. The reason is that it treats
the submodule link as a blob and tries to read its contents.

We solve the issue by detecting before content merge whether the
path to be merged is a submodule link, and skip the content
merge if it is.

Bug: 389238
Change-Id: I9a58dfc7716b28a21f5c04cf3a865091ae8dfe7e
Signed-off-by: Tommi Siivola <tommi.siivola@eficode.com>
2012-09-12 13:11:57 +03:00
Matthias Sohn e5cd1d4add Merge "Added new Status CLI command 'jgit status'" 2012-09-11 16:48:00 -04:00
Shawn O. Pearce fdf1f413b6 Remove protobuf from top-level pom.xml
This dependency is unused, and does not need to be
version-managed in the top-level pom.xml anymore.

Change-Id: I240d21b6478e15b05e679b8d976af171d81a524e
2012-09-11 07:06:35 -07:00
Matthias Sohn 7d789502a2 Merge "README: Convert to Markdown and rename to README.md" 2012-09-10 18:12:50 -04:00
Jason Pyeron 79d3dd8391 Ignore attempts to set the timeout to -1
The value of -1 is the default value used by the underlying http
transports provided by the jre. On some versions an attempt to
set the timeout explicitly to -1 triggers a check condition,
disallowing negative numbers.

Bug: 389003
Change-Id: I74a22f8edc6c8e15843ad07c96a137739d9dcad1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-10 23:50:10 +02:00
Robin Rosenberg 5f094154dd Added new Status CLI command 'jgit status'
This is a first basic implementation that displays current branch and
list of files of various status, but isn't as refined as its native
counterpart (e.g. does not say if we're ahead or behind the remote).
It's been helpful in the diagnostic of bug #347885.

Bug: 348318
CQ: 6769
Change-Id: Ifc35da608fbba652524c1b5b522e3c0d5369ad5e
Signed-off-by: François Rey <eclipse.org@francois.rey.name>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
2012-09-09 21:10:59 +02:00
Robin Stocker 6b74aff641 README: Convert to Markdown and rename to README.md
This makes it display nicely on the GitHub mirror repository. And it is
still very pleasant to read in plain text.

Change-Id: I0c5e1caa58a22684cdbd9a02e9ec38e97d5adb1a
Signed-off-by: Robin Stocker <robin@nibor.org>
2012-09-08 19:58:37 +02:00
Robin Rosenberg 833fd09442 Ignore non-commit refs when in RevWalkUtils.findBranchesReachableFrom
This methods is for finding branches only.

Change-Id: Ic68b5295ff814401890f0592ae95851554706ca6
2012-09-08 12:08:07 +02:00
Shawn O. Pearce e63f1c94f8 Mark fields of BaseReceivePack private
None of these should have been exposed to base classes. The majority
of them are private implementation details that are not required by a
subclass in order to interact with the base protocol definition. The
few that are needed should be visible as accessor methods, so the
internals can be modified without breaking the public JGit API.

Change-Id: I874179105c9c37703307facbbf99387c52bf772c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-05 17:20:12 +02:00
Shawn O. Pearce 9638e0aa87 Delete checkObjectCollisions from PackParser
This flag was added to provide an unsafe operation on the local
repository because the storage.dht code was too damn slow to provide
proper safe Git behavior all of the time. Now that stoarge.dht has
been removed from the repository, also delete this unsafe flag to
prevent applications from misusing the JGit library and permitting
users to potentially damage their local repository with bad data
received from an untrusted peer.

Change-Id: Ib1861c48bb74836731e7b7d57b635dd654b0dc66
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-05 17:20:05 +02:00
Shawn O. Pearce 130ad4ea44 Delete storage.dht package
This experiment proved to be not very useful. I had originally
planned to use this on top of Google Bigtable, Apache HBase or
Apache Cassandra. Unfortunately the schema is very complex and
does not perform well. The storage.dfs package has much better
performance and has been in production at Google for many months
now, proving it is a viable storage backend for Git.

As there are no users of the storage.dht schema, either at Google or
any other company, nor any valid open source implementations of the
storage system, drop the entire package and API from the JGit project.
There is no point in trying to maintain code that is simply not used.

Change-Id: Ia8d32f27426d2bcc12e7dc9cc4524c59f4fe4df9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-05 17:19:51 +02:00
Tomasz Zarna e44c3e7139 Output result of switching branch -- o.e.jgit.pgm.Checkout
Change-Id: I9829950b686ce3b8c70b8f7a1774d5e2b55cd00a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-05 07:59:37 +02:00
Robin Rosenberg f590a4c667 Fix NPE when notes are present
Change-Id: If9200ae4a7f582a5562aecf323ff0430ba154583
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-05 07:42:12 +02:00
Robin Rosenberg cd23b214bf cleanup: use assertArrayEquals for assertion on arrays
Change-Id: I1df945011f8e5f03959b693d3564fe357e707f91
2012-09-03 22:37:58 +02:00
Robin Rosenberg 476e1d2ff1 cleanup: Prefer assertEquals over assertTrue(....equals(...))
That is the common style and yields better diagnostics on failure.

Change-Id: I831a55615a812734af0912a5d6bbfd1edc75308e
2012-09-03 22:37:57 +02:00
Christian Halstrick 32e952fefd Merge "Support branches with name 'config'" 2012-09-03 08:15:31 -04:00
Matthias Sohn 9d3110e72d Merge "Add tests for more coverage of CheckoutCommand" 2012-09-03 02:52:41 -04:00
Robin Stocker 11533f5d1d Add tests for more coverage of CheckoutCommand
Change-Id: Id3ab5f56f88d7e9636c71b30258c268a75fc422e
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2012-09-03 08:44:28 +02:00
Robin Stocker 51c20b27ac DirCacheCheckout: Fix handling of files not in index
When a file is not in the index and neither contents nor mode differ
between "head" and "merge", the index state should be kept. If they
differ, a checkout conflict should occur. This is described in Git's
git-read-tree.txt.

JGit used to replace the index state with "merge" in both of the above
cases.

A confusing effect of this was that when one removed a file and then did
a rebase, the file silently reappeared again.

The changes to dir/file conflict handling are a consequence of this
change, as the index handling change made tests in DirCacheCheckoutTest
break. I compared these cases to C Git and the new behavior there also
matches what C Git does.

Bug: 387390
Change-Id: I5beb781f12172a68f98c67d4c8029eb51ceae62d
Signed-off-by: Robin Stocker <robin@nibor.org>
2012-09-01 13:29:00 +02:00