]> source.dussan.org Git - jgit.git/log
jgit.git
8 years agoRepositorySetupWorkDirTest: Fix "resource leak" warnings 46/64946/1
David Pursehouse [Fri, 22 Jan 2016 05:21:15 +0000 (14:21 +0900)]
RepositorySetupWorkDirTest: Fix "resource leak" warnings

Use FileRepositoryBuilder to create the Repository, except in cases
where the creation was already in a try-block. Convert those to use
a try-with-resource.

Change-Id: I7d7adeee81bda6e80d91a119c7d690de3d00dc2b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoJGit v4.2.0.201601211800-r 33/64933/1 v4.2.0.201601211800-r
Matthias Sohn [Thu, 21 Jan 2016 22:47:12 +0000 (23:47 +0100)]
JGit v4.2.0.201601211800-r

Change-Id: I89f33b0da81ff499315baa5311f95f31724fa510
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agoAdd progress monitor to Merger 01/64901/1
Laurent Delaigue [Wed, 13 Jan 2016 15:56:00 +0000 (16:56 +0100)]
Add progress monitor to Merger

Monitoring progress of merges can be useful for users for large
repositories or complex merge processes that take some time.

This enables setting a monitor. Existing merge implementations in jgit
do not yet report progress if a monitor is set. This will be added in a
later change.

Change-Id: I17b978b3fc91750dd88649638b90a46820a0877c
Signed-off-by: Laurent Delaigue <laurent.delaigue@obeo.fr>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agoFix TransportException when reading bundle 00/64900/1
Chris Gavin [Wed, 6 Jan 2016 15:53:22 +0000 (15:53 +0000)]
Fix TransportException when reading bundle

When reading a bundle file, commit messages who's oneline format is
longer than 982 characters caused JGit to treat subsequent text in
the commit as a SHA, then throw a TransportException because it's
not a valid SHA.

Now the readLine method will read all the way to the end of the
line, not just the first 1024 characters of it.

Change-Id: If15b491aa9a1e4fd9b8bbed2dd9e6be47a64ccb7
Signed-off-by: Chris Gavin <chris@chrisgavin.me>
8 years agoFix unused throws CorruptObjectException from addTree 99/64899/1
Shawn Pearce [Thu, 21 Jan 2016 06:08:23 +0000 (22:08 -0800)]
Fix unused throws CorruptObjectException from addTree

2262a794b48ea removed throws CorruptObjectException, but was not
compiled under Eclipse and did not see errors generated by Eclipse.
Maven build silently ignored the unnecessary code.

Change-Id: I6e9014adcc604588e10e5963d13d0c6ef0e1c617

8 years agoMerge branch 'master' into stable-4.2 98/64898/1
Matthias Sohn [Thu, 21 Jan 2016 16:03:20 +0000 (17:03 +0100)]
Merge branch 'master' into stable-4.2

Change-Id: Ieec4f51aedadf5734ae0e3f4e8713248a3c4fc52
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agoBundleWriterTest: Open RevWalk in try-with-resource 54/64854/1
David Pursehouse [Thu, 21 Jan 2016 10:13:04 +0000 (19:13 +0900)]
BundleWriterTest: Open RevWalk in try-with-resource

Change-Id: Ie25770a73b19d6522bad9fdc0966f48370f96265
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoDiffFormatterTest: Remove accidentally added trailing whitespace 53/64853/1
David Pursehouse [Thu, 21 Jan 2016 10:12:12 +0000 (19:12 +0900)]
DiffFormatterTest: Remove accidentally added trailing whitespace

Change-Id: Ia7a3b05b79c3a5530a4445e6e48ceae445425224
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoCherryPickCommandTest: Create Git instances in try-with-resource 42/64842/1
David Pursehouse [Thu, 21 Jan 2016 09:07:54 +0000 (18:07 +0900)]
CherryPickCommandTest: Create Git instances in try-with-resource

Change-Id: I9d49258bdf12f3221013c37cfb8a21ea27f28860
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoDiffFormatterTest: Create auto-closeable instances in try-with-resource 40/64840/1
David Pursehouse [Thu, 21 Jan 2016 08:00:15 +0000 (17:00 +0900)]
DiffFormatterTest: Create auto-closeable instances in try-with-resource

Git, ByteArrayOutputStream, and DiffFormatter are auto-closeable and
should be managed in try-with-resource.

Change-Id: I83395116acb4b4f7cd4300fd69564355bc07e4bb
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoConfigTest: Create Git instance in try-with-resource 30/64830/1
David Pursehouse [Thu, 21 Jan 2016 06:31:56 +0000 (15:31 +0900)]
ConfigTest: Create Git instance in try-with-resource

Change-Id: Ie65c69e0f1aed95bcdf68ebd68d21b3e2590b41c
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoCommitAndLogCommandTest: Use assumeFalse to skip test on Windows 29/64829/1
David Pursehouse [Thu, 21 Jan 2016 06:30:23 +0000 (15:30 +0900)]
CommitAndLogCommandTest: Use assumeFalse to skip test on Windows

Use JUnit's assumeFalse method to cause the test to skip when
run on Windows.

Change-Id: I3f59440cfe62c37c127e381052b60471fbe8ec5e
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoCommitAndLogCommandTest: Create Git instances in try-with-resource 28/64828/1
David Pursehouse [Thu, 21 Jan 2016 06:25:46 +0000 (15:25 +0900)]
CommitAndLogCommandTest: Create Git instances in try-with-resource

Change-Id: Id06417f1d3914cd3addacdbe9b5801a06cc3955f
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoAddCommandTest: Create Git instances in try-with-resource 25/64825/1
David Pursehouse [Thu, 21 Jan 2016 01:21:12 +0000 (10:21 +0900)]
AddCommandTest: Create Git instances in try-with-resource

