Robin Rosenberg [Mon, 8 Oct 2012 04:27:30 +0000 (06:27 +0200)]
Add a hint on the purpose of JGitInternalException to the constructor
In code review we often see uses of JGitInternalException where a high
level GitAPIException would be more appropriate. Hopefully the word
low-level in the constructor comment will lead to fewer such cases.
Robin Rosenberg [Tue, 2 Oct 2012 10:45:29 +0000 (12:45 +0200)]
Fix unstable test
Add more time to a timestamp to safely go beyond the granularity of
the timestamp resolution of the file system. The lowest resolution we
know of is FAT with two second resolution. Then add some to make sure we
are above the limit.
Markus Keller [Wed, 26 Sep 2012 22:17:53 +0000 (00:17 +0200)]
Fix compile error (method not available in 1.5)
Change-Id: I07aca821010daca75a66506b9ca738bc8c262abb Signed-off-by: Markus Keller <markus_keller@ch.ibm.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
07f9 seems to require a more recent args4j, but I cannot locate a CQ
that verifies we can use a version more recent then 2.0.12. 2.0.16
has been released, but the Hudson CI instance at Eclipse won't
build it.
Since the commit fixes an issue identified in March but wasn't
actually submitted to the tree until September, we can continue to
ignore whatever the problem is/was until someone can attempt a more
correctly working solution.
Tomasz Zarna [Mon, 12 Mar 2012 09:53:30 +0000 (10:53 +0100)]
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>
Robin Rosenberg [Fri, 21 Sep 2012 23:15:39 +0000 (01:15 +0200)]
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.
Sasa Zivkov [Thu, 20 Sep 2012 14:50:25 +0000 (16:50 +0200)]
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>
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.
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.
Matthias Sohn [Wed, 19 Sep 2012 07:02:04 +0000 (09:02 +0200)]
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>
Dave Borowitz [Tue, 18 Sep 2012 17:49:35 +0000 (19:49 +0200)]
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).
Robin Rosenberg [Tue, 18 Sep 2012 17:23:17 +0000 (19:23 +0200)]
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>
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")
Sasa Zivkov [Sun, 16 Sep 2012 21:57:18 +0000 (23:57 +0200)]
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>
Robin Rosenberg [Fri, 14 Sep 2012 16:48:56 +0000 (18:48 +0200)]
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.
Robin Stocker [Thu, 13 Sep 2012 22:01:47 +0000 (00:01 +0200)]
[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>
Tommi Siivola [Wed, 12 Sep 2012 05:19:30 +0000 (08:19 +0300)]
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>
Jason Pyeron [Mon, 10 Sep 2012 21:50:10 +0000 (23:50 +0200)]
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>
Robin Rosenberg [Sun, 9 Sep 2012 19:02:40 +0000 (21:02 +0200)]
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>
Shawn O. Pearce [Sat, 18 Aug 2012 22:51:03 +0000 (15:51 -0700)]
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>
Shawn O. Pearce [Sat, 18 Aug 2012 22:42:12 +0000 (15:42 -0700)]
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>
Shawn O. Pearce [Sat, 18 Aug 2012 22:27:12 +0000 (15:27 -0700)]
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>
Robin Stocker [Mon, 3 Sep 2012 06:44:28 +0000 (08:44 +0200)]
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>
Robin Stocker [Thu, 16 Aug 2012 14:06:58 +0000 (16:06 +0200)]
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>
Robin Rosenberg [Sat, 1 Sep 2012 07:56:51 +0000 (09:56 +0200)]
Create an input stream that transforms LF to CRLF
The transformation is the same as AutoCRLFOutputStream does, but
the direction is reversed. The tests are reused, but the implementation
derives somewhat from the EolCanonicalizingInputStream.
This stream will be used to compare blobs with LF line endings with
worktree data that has CRLF line endings.
Bug: 387501
Change-Id: I80d96e453e7f780dd464a89778de124cf35384e1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Enhance statistics for repo by sizes and ref-counts
The statistics for a repo now expose how many bytes are used in the
filesystem to store all loose/packed objects. The number of packed/loose
refs are also exposed.
In order to parse user specified strings containing date and time info
a thread-safe parser is implemented. This is needed for example to
interpret configuration parameters (e.g. gc.pruneexpire where need to
parse strings like "2 weeks ago"). The parser is thread-safe by caching
SimpleDateFormat instances in a ThreadLocal cache.
Native git has a parser called approxidate which is able to interpret a
huge number of formats ("1 year ago", "tea time", ...). Ideally JGit
should be able to parse the same strings as native git but for now this
parser understands the following subset:
Robin Rosenberg [Thu, 2 Aug 2012 22:56:46 +0000 (00:56 +0200)]
Set core.precomposeunicode to true when creating repository on Mac
Java has no option but to use precomposed Unicode, so we should
state that when creating a new repository. Not that Java will use
precomposed unicode regardless of this setting, but this reduces
the risk of incompatibility with C Git.
Robin Rosenberg [Tue, 21 Aug 2012 21:34:45 +0000 (17:34 -0400)]
Merge changes I98df46ce,Ifb815a12,I051a1724
* changes:
Support [<ref>]@{upstream} revision syntax
Support parsing previous checkout as a revision expresion.
Allow a @ without branch in revision syntax