Robin Rosenberg [Wed, 14 Nov 2012 23:53:53 +0000 (00:53 +0100)]
Make an exception for the formatting rules (turn off) for some files
Our rule to enforce javodocs for public members gives us a problem
because there are some patterns where javadoc make little sense so we
make the comments as small as possible, which our formatting rules do
not like, so disable it for those source files.
Change-Id: I6e3edb1e650ed45428b89cf41e6151b6536bca8a Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Robin Rosenberg [Tue, 13 Nov 2012 01:31:54 +0000 (02:31 +0100)]
Harmonize the JDT settings within JGit
Note the the settings are slightly less restrictive for test bundles.
-Also cleanup a couple of malformed javadocs
-Update compiler warnings/errors to include default values from Juno
-We now flag diagnosed null dereference as error. We didn't do that
earlier because of some false positives.
Change-Id: I58386d63164e65d3d8d1998da3390d99bdc7381a Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Matthias Sohn [Fri, 16 Nov 2012 01:04:58 +0000 (02:04 +0100)]
Add missing @since tags to mark API added in 2.2
Change-Id: I458167739210214fa54c4b3d62fac5abc82f96f7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Jonathan Nieder [Wed, 14 Nov 2012 20:14:20 +0000 (12:14 -0800)]
diff, log -p: do not use outs before it is initialized
Since commit caa362f20df1 (Check for write errors in standard out and
exit with error, 2012-09-14), running "jgit diff" results in a
NullPointerException:
| $ jgit diff
| java.lang.NullPointerException
| at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
| at java.io.BufferedOutputStream.write(BufferedOutputStream.java:126)
| at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:688)
| at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:630)
| at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:616)
| at org.eclipse.jgit.diff.DiffFormatter.format(DiffFormatter.java:600)
| at org.eclipse.jgit.pgm.Diff.run(Diff.java:211)
| at org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:166)
| at org.eclipse.jgit.pgm.Main.execute(Main.java:200)
| at org.eclipse.jgit.pgm.Main.run(Main.java:120)
| at org.eclipse.jgit.pgm.Main.main(Main.java:94)
That patch replaced most uses of System.out with a wrapper, with
changes like the following:
class Diff extends TextBuiltin {
private final DiffFormatter diffFmt = new DiffFormatter( //
- new BufferedOutputStream(System.out));
+ new BufferedOutputStream(outs));
outs is not set for TextBuiltin objects until init() has been run.
Moving the initialization to after the super.init() call gets
"jgit diff" and "jgit log -p" working well again.
Robin Stocker [Sat, 20 Oct 2012 20:00:13 +0000 (22:00 +0200)]
CommitCommand: Ensure unmerged paths are added correctly with setOnly
With bug 391855, PathEdit will be changed to apply an edit for each
stage. With that, CommitCommand would no longer work correctly when
committing an unmerged path.
This changes it to use a DirCacheBuilder which allows us to correctly
replace the entries for the three stages with one, which is not possible
with PathEdit.
Robin Stocker [Sun, 28 Oct 2012 14:57:43 +0000 (15:57 +0100)]
ResetCommand: Use DirCacheBuilder in resetIndex
With bug 391855, DirCacheEditor's PathEdit will be applied for each
stage. For an unmerged path, this would result in 3 equal entries for
the same path.
By using a DirCacheBuilder, the code is simpler and does not have the
above problem with unmerged paths.
Bug: 391860
Change-Id: I785deeaeb8474f8c7a7fbc9ef00d3131fac87e41 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Robin Rosenberg [Wed, 10 Oct 2012 06:02:30 +0000 (08:02 +0200)]
Suppress resource warnings with Java 7
For streams that should not be closed, i.e. don't own an underlying
stream, and in-memory streams that do not need to be closed we just
suppress the warning. This mostly apply to test cases. GC is enough.
For streams with external resources (i.e. files) we add the necessary
call to close().
Shawn O. Pearce [Wed, 17 Oct 2012 14:55:15 +0000 (07:55 -0700)]
Simplify push error message when ref already exists
If a client attempts to create a branch that already exists on the
remote side, tell them "already exists" rather than repeat lots of
information about the reference. Previously the error looked like:
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 [Sat, 6 Oct 2012 11:08:16 +0000 (13:08 +0200)]
Fix for Iff768422c, use offset 0 when going back to work tree iterator
In Iff768422c the offset used for the content id was fixed to use the
offset that applied to the dircache iterator. Unfortunately the index
for the dircache content id offset stuck for entries that were not in
the index. Few caller probably cared about that, unless it actually
caused an ArrayIndexOutOfBoundsException.
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.