Change-Id: Idf42f03099eeb9975fef9492ea8a75776afc2a3c
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoArchiveCommandTest: Create Git instances in try-with-resource 24/64824/1
David Pursehouse [Thu, 21 Jan 2016 00:45:58 +0000 (09:45 +0900)]
ArchiveCommandTest: Create Git instances in try-with-resource

Change-Id: Icbfd92395db85818736142fd3fb3432385e89ca9
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoMerge "TreeWalk: Remove CorruptObjectException from addTree(AbstractTreeIterator)"
Shawn Pearce [Wed, 20 Jan 2016 16:03:46 +0000 (11:03 -0500)]
Merge "TreeWalk: Remove CorruptObjectException from addTree(AbstractTreeIterator)"

8 years agoTreeWalk: Remove CorruptObjectException from addTree(AbstractTreeIterator) 79/64779/1
Shawn Pearce [Wed, 20 Jan 2016 15:41:08 +0000 (07:41 -0800)]
TreeWalk: Remove CorruptObjectException from addTree(AbstractTreeIterator)

This form of addTree() does not parse any objects and cannot throw the
declared checked exception.  Callers are being forced to try-catch
CorruptObjectException that cannot occur when the iterator instance
has already been constructed.

Change-Id: Id338035302903bab81569d1576eab063eee0885a

8 years agoFix ResetCommand to return the resulting ref 93/59093/2
Christian Halstrick [Wed, 28 Oct 2015 09:36:27 +0000 (10:36 +0100)]
Fix ResetCommand to return the resulting ref

ResetCommand was not returning the updated ref as a result of the call()
method. Since the ResetCommand is always updating the same ref (HEAD)
this should always be the HEAD ref.

Bug: 440750
Change-Id: I7974975c3ab05e68c208384e69cf0692ded6e8db
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agoAdd option to allow empty commits to CommitCommand 65/58165/4
Christian Halstrick [Wed, 14 Oct 2015 14:25:45 +0000 (16:25 +0200)]
Add option to allow empty commits to CommitCommand

CommitCommand should allow to specify whether empty commits (commits
having the same tree as the sole predecessor commit) are allowed or not.
Similar to native git's "--allow-empty" flag.

The defaults differ between JGit and native git even after this change.
When not specifying paths then by default JGit allows to create empty
commits while native git does not. It would be API breaking to change
this now.

Bug: 460301
Change-Id: I88feb0c3ffb2c686b1d0594e669729b065cda4cb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agoTagCommandTest: Instantiate Git and RevWalk objects in try-with-resource 44/64744/1
David Pursehouse [Wed, 20 Jan 2016 09:34:41 +0000 (18:34 +0900)]
TagCommandTest: Instantiate Git and RevWalk objects in try-with-resource

Change-Id: I08959650e2970e964bc864dc6d120d7bddfd8232
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoBlameCommandTest: Instantiate Git objects in try-with-resource 43/64743/1
David Pursehouse [Wed, 20 Jan 2016 09:33:58 +0000 (18:33 +0900)]
BlameCommandTest: Instantiate Git objects in try-with-resource

Change-Id: Icb9e6bb9ee99589fa2e0388c8b305a8a1f5954db
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoSideBandOutputStreamTest: Use try-with-resource 18/64718/1
David Pursehouse [Wed, 20 Jan 2016 02:38:35 +0000 (11:38 +0900)]
SideBandOutputStreamTest: Use try-with-resource

Factor out the creation of the SideBandOutputStream objects into
a utility method that wraps it in a try-with-resource.

Remove the "unused" suppression that is now unnecessary, and add
declaration that the tests methods can throw Exception.

Change-Id: Iff02e4e3532bd6ab6e423f197e70d44c4f328d0b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoFileTreeIteratorJava7Test: Create Git instances in try-with-resource 17/64717/1
David Pursehouse [Wed, 20 Jan 2016 02:22:18 +0000 (11:22 +0900)]
FileTreeIteratorJava7Test: Create Git instances in try-with-resource

Change-Id: I493e90e8a0d96db5acc49759c8e138b0a8c7b099
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoMerge "Remove declared IOException which is no longer thrown"
Matthias Sohn [Wed, 20 Jan 2016 01:05:33 +0000 (20:05 -0500)]
Merge "Remove declared IOException which is no longer thrown"

8 years agoRemove declared IOException which is no longer thrown 12/64712/1
Matthias Sohn [Wed, 20 Jan 2016 00:53:17 +0000 (01:53 +0100)]
Remove declared IOException which is no longer thrown

Since 2ccea7f0 ChangeIdUtil.computeChangeId() doesn't throw IOException
anymore.

Change-Id: I0bf43f2346dadbbfe7e6cbcb38b5525456fbf686
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agoMerge branch 'stable-4.2' 11/64711/1
David Pursehouse [Wed, 20 Jan 2016 00:32:19 +0000 (09:32 +0900)]
Merge branch 'stable-4.2'

* stable-4.2:
  CheckoutCommandTest: Create Git instances in try-with-resource
  BranchCommandTest: Create Git instances in try-with-resource
  CheckoutTest: Create Git instances in try-with-resource
  BranchTest: Create Git instances in try-with-resource
  URIishTest: Use @Test annotation's `expected` argument
  Suppress "The allocated object is never used" warning in tests
  Add $NON-NLS to suppress "Non-externalized string literal" warnings
  Don't use deprecated constructors of CmdLineException
  Prepare 4.2.0-SNAPSHOT builds
  Remove org.eclipse.jgit.updatesite project from tools/version.sh
  RevParse: Remove superfluous semicolon
  RefUpdateTest: Use try-with-resource for auto-closable types
  RefUpdateTest: Add null check to prevent potential NPE
  CommitCommand: Remove redundant null check
  JGit v4.2.0.201512141825-rc1

Change-Id: I2179859289b2f2e3d0b7c6d02ef7e7890c467f7b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoChangeIdUtil: Don't throw IOException 70/64670/4
Dave Borowitz [Tue, 19 Jan 2016 16:13:40 +0000 (11:13 -0500)]
ChangeIdUtil: Don't throw IOException

This could have only happened during the getBytes call. Instead, use
Constants.encode, which is a non-throwing implementation.

This change is binary compatible with existing code compiled against
older versions of JGit, although it might break compilation of
previously compiling code due to dead catch blocks.

Change-Id: I191fec5cac718657407230de141440e86d0151fb

8 years agoMerge "Transport: Implement AutoCloseable"
Shawn Pearce [Tue, 19 Jan 2016 22:36:37 +0000 (17:36 -0500)]
Merge "Transport: Implement AutoCloseable"

8 years agoTransport: Implement AutoCloseable 05/64605/4
Shawn Pearce [Tue, 19 Jan 2016 21:08:38 +0000 (13:08 -0800)]
Transport: Implement AutoCloseable

After creating a Transport instance callers should always call
its close() method. Use AutoCloseable to document this idiom
and allow use of try-with-resources.

Change-Id: I0c6ff3e39ebecdd7a028dbcae1856a818937b186

8 years agoMerge changes from topic 'deadtree'
Shawn Pearce [Tue, 19 Jan 2016 22:08:53 +0000 (17:08 -0500)]
Merge changes from topic 'deadtree'

* changes:
  Ignore API errors about Tree, TreeEntry, FileTreeEntry and friends being removed
  Revert "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends""

8 years agoMerge "ReceiveCommand.abort(): Utility to mark batch of commands as failed"
Shawn Pearce [Tue, 19 Jan 2016 20:54:05 +0000 (15:54 -0500)]
Merge "ReceiveCommand.abort(): Utility to mark batch of commands as failed"

8 years agoIgnore API errors about Tree, TreeEntry, FileTreeEntry and friends being 87/64087/3
Shawn Pearce [Tue, 12 Jan 2016 00:07:24 +0000 (16:07 -0800)]
Ignore API errors about Tree, TreeEntry, FileTreeEntry and friends being
removed

Bug: 486105
Change-Id: I04adcdb68bee7d5f608bb7ab959fe36a890f9ecd

8 years agoRevert "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and 78/64678/3
Andrey Loskutov [Tue, 19 Jan 2016 17:22:36 +0000 (12:22 -0500)]
Revert "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and
friends""

This reverts commit 2cc80187d3633adedc99eb97132e0a749b457c19.

Bug: 486105
Change-Id: Id4f9987c33d66cbed9de6e4d4d6784afdd01a3cf
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
8 years agoCheckoutCommandTest: Create Git instances in try-with-resource 25/64325/2
David Pursehouse [Thu, 14 Jan 2016 08:56:49 +0000 (17:56 +0900)]
CheckoutCommandTest: Create Git instances in try-with-resource

Also rename a local variable in one of the tests that was hiding
a class variable of the same name.

Change-Id: Ia9398157b87a78df6eef0b64a833c16ca2e57ce3
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoBranchCommandTest: Create Git instances in try-with-resource 24/64324/2
David Pursehouse [Thu, 14 Jan 2016 08:53:28 +0000 (17:53 +0900)]
BranchCommandTest: Create Git instances in try-with-resource

Also remove a local variable in one of the tests that was
hiding a member variable with the same name.

Change-Id: Ia4d94cdbf2d83d8be2645f0a93d8891d01606c59
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoCheckoutTest: Create Git instances in try-with-resource 23/64323/2
David Pursehouse [Thu, 14 Jan 2016 08:49:26 +0000 (17:49 +0900)]
CheckoutTest: Create Git instances in try-with-resource

Change-Id: I49a03f7bee0b61c062ce160674f9aa0cd1bcc8ba
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoBranchTest: Create Git instances in try-with-resource 22/64322/2
David Pursehouse [Thu, 14 Jan 2016 08:38:18 +0000 (17:38 +0900)]
BranchTest: Create Git instances in try-with-resource

Change-Id: I8becee479fab91a18e6daffd6f4fd57338c9d120
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoURIishTest: Use @Test annotation's `expected` argument 21/64321/2
David Pursehouse [Thu, 14 Jan 2016 08:25:56 +0000 (17:25 +0900)]
URIishTest: Use @Test annotation's `expected` argument

Specify the expected exception in the annotation, instead of
catching it and calling `fail()` when it wasn't raised.

Change-Id: I8a640c0e42353533e4e73b85b50c224dc060f2d7
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoSuppress "The allocated object is never used" warning in tests 20/64320/2
David Pursehouse [Thu, 14 Jan 2016 08:01:50 +0000 (17:01 +0900)]
Suppress "The allocated object is never used" warning in tests

Change-Id: Ibb405e0b36ce5a2cb30268a7de31ab2bd079ad80
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoAdd $NON-NLS to suppress "Non-externalized string literal" warnings 19/64319/2
David Pursehouse [Thu, 14 Jan 2016 07:37:39 +0000 (16:37 +0900)]
Add $NON-NLS to suppress "Non-externalized string literal" warnings

Change-Id: I3e6f83ad2bc7d493e2c1ab5a8c60affa2b49c386
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoDon't use deprecated constructors of CmdLineException 16/64316/2
David Pursehouse [Thu, 14 Jan 2016 06:25:28 +0000 (15:25 +0900)]
Don't use deprecated constructors of CmdLineException

Change-Id: If01fa896537209821d6a7a262ee978572195a397
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoMerge "Prepare 4.2.0-SNAPSHOT builds" into stable-4.2
Matthias Sohn [Tue, 19 Jan 2016 15:04:05 +0000 (10:04 -0500)]
Merge "Prepare 4.2.0-SNAPSHOT builds" into stable-4.2

8 years agoMerge "Remove org.eclipse.jgit.updatesite project from tools/version.sh" into stable-4.2
Matthias Sohn [Tue, 19 Jan 2016 14:15:58 +0000 (09:15 -0500)]
Merge "Remove org.eclipse.jgit.updatesite project from tools/version.sh" into stable-4.2

8 years agoAnnotated to be removed Tree API with @noreference and @noextend 47/64647/1
Andrey Loskutov [Tue, 19 Jan 2016 13:27:41 +0000 (14:27 +0100)]
Annotated to be removed Tree API with @noreference and @noextend

See https://wiki.eclipse.org/Eclipse/API_Central/API_Removal_Process.

Bug: 486105
Change-Id: I460e43da0d487279608729a2081c614e7065f56f
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
8 years agoPrepare 4.2.0-SNAPSHOT builds 57/64657/1
Matthias Sohn [Tue, 19 Jan 2016 12:10:20 +0000 (13:10 +0100)]
Prepare 4.2.0-SNAPSHOT builds

Change-Id: Ibe38a95bf36db0c0ed948280b28c416943ec0329
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agoRemove org.eclipse.jgit.updatesite project from tools/version.sh 56/64656/1
Matthias Sohn [Tue, 19 Jan 2016 12:07:24 +0000 (13:07 +0100)]
Remove org.eclipse.jgit.updatesite project from tools/version.sh

We don't need to update versions for this project which was removed
a long time ago.

Change-Id: Ie2d030134942add152847581797db3a213ec4c9e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agoReceiveCommand.abort(): Utility to mark batch of commands as failed 04/64604/1
Shawn Pearce [Mon, 18 Jan 2016 18:42:00 +0000 (10:42 -0800)]
ReceiveCommand.abort(): Utility to mark batch of commands as failed

If one or more commands is failing the entire group usually has to
also fail with "transaction aborted". Pull this loop into a helper
so the idiom can be easily reused in several places throughout JGit.

Change-Id: I3b9399b7e26ce2b0dc5f7baa85d585a433b4eaed

8 years agoMerge "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends""
Shawn Pearce [Fri, 15 Jan 2016 15:45:42 +0000 (10:45 -0500)]
Merge "Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends""

8 years agoRevert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends" 78/64478/1
Shawn Pearce [Fri, 15 Jan 2016 15:45:36 +0000 (10:45 -0500)]
Revert "Remove deprecated Tree, TreeEntry, FileTreeEntry and friends"

This reverts commit 0f8743d4d7a4f3af1eccea60d45d51d13f1a2ad4.

JGit is unable to iterate its API.

Change-Id: Ie3d6a28e622a5c0cf54768a2299f1c44c0114c19

8 years agoRevParse: Remove superfluous semicolon 15/64315/1
David Pursehouse [Thu, 14 Jan 2016 06:17:46 +0000 (15:17 +0900)]
RevParse: Remove superfluous semicolon

Change-Id: I5975bc58d7933dafb3e7a8d891e9f6878b98a9a1
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoRefUpdateTest: Use try-with-resource for auto-closable types 14/64314/1
David Pursehouse [Thu, 14 Jan 2016 06:09:20 +0000 (15:09 +0900)]
RefUpdateTest: Use try-with-resource for auto-closable types

Change-Id: I25c8db0e410aa2a4a53dc7d8863e4a6efefcf7cb
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoRefUpdateTest: Add null check to prevent potential NPE 13/64313/1
David Pursehouse [Thu, 14 Jan 2016 06:06:10 +0000 (15:06 +0900)]
RefUpdateTest: Add null check to prevent potential NPE

Change-Id: I64b1850c3bb80b09409044461ca3fdde1c46d4bb
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoCommitCommand: Remove redundant null check 12/64312/1
David Pursehouse [Thu, 14 Jan 2016 05:59:55 +0000 (14:59 +0900)]
CommitCommand: Remove redundant null check

Repository.getWorkTree is annotated as @NonNull, so the check
for it returning null is redundant.

Change-Id: I597b0f774ff857b8900519f14a1a17a904cf7c6f
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
8 years agoMerge "PackWriter: Declare preparePack object sets as @NonNull"
Shawn Pearce [Wed, 13 Jan 2016 00:45:39 +0000 (19:45 -0500)]
Merge "PackWriter: Declare preparePack object sets as @NonNull"

8 years agoPackWriter: Declare preparePack object sets as @NonNull 02/64202/3
Shawn Pearce [Wed, 13 Jan 2016 00:11:36 +0000 (16:11 -0800)]
PackWriter: Declare preparePack object sets as @NonNull

Require callers to pass in valid sets for both want and have
collections. Offer PackWriter.NONE as a handy constant for an
empty collection for the have part of preparePack instead of null.

Change-Id: Ifda4450f5e488cbfefd728382b7d30797e229217

8 years agoMerge "GC: Pack RefTrees in their own pack"
Shawn Pearce [Tue, 12 Jan 2016 23:49:01 +0000 (18:49 -0500)]
Merge "GC: Pack RefTrees in their own pack"

8 years agoGC: Pack RefTrees in their own pack 66/64166/3
Shawn Pearce [Tue, 12 Jan 2016 18:50:36 +0000 (10:50 -0800)]
GC: Pack RefTrees in their own pack

The RefTree graph needs to be quickly accessed to read references.
It is also distinct graph disconnected from the rest of the
repository. Store the commit and tree objects in their own pack.

Change-Id: Icbb735be8fa91ccbf0708ca3a219b364e11a6b83

8 years agoChange to extensions.refsStorage 92/64092/1
Shawn Pearce [Tue, 12 Jan 2016 04:44:10 +0000 (20:44 -0800)]
Change to extensions.refsStorage

git-core just rerolled the extensible backends series with refsStorage
as the configuration key. Update JGit to match git-core.

Change-Id: If345a2403a996e358b29cfa2a2298f6e8d59d96b

8 years agoRefTree: Change peel suffix to " ^" (space carrot) 26/63926/4
Shawn Pearce [Sun, 10 Jan 2016 01:27:25 +0000 (17:27 -0800)]
RefTree: Change peel suffix to " ^" (space carrot)

Using ^{} as the peel suffix has caused problems when projects used
tags like v2.1 and then v2.1.1, v2.2.2, etc.  The peeled value for
v2.1 was stored very far away in the tree relative to v2.1 itself as
^ sorts in the ASCII/UTF-8 encoding after all other common tag
characters like digits and dots.

Use " ^" instead as space is not valid in a reference name, sorts
before all other valid reference characters (thus forcing next entry
locality) and this looks like a peeled marker for the prior tag.

Change-Id: I26d2247a0428dfe26a9c319c02159502b3a67455

8 years agoFileRepository: Support extensions.refsBackendType = RefTree 70/62970/15
Shawn Pearce [Sat, 9 Jan 2016 20:51:14 +0000 (12:51 -0800)]
FileRepository: Support extensions.refsBackendType = RefTree

This experimental code can be enabled in $GIT_DIR/config:

  [core]
    repositoryformatversion = 1

  [extensions]
    refsBackendType = RefTree

When these are set the repository will read references from the
RefTree rooted by the $GIT_DIR/refs/txn/committed reference.

Update debug-rebuild-ref-tree to rebuild refs/txn/committed only from
the bootstrap layer.  This avoids misuse by rebuilding using packed-refs
and $GIT_DIR/refs tree.

Change-Id: Icf600e4a36b2f7867822a7ab1f1617d73c710a4b

8 years agoRefTreeDatabase: Ref database using refs/txn/committed 69/62969/14
Shawn Pearce [Sat, 28 Nov 2015 07:21:43 +0000 (23:21 -0800)]
RefTreeDatabase: Ref database using refs/txn/committed

Instead of storing references in the local filesystem rely on the
RefTree rooted at refs/txn/committed.  This avoids needing to store
references in the packed-refs file by keeping all data rooted under
a single refs/txn/committed ref.

Performance to scan all references from a well packed RefTree is very
close to reading the packed-refs file from local disk.

Storing a packed RefTree is smaller due to pack file compression,
about 49.39 bytes/ref (on average) compared to packed-refs using
~65.49 bytes/ref.

Change-Id: I75caa631162dc127a780095066195cbacc746d49

8 years agoMerge "RevCommit: Better support invalid encoding headers"
Shawn Pearce [Mon, 11 Jan 2016 20:48:14 +0000 (15:48 -0500)]
Merge "RevCommit: Better support invalid encoding headers"

8 years agoRevCommit: Better support invalid encoding headers 73/64073/1
Shawn Pearce [Mon, 11 Jan 2016 20:30:35 +0000 (12:30 -0800)]
RevCommit: Better support invalid encoding headers

With this support we no longer need the 'utf-8' alias. UTF-8 will be
automatically tried when the encoding header is not recognized and used
if the character sequence cleanly decodes as UTF-8.

Modernize some of the references to use StandardCharsets.

Change-Id: I4c0c88750475560e1f2263180c4a98eb8febeca0

8 years agoRemove deprecated Tree, TreeEntry, FileTreeEntry and friends 14/63914/3
Shawn Pearce [Sat, 9 Jan 2016 05:42:07 +0000 (21:42 -0800)]
Remove deprecated Tree, TreeEntry, FileTreeEntry and friends

These types were deprecated in 0.9.1 (aka 384a19eee07a2f).
If anyone is still using them, its time to stop.

Change-Id: I3f73347ba78c639e0c6a504812bc1a0702f829b1

8 years agoPaths.pathCompare: Utility to sort paths from byte[] 13/63913/4
Shawn Pearce [Sat, 9 Jan 2016 01:28:44 +0000 (17:28 -0800)]
Paths.pathCompare: Utility to sort paths from byte[]

Consolidate copies of this function into one location.

Add some unit tests to prevent bugs that were accidentally
introduced while trying to make this refactoring.

Change-Id: I82f64bbb8601ca2d8316ca57ae8119df32bb5c08

8 years agoAdd Paths utility class 12/63912/1
Shawn Pearce [Sat, 9 Jan 2016 00:56:47 +0000 (16:56 -0800)]
Add Paths utility class

Simple container for some path related utility functions.

Change-Id: Ice2bec6ad12b1e2cea15988c01aa9dd4e016a849

8 years agoMerge changes from topic 'reftree'
Shawn Pearce [Fri, 8 Jan 2016 00:21:55 +0000 (19:21 -0500)]
Merge changes from topic 'reftree'

* changes:
  debug-rebuild-ref-tree: Simple program to build a RefTree
  RefTree: Store references in a Git tree

8 years agodebug-rebuild-ref-tree: Simple program to build a RefTree 68/62968/14
Shawn Pearce [Sat, 28 Nov 2015 03:34:36 +0000 (19:34 -0800)]
debug-rebuild-ref-tree: Simple program to build a RefTree

This tool scans all references in the repository and writes out a new
reference pointing to a single commit whose root tree is a RefTree
containing the current refs of this repository.

It alway skips storing the reference it will write to, avoiding the
obvious cycle.

Change-Id: I20b1eeb81c55dc49dd600eac3bf8f90297394113

8 years agoRefTree: Store references in a Git tree 67/62967/13
Shawn Pearce [Wed, 18 Nov 2015 00:22:18 +0000 (16:22 -0800)]
RefTree: Store references in a Git tree

A group of updates can be applied by updating the tree in one step,
writing out a new root tree, and storing its SHA-1. If references
are stored in RefTrees, comparing two repositories is a matter of
checking if two SHA-1s are identical. Without RefTrees comparing two
repositories requires listing all references and comparing the sets.

Track the "refs/" directory as a root tree by storing references
that point directly at an object as a GITLINK entry in the tree.
For example "refs/heads/master" is written as "heads/master".

Annotated tags also store their peeled value with ^{} suffix, using
"tags/v1.0" and "tags/v1.0^{}" GITLINK entries.

Symbolic references are written as SYMLINK entries with the blob of
the symlink carrying the name of the symbolic reference target.

HEAD is outside of "refs/" namespace so it is stored as a special
"..HEAD" entry. This name is chosen because ".." is not valid in
a reference name and it almost looks like "../HEAD" which names
HEAD if the reader was inside of the "refs/" directory.

A new Command type is required to handle symbolic references and
peeled references.

Change-Id: Id47e5d4d32149a9e500854147edd7d93c1041a39

8 years agoMake sure CLIGitCommand and Main produce (almost) same results 30/63430/5
Andrey Loskutov [Sun, 3 Jan 2016 11:29:55 +0000 (12:29 +0100)]
Make sure CLIGitCommand and Main produce (almost) same results

Currently execution of tests in pgm uses CLIGitCommand which
re-implements few things from Main. Unfortunately this can results in a
different test behavior compared to the real CLI runtime.

The change let CLIGitCommand extend Main and only slightly modifies the
runtime (stream redirection and undesired exit() termination).

Change-Id: I87b7b61d1c84a89e5917610d84409f01be90b70b
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
8 years agobranch command: print help if requested, even if arguments are wrong 29/63429/5
Andrey Loskutov [Sun, 3 Jan 2016 15:15:34 +0000 (16:15 +0100)]
branch command: print help if requested, even if arguments are wrong

git branch -d -h reports an error (because of missing -d option value)
but does not print the help as expected.

To fix this, CmdLineParser must catch, print but do not propagate
exceptions if help is requested.

Bug: 484951
Change-Id: I51265ebe295f22da540792c6a1980b8bdb295a02
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
8 years agoAdded CLIText.fatalError(String) API for tests 28/63428/4
Andrey Loskutov [Sun, 3 Jan 2016 14:27:01 +0000 (15:27 +0100)]
Added CLIText.fatalError(String) API for tests

In different places (Main, TextBuiltin, CLIGitCommand) we report fatal
errors and at same time want to check for fatal errors in the tests.
Using common API simplifies the error testing and helps to navigate to
the actual error check implementation.

Change-Id: Iecde79beb33ea595171f168f46b0b10ab2f339bb
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
8 years agoGitServletResponseTest: Fix testObjectCheckerException 64/63664/3
Shawn Pearce [Wed, 6 Jan 2016 18:17:52 +0000 (10:17 -0800)]
GitServletResponseTest: Fix testObjectCheckerException

The recent ObjectChecker changes to pass in AnyObjectId as part
of the checkCommit method signature meant the override here was no
longer throwing an exception as expected.

Change-Id: I0383018b48426e25a0bc562387e8cd73cbe13129

8 years agoMerge "InMemoryRepository: Abort BatchRefUpdate if a command previously failed"
Shawn Pearce [Wed, 6 Jan 2016 20:18:02 +0000 (15:18 -0500)]
Merge "InMemoryRepository: Abort BatchRefUpdate if a command previously failed"

8 years agoInMemoryRepository: Abort BatchRefUpdate if a command previously failed 71/63671/1
Shawn Pearce [Wed, 6 Jan 2016 20:05:46 +0000 (12:05 -0800)]
InMemoryRepository: Abort BatchRefUpdate if a command previously failed

If any command has already been marked as failing, fail the entire batch.

Change-Id: I1692240841aa4f4cb252bdccbc6f11d9246929c1

8 years agoDFS: Allow other RefDatabase implementations 69/63669/1
Shawn Pearce [Wed, 6 Jan 2016 19:54:08 +0000 (11:54 -0800)]
DFS: Allow other RefDatabase implementations

Permit a DfsRepository implementation to use a different RefDatabase
than DfsRefDatabase.

Change-Id: Ia263285f547bde1943993cc994d0222185021a16

8 years agobuck: Make :jgit_src target work in cross-cell environment 43/63443/2
David Ostrovsky [Sun, 3 Jan 2016 23:44:07 +0000 (00:44 +0100)]
buck: Make :jgit_src target work in cross-cell environment

This artifact is used from unzip utility in Gerrit Code Review
build toolchain and thus the file must exist on the file system.
Moreover, trying to use java_binary() didn't work either, as the
zip layout was wrong: all files contained 'org.eclipse.jgit/src/'
prefix.

Change-Id: I00e3269a7a1a6c6d1fe7e60d1bf1c69b8e57d79d
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
8 years agoMerge changes I487a30fb,I82a01b5f
Shawn Pearce [Sun, 3 Jan 2016 23:24:33 +0000 (18:24 -0500)]
Merge changes I487a30fb,I82a01b5f

* changes:
  Ensure all http tests are run and fix broken tests
  buck: run http tests

8 years agoMerge "buck: set Bundle-Version for :jgit_bin"
Shawn Pearce [Sun, 3 Jan 2016 18:22:57 +0000 (13:22 -0500)]
Merge "buck: set Bundle-Version for :jgit_bin"

8 years agobuck: set Bundle-Version for :jgit_bin 32/63432/1
Shawn Pearce [Sun, 3 Jan 2016 17:30:16 +0000 (09:30 -0800)]
buck: set Bundle-Version for :jgit_bin

Run git describe during the build to determine the lineage of this
working directory and stamp this information into the binary.

Change-Id: I0ad24125c31e4280ccf900bac4065924087b05aa

8 years agoMerge changes Idaed9310,I62bd7c0b
Matthias Sohn [Sun, 3 Jan 2016 15:27:36 +0000 (10:27 -0500)]
Merge changes Idaed9310,I62bd7c0b

* changes:
  ObjectChecker: honor some git-core fsck.* options
  ObjectChecker: allow some objects to skip errors

8 years agobranch command: provide convenient and meaningful options help 32/63332/6
Andrey Loskutov [Mon, 28 Dec 2015 14:47:36 +0000 (15:47 +0100)]
branch command: provide convenient and meaningful options help

Added tests for all options, fixed multi-valued options parsing.

Bug: 484951
Change-Id: I5558589049544ea6c84932bc01f1f9df09e1f682
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
8 years agoSimplify pgm tests: allow varargs and trim output for toString() 15/63415/1
Andrey Loskutov [Sat, 2 Jan 2016 12:24:02 +0000 (13:24 +0100)]
Simplify pgm tests: allow varargs and trim output for toString()

Change-Id: Ia5bcd9e560b90cf872fef75c2800c889ef1cc85a
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
8 years agoFixed few locale dependent pgm tests 14/63414/1
Andrey Loskutov [Sat, 2 Jan 2016 16:32:11 +0000 (17:32 +0100)]
Fixed few locale dependent pgm tests

See https://dev.eclipse.org/mhonarc/lists/jgit-dev/msg03040.html

Change-Id: If51f3c750684d82cb6443f1578636c9f5ca56e2b
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
8 years agoEnsure all http tests are run and fix broken tests 09/63409/1
Matthias Sohn [Sat, 2 Jan 2016 01:09:16 +0000 (02:09 +0100)]
Ensure all http tests are run and fix broken tests

HttpClientTests were broken. This wasn't discovered since
maven-surefire-plugin's by default only executes test classes
matching **/*Test.java. Fix this by also including **/*.Tests.java
and fix the failing tests.

Change-Id: I487a30fb333de993a9f8d8fff491d3b0e7fb02cc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agobuck: run http tests 08/63408/1
Matthias Sohn [Fri, 1 Jan 2016 22:54:15 +0000 (23:54 +0100)]
buck: run http tests

Running tests using buck reveals that HttpClientTests are broken
and weren't executed by Maven since these test classes don't match the
maven-surefire-plugin's default for test classes **/*Test.java.
Will be fixed in a follow-up change.

Change-Id: I82a01b5fd3f0a930bec2423a29a256601dadc248
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
8 years agobuck: set vm_args for tests 07/63407/1
Shawn Pearce [Fri, 1 Jan 2016 19:04:11 +0000 (11:04 -0800)]
buck: set vm_args for tests

Maven pom files force the local encoding to UTF-8 to ensure there are
no differences between machines.  They also set the JVM max heap to
256m. Match both in Buck so that results are consistent.

Change-Id: Ice5476dd09352a444a0c97aa0dc28806fddf2ab4

8 years agobuck: pin to stable version 06/63406/1
Shawn Pearce [Fri, 1 Jan 2016 04:07:03 +0000 (20:07 -0800)]
buck: pin to stable version

Like with Gerrit, pin JGit to a single version of Buck that is known
to work with current Buck files and JUnit tests. Notably a more recent
version of Buck used by Gerrit (01a0c54d827) fails WalkEncryptionTest.

Change-Id: I6b94c332e4bde97a1910f48cf12eb8698f97d540

8 years agoMerge changes from topic 'add-df'
Shawn Pearce [Fri, 1 Jan 2016 17:58:34 +0000 (12:58 -0500)]
Merge changes from topic 'add-df'

* changes:
  DirCache: Do not create duplicate tree entries
  DirCacheEditor: Replace file-with-tree and tree-with-file
  AddCommand: Use NameConflictTreeWalk to identify file-dir changes

8 years agoFix "remote: Counting objects: ..." formatting 03/63403/2
Shawn Pearce [Fri, 1 Jan 2016 00:12:51 +0000 (16:12 -0800)]
Fix "remote: Counting objects: ..." formatting

Trailing whitespace is usually removed in properties files so
JGitText did not supply a space between : and the remote message.
Ensure the space exists at runtime by reading the localized string
and appending a space if it is missing.

Messages should be dynamically fetched and not held in a static
class variable, as they can be changed using thread locals.

Change-Id: If6a3707d64094253b1a5304fbfafcf195db7497a

8 years agoclone: display progress messages 02/63402/2
Shawn Pearce [Fri, 1 Jan 2016 00:03:13 +0000 (16:03 -0800)]
clone: display progress messages

Also support -q/--quiet flag to disable progress.

Change-Id: I979277502c990f6dec052d095461c996ff8fe577

8 years agobuck: run tests 01/63401/3
Shawn Pearce [Thu, 31 Dec 2015 18:44:30 +0000 (10:44 -0800)]
buck: run tests

Compile each test in its own java_test() target so they can run in
parallel, reducing total time spent testing on large machines.

$ buck test --all
[-] PROCESSING BUCK FILES...FINISHED 0.3s [100%]
[-] BUILDING...FINISHED 2.9s [100%] (351/383 JOBS, 351 UPDATED, 0.0% CACHE MISS)
[-] TESTING...FINISHED 98.1s (3360 PASS/15 SKIP/0 FAIL)

Change-Id: I8d6541268315089299f933ed23d785b1b3431133

8 years agobuck: build standalone jgit binary 00/63400/2
Shawn Pearce [Thu, 31 Dec 2015 19:18:02 +0000 (11:18 -0800)]
buck: build standalone jgit binary

Construct the java_application JAR wrapped with the shell script
header.  This is enough to clone a repository over HTTPs:

  $ buck build :jgit_bin
  $ buck-out/gen/jgit_bin/jgit_bin clone https://...

Change-Id: I4aceb4e77b2ec9be76a32ec93d94f2dafe9acce6

8 years agoImplement Buck driven build 38/61938/3
David Ostrovsky [Fri, 4 Dec 2015 07:27:57 +0000 (08:27 +0100)]
Implement Buck driven build

Today there are plenty of modern build tool systems available in the
wild (in no particular order):

* http://bazel.io
* https://pantsbuild.github.io
* http://shakebuild.com
* https://ninja-build.org
* https://buckbuild.com

The attributes, that all these build tools have in common, are:

* reliable
* correct
* very fast
* reproducible

It must not always be the other build tool, this project is currently
using. Or, quoting Gerrit Code Review maintainer here:

  "Friends, don't let friends use <the other build tool system>!"

This change is non-complete implementation of JGit build in Buck,
needed by Gerrit Code Review to replace its dependency with standlone
JGit cell. This is very useful when a developer is working on both
projects and is trying to integrate changes made in JGit in Gerrit.

The supported workflow is:

  $ cd jgit
  $ emacs <hack>
  $ cd ../gerrit
  $ buck build --config repositories.jgit=../jgit gerrit

With --config repositories.jgit=../jgit jgit cell is routed through
JGit development tree.

To build jgit, issue:

  $ buck build //:jgit
  [-] PROCESSING BUCK FILES...FINISHED 0,0s

Yes, you can't measure no-op build time, given that Buck daemon is
used.

Change-Id: I301a71b19fba35a5093d8cc64d4ba970c2877a44
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
8 years agoMerge "Fix encoding problem from curl repostory on github"
Shawn Pearce [Thu, 31 Dec 2015 04:47:27 +0000 (23:47 -0500)]
Merge "Fix encoding problem from curl repostory on github"

8 years agoMerge "Fix hanging fetch via SSH"
Shawn Pearce [Thu, 31 Dec 2015 04:27:09 +0000 (23:27 -0500)]
Merge "Fix hanging fetch via SSH"

8 years agoFix encoding problem from curl repostory on github 61/50361/2
Eryk Szymanski [Wed, 17 Jun 2015 15:17:17 +0000 (17:17 +0200)]
Fix encoding problem from curl repostory on github

Pushing curl repository to gerrit fails with a message:
remote: error: internal error while processing changes
java.nio.charset.IllegalCharsetNameException: 'utf8'

curl repository url: https://github.com/bagder/curl.git

To avoid this problem encodingAliases in RawParseUtils have
been extended to contain "'utf8'" (single quoted utf8) string.

Change-Id: I40f613cfdcabf0dc9455bee45116ab8d8c7dd6ee
Signed-off-by: Eryk Szymanski <eryksz@gmail.com>
8 years agoMake sure tests don't blindly continue if a command is "silently" failed 89/63389/1
Andrey Loskutov [Wed, 30 Dec 2015 23:48:07 +0000 (00:48 +0100)]
Make sure tests don't blindly continue if a command is "silently" failed

Make the default execute() function fail fast on first command printed
"fatal: " to output.

Introduced executeUnchecked() for few tests which wanted to test fatal
output.

Change-Id: I5b09aad9443515636811fc4d00bf8b8b9587a626
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
8 years agoObjectChecker: honor some git-core fsck.* options 71/63371/4
Shawn Pearce [Wed, 30 Dec 2015 02:21:19 +0000 (18:21 -0800)]
ObjectChecker: honor some git-core fsck.* options

Accept some of the same section keys that fsck does in git-core,
allowing repositories to skip over specific kinds of acceptable
broken objects, e.g.:

  [fsck]
    duplicateEntries = ignore
    zeroPaddedFilemode = ignore

The zeroPaddedFilemode = ignore is a synonym for the JGit specific
allowLeadingZeroFileMode = true. Only accept the JGit key if git-core
key was not specified.

Change-Id: Idaed9310e2a5ce5511670ead1aaea2b30aac903c

8 years agoObjectChecker: allow some objects to skip errors 63/63363/4
Shawn Pearce [Tue, 29 Dec 2015 23:52:16 +0000 (15:52 -0800)]
ObjectChecker: allow some objects to skip errors

Some ancient objects may be broken, but in a relatively harmless way.
Allow the ObjectChecker caller to whitelist specific objects that are
going to fail checks, but that have been reviewed by a human and decided
the objects are OK enough to permit continued use of.

This avoids needing to rewrite history to scrub the broken objects out.

Honor the git-core fsck.skipList configuration setting when receiving a
push or fetching from a remote repository.

Change-Id: I62bd7c0b0848981f73dd7c752860fd02794233a6