]> source.dussan.org Git - jgit.git/log
jgit.git
7 years agoOnly throw MissingObjectException when necessary 09/94109/5
Zhen Chen [Thu, 30 Mar 2017 05:47:23 +0000 (22:47 -0700)]
Only throw MissingObjectException when necessary

When preparing the bitmap, the flag ignoreMissingStart only applied to
the start object. However, sometime the start object is present but some
related objects are not present during the walk, we should only release
the MissingObjectException when the ignoreMissingStart is set false.

Change-Id: I1097a2defa4a9dcf502ca8baca5d32880378818f
Signed-off-by: Zhen Chen <czhen@google.com>
7 years agoDocument the intended use of RepoCommand#setURI() 47/94047/3
Han-Wen Nienhuys [Wed, 29 Mar 2017 11:51:57 +0000 (13:51 +0200)]
Document the intended use of RepoCommand#setURI()

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I4a59dd8278b7b0026094692127b7f55e89c10bae

7 years agoNoop changes to ManifestParser 71/93971/3
Han-Wen Nienhuys [Tue, 7 Mar 2017 18:14:27 +0000 (19:14 +0100)]
Noop changes to ManifestParser

* Parse the base URL in ManifestParser construction.  This will signal
  errors earlier.

* Simplify stripping of trailing slashes.

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I4a86f68c9d7737f71cf20352cfe26288fbd2b463

7 years agoConsistently use 'path' for the path to a subrepo in RepoCommand 56/93756/5
Han-Wen Nienhuys [Thu, 23 Mar 2017 17:20:08 +0000 (18:20 +0100)]
Consistently use 'path' for the path to a subrepo in RepoCommand

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I79ea7eb7b4d319e0100e3121aca5ef82eb8ad92a

7 years agoMerge branch 'stable-4.6' 73/93873/2
Matthias Sohn [Mon, 27 Mar 2017 08:52:36 +0000 (10:52 +0200)]
Merge branch 'stable-4.6'

* stable-4.6:
  Only mark packfile invalid if exception signals permanent problem
  Don't flag a packfile invalid if opening existing file failed
  Prepare 4.5.2-SNAPSHOT builds

Change-Id: Ife4efad1135d3870a5a0fb71e60b9524fb8777ab
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'stable-4.5' into stable-4.6 62/93862/1
David Pursehouse [Mon, 27 Mar 2017 01:14:50 +0000 (10:14 +0900)]
Merge branch 'stable-4.5' into stable-4.6

* stable-4.5:
  Only mark packfile invalid if exception signals permanent problem
  Don't flag a packfile invalid if opening existing file failed
  Prepare 4.5.2-SNAPSHOT builds

Change-Id: I20b50981adc54c426666015ff04fe3bb1db9abd9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoOnly mark packfile invalid if exception signals permanent problem 44/93844/5
Matthias Sohn [Sat, 25 Mar 2017 01:33:06 +0000 (02:33 +0100)]
Only mark packfile invalid if exception signals permanent problem

Add NoPackSignatureException and UnsupportedPackVersionException to
explicitly mark permanent unrecoverable problems with a pack

Assume problem with a pack is permanent only if we are sure the
exception signals a non-transient problem we can't recover from:
- AccessDeniedException: we lack permissions
- CorruptObjectException: we detected corruption
- EOFException: file ended unexpectedly
- NoPackSignatureException: pack has no pack signature
- NoSuchFileException: file has gone missing
- PackMismatchException: pack no longer matches its index
- UnpackException: unpacking failed
- UnsupportedPackIndexVersionException: unsupported pack index version
- UnsupportedPackVersionException: unsupported pack version

Do not attempt to handle Errors since they are thrown for serious
problems applications should not try to recover from.

Change-Id: I2c416ce2b0e23255c4fb03a3f9a0ee237f7a484a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoRaise minimum version of o.e.jetty.security to 9.4.0 56/93856/1
Matthias Sohn [Sat, 25 Mar 2017 22:34:24 +0000 (23:34 +0100)]
Raise minimum version of o.e.jetty.security to 9.4.0

This is required since we now use AbstractLoginService which was
introduced in Jetty 9.4.0.

Change-Id: Iee6e4ae456123099f7a99cc53c5ae02fd43bfa46
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoDon't flag a packfile invalid if opening existing file failed 75/93775/4
Luca Milanesio [Fri, 24 Mar 2017 00:18:12 +0000 (00:18 +0000)]
Don't flag a packfile invalid if opening existing file failed

A packfile random file open operation may fail with a
FileNotFoundException even if the file exists, possibly
for the temporary lack of resources.

Instead of managing the FileNotFoundException as any generic
IOException it is best to rethrow the exception but prevent
the packfile for being flagged as invalid until it is actually
opened and read successfully or unsuccessfully.

Bug: 514170
Change-Id: Ie37edba2df77052bceafc0b314fd1d487544bf35
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoPrepare 4.5.2-SNAPSHOT builds 43/93843/1
Matthias Sohn [Sat, 25 Mar 2017 00:21:58 +0000 (01:21 +0100)]
Prepare 4.5.2-SNAPSHOT builds

Change-Id: I8485de1f3f63dc9ec445b8fb08093ca144aedc59
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoUpgrade error_prone_core to 2.0.19 80/93780/1
David Pursehouse [Fri, 24 Mar 2017 06:21:18 +0000 (15:21 +0900)]
Upgrade error_prone_core to 2.0.19

Change-Id: I019f6e8ce4b074697c2dfc6020b10dc003d0804d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoPullCommand: Add support for recursing into submodules 41/91241/9
David Pursehouse [Thu, 16 Feb 2017 05:18:04 +0000 (14:18 +0900)]
PullCommand: Add support for recursing into submodules

Add a new API method to set the recurse mode, and pass the mode into
the fetch command.

Extend the existing FetchCommandRecurseSubmodulesTest to also perform
the same tests for fetch. Rename the test class accordingly.

Change-Id: I12553af47774b4778f7011e1018bd575a7909bd0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agobazel: Consume hamcrest through transitive dependency 68/93668/2
David Ostrovsky [Thu, 23 Mar 2017 05:44:51 +0000 (06:44 +0100)]
bazel: Consume hamcrest through transitive dependency

In I3ab958ce8 explicit dependency in lib/BUILD were defined and most
of the bazel build implementation was switched to using it. Switch
test.bzl test implementation to using explicit dependencies as well.

Change-Id: I4413d1a45addeeb2a980d07669fa034c2eebb3a4
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
7 years agoExplain in error message how to recover from lock failure 52/93452/3
Matthias Sohn [Mon, 20 Mar 2017 19:48:49 +0000 (20:48 +0100)]
Explain in error message how to recover from lock failure

Bug: 483897
Change-Id: I70f8d9c82c1efe2928f072a2fb69461160f7c5f7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoUpdate orbit to S20170306214312 (Oxygen M6) 56/93656/1
Matthias Sohn [Wed, 22 Mar 2017 17:35:49 +0000 (18:35 +0100)]
Update orbit to S20170306214312 (Oxygen M6)

Change-Id: I44d2483c045c126e01751fed9365d4889a30ab2e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge "Update Jetty to 9.4.3.v20170317"
Matthias Sohn [Wed, 22 Mar 2017 19:57:49 +0000 (15:57 -0400)]
Merge "Update Jetty to 9.4.3.v20170317"

7 years agoUpdate Jetty to 9.4.3.v20170317 34/93634/1
Matthias Sohn [Wed, 22 Mar 2017 16:48:23 +0000 (17:48 +0100)]
Update Jetty to 9.4.3.v20170317

Change-Id: I900c74bb76b6cfaee838e6f79d80c9b2840806df
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'stable-4.6' 88/93588/1
David Pursehouse [Wed, 22 Mar 2017 01:25:46 +0000 (10:25 +0900)]
Merge branch 'stable-4.6'

* stable-4.6:
  JGit v4.5.1.201703201650-r

Change-Id: I16cac951cdafbe22afe597198fe3b86ecc2437e8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoMerge branch 'stable-4.5' into stable-4.6 87/93587/1
David Pursehouse [Wed, 22 Mar 2017 00:44:42 +0000 (09:44 +0900)]
Merge branch 'stable-4.5' into stable-4.6

* stable-4.5:
  JGit v4.5.1.201703201650-r

Change-Id: Ic9dda2317456308c222928cb8453cb00a231eea1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoRemove Buck build 98/90698/6
David Pursehouse [Thu, 9 Feb 2017 06:13:01 +0000 (15:13 +0900)]
Remove Buck build

Buck will be replaced with Bazel

Change-Id: I3cf07d7aaaa2a58bac34e16c50af5416693254ac
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoAdd remaining parts of the bazel build 46/93346/10
David Ostrovsky [Sat, 18 Mar 2017 15:13:26 +0000 (16:13 +0100)]
Add remaining parts of the bazel build

Add bazel build for ui and junit.http, and the test packages.

A number of different test labels are supported:

  api
  attributes
  dfs
  diff
  http
  lfs
  lfs-server
  nls
  notes
  pack
  patch
  pgm
  reftree
  revplot
  revwalk
  storage
  submodule
  symlinks
  transport
  treewalk
  util

To run all tests:

  bazel test //...

To run specific tests, using labels:

  bazel test --test_tag_filters=api,dfs,revplot,treewalk //...

Change-Id: Ic41b05a79d855212e67b1b4707e9c6b4dc9ea70d
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
Signed-off-by: Jonathan Nieder <jrn@google.com>
7 years agoDelegate crypto algorithm creation to InsecureCipherFactory 74/93474/2
David Ostrovsky [Tue, 21 Mar 2017 05:49:49 +0000 (06:49 +0100)]
Delegate crypto algorithm creation to InsecureCipherFactory

This is a preparation change to Bazel build implementation. Error
Prone rejects the code with variable crypto algorithm as insecure
see: [1].

[1] http://errorprone.info/bugpattern/InsecureCryptoUsage

Change-Id: I92db70a7da454bc364597a995e8be5dccc2d6427
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
7 years agoJGit v4.5.1.201703201650-r 58/93458/1 v4.5.1.201703201650-r
Matthias Sohn [Mon, 20 Mar 2017 20:44:47 +0000 (21:44 +0100)]
JGit v4.5.1.201703201650-r

Change-Id: I88de7c9f52abbc4921a82208ed74d22aa19fb3cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agobazel: Mark junit targets testonly 94/93394/2
Jonathan Nieder [Mon, 20 Mar 2017 01:52:55 +0000 (18:52 -0700)]
bazel: Mark junit targets testonly

Only testonly targets (such as tests) need to use junit.

In particular this involves making the toplevel :all rule testonly.
It's not clear to me what that rule is for --- "bazel build //..."
already works to build all targets.  In any case it appears to be for
testing, so marking it as testonly shouldn't be harmful.

Change-Id: I28ff508ab8ce2ec0a0111109110aa9680d30600e

7 years agobazel: Add explicit targets for library dependencies 93/93393/4
Jonathan Nieder [Mon, 20 Mar 2017 00:41:26 +0000 (17:41 -0700)]
bazel: Add explicit targets for library dependencies

This provides a place to declare visibility restrictions and
transitive dependencies for each library.

Other targets should only declare dependencies on what they directly
use, making dependencies easier to maintain.

Trim the dependencies of org.eclipse.jgit:jgit to follow that rule.
It declares dependencies on Apache httpcomponents and the servlet
API but doesn't use them.

Tested:
* 'bazel build //...' succeeds
* applying the change https://gerrit-review.googlesource.com/90843
  to a copy of Gerrit, following the instructions there, and running
  'bazel test //...' in that copy of Gerrit still succeeds

Change-Id: I3ab958ce8b3227019cdbe4cc81e0f042e1541034

7 years agoFix test configuration to run RacyGitTests, and fix testRacyGitDetection 53/93353/4
David Pursehouse [Sun, 19 Mar 2017 01:23:29 +0000 (10:23 +0900)]
Fix test configuration to run RacyGitTests, and fix testRacyGitDetection

With the filename suffix "Tests", the module was not included in tests
when building with Maven, and without the @Test annotations the tests
didn't get executed under Eclipse or buck test.

testRacyGitDetection was failing because the index file did not exist.

Add the missing configuration, the missing annotations, and add a call
to reset() in testRacyGitDetection to force creation of the index file.

Change-Id: I29dd8f89c36fef4ab40bedce7f4a26bd9b2390e4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoLongObjectIdTest: Remove self comparison test 45/93345/1
David Ostrovsky [Sat, 18 Mar 2017 15:20:40 +0000 (16:20 +0100)]
LongObjectIdTest: Remove self comparison test

This fixes test flagged by error prone:

LongObjectIdTest.java:294: error: [SelfComparison] An object is
compared to itself

assertEquals(0, id1.compareTo(id1));

Change-Id: Ife339c92b9570db2471a2fc029b3bfa114044790
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
7 years agoRevFlagSetTest: Fix compilation error flagged by error prone 44/93344/1
David Ostrovsky [Sat, 18 Mar 2017 10:29:26 +0000 (11:29 +0100)]
RevFlagSetTest: Fix compilation error flagged by error prone

This fixes error flagged by error prone:

Java compilation in rule '//org.eclipse.jgit.test:jgit' failed: Worker
process sent response with exit code: 1.
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevFlagSetTest.java:149:
error: [CollectionIncompatibleType] Argument '"bob"' should not be
passed to this method; its type String is not compatible with its
collection's type argument RevFlag
assertFalse(set.contains("bob"));

Change-Id: I4a971ce92fee55e28b2ab0c7b716ac20fa9c6709
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
7 years agoMove SHA1 compress/recompress files to resource folder 43/93343/1
David Ostrovsky [Sat, 18 Mar 2017 09:41:29 +0000 (10:41 +0100)]
Move SHA1 compress/recompress files to resource folder

This fixes Bazel build:

in srcs attribute of java_library rule //org.eclipse.jgit:jgit:
file '//org.eclipse.jgit:src/org/eclipse/jgit/util/sha1/SHA1.recompress'
is misplaced here (expected .java, .srcjar or .properties).

Another option that was considered is to exclude the non source files.

Change-Id: I7083f27a4a49bf6681c85c7cf7b08a83c9a70c77
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
7 years agoMerge "Merge branch 'stable-4.6'"
Matthias Sohn [Wed, 15 Mar 2017 23:50:03 +0000 (19:50 -0400)]
Merge "Merge branch 'stable-4.6'"

7 years agoMerge branch 'stable-4.6' 66/93166/2
Matthias Sohn [Wed, 15 Mar 2017 23:29:43 +0000 (00:29 +0100)]
Merge branch 'stable-4.6'

* stable-4.6:
  Don't remove pack when FileNotFoundException is transient

Change-Id: I82941a98385cda27c89e1e6750b7b6db4e39f414
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'stable-4.5' into stable-4.6 64/93164/2
Matthias Sohn [Wed, 15 Mar 2017 23:12:49 +0000 (00:12 +0100)]
Merge branch 'stable-4.5' into stable-4.6

* stable-4.5:
  Don't remove pack when FileNotFoundException is transient

Change-Id: Ic17c542d78a4cad48ff1ed77dcdc853a4ef2dc06
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoDon't remove pack when FileNotFoundException is transient 64/92864/4
Luca Milanesio [Fri, 10 Mar 2017 00:20:23 +0000 (00:20 +0000)]
Don't remove pack when FileNotFoundException is transient

The FileNotFoundException is typically raised in three conditions:
1. file doesn't exist
2. incompatible read vs. read/write open modes
3. filesystem locking
4. temporary lack of resources (e.g. too many open files)

1. is already managed, 2. would never happen as packs are not
overwritten while with 3. and 4. it is worth logging the exception and
retrying to read the pack again.

Log transient errors using an exponential backoff strategy to avoid
flooding the logs with the same error if consecutive retries to access
the pack fail repeatedly.

Bug: 513435
Change-Id: I03c6f6891de3c343d3d517092eaa75dba282c0cd
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoDon't try to strip new line if the message buffer is empty 54/93154/1
Andrey Loskutov [Wed, 15 Mar 2017 19:29:21 +0000 (20:29 +0100)]
Don't try to strip new line if the message buffer is empty

Bug: 513726
Change-Id: I0e7c19f8883b93bad1b9de166f671d28f3e9c240
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
7 years agoUpgrade error_prone_core to 2.0.18 14/91514/2
David Pursehouse [Tue, 21 Feb 2017 01:38:09 +0000 (10:38 +0900)]
Upgrade error_prone_core to 2.0.18

Change-Id: I155a7ff1e2488c2184506e77d1a01fda06fb4d57
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoFetchCommand: Fix detection of submodule recursion mode 70/92670/3
David Pursehouse [Thu, 9 Mar 2017 05:04:09 +0000 (14:04 +0900)]
FetchCommand: Fix detection of submodule recursion mode

The submodule.name.fetchRecurseSubmodules value was being read from the
configuration of the submodule, but it should be read from the config
of the parent repository.

Also, the fetch.recurseSubmodules value from the parent repository's
configuration was not being considered at all.

Fix both of these and add tests. Now the precedence of the recurse mode
is determined as follows:

 1. Value passed to the API
 2. Value configured in submodule.name.fetchRecurseSubmodules
 3. Value configured in fetch.recurseSubmodules
 4. Default to "on demand"

Change-Id: Ic23b7c40b5f39135fb3fd754c597dd4bcc94240c

7 years agoSilence API error reported in LfsProtocolServlet 27/92727/2
Matthias Sohn [Thu, 9 Mar 2017 19:41:02 +0000 (20:41 +0100)]
Silence API error reported in LfsProtocolServlet

Breaking API for API implementors (not clients) in a minor release is ok
following OSGi semantic versioning rules.

Change-Id: I14bb4a3084b237b4cd893a130e148148cd1e5df9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoUpdate JGit version used to detect API changes to 4.6.0 25/92725/1
Matthias Sohn [Thu, 9 Mar 2017 19:35:04 +0000 (20:35 +0100)]
Update JGit version used to detect API changes to 4.6.0

We detect API changes during the Maven build using japicmp. Update the
reference version to the latest minor version 4.6.0.

Change-Id: I70f65f4a0680671612f21ee1afac7f7ef0152cbb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoUpdate jsch version used in pom.xml to 0.1.54 85/92685/1
Matthias Sohn [Thu, 9 Mar 2017 11:39:43 +0000 (12:39 +0100)]
Update jsch version used in pom.xml to 0.1.54

We updated the version we use for packaging the p2 repository in
efbecb97 but missed to update the version we compile against in the
Maven build.

Bug: 513354
Change-Id: I49afd89b43cfd8735568a86ef273723909d694a3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoLfsProtocolServlet: Pass HTTP Authorization header to getLargeFileRepository 72/91772/6
David Pursehouse [Fri, 24 Feb 2017 10:26:19 +0000 (19:26 +0900)]
LfsProtocolServlet: Pass HTTP Authorization header to getLargeFileRepository

This allows implementations to reject operations that do not
include proper authentication.

Change-Id: If301476d8fb56a0899e424be3789c7576097d185
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoMerge branch 'stable-4.6' 74/92574/1
David Pursehouse [Tue, 7 Mar 2017 23:53:22 +0000 (08:53 +0900)]
Merge branch 'stable-4.6'

* stable-4.6:
  Prepare 4.6.2-SNAPSHOT builds
  JGit v4.6.1.201703071140-r

Change-Id: Idb3088ab6e64fb49f817b95bc0fef0a9efb77374
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoPrepare 4.6.2-SNAPSHOT builds 53/92553/1
Matthias Sohn [Tue, 7 Mar 2017 19:49:24 +0000 (20:49 +0100)]
Prepare 4.6.2-SNAPSHOT builds

Change-Id: I8835f79145e6a989787d47322c3d8cb9baf0624a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoJGit v4.6.1.201703071140-r 35/92535/1 v4.6.1.201703071140-r
Matthias Sohn [Tue, 7 Mar 2017 16:40:32 +0000 (17:40 +0100)]
JGit v4.6.1.201703071140-r

Change-Id: I842dc95313e5b47b0b7ec983c4a0a91915ed4183
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'stable-4.6' 47/92447/1
David Pursehouse [Tue, 7 Mar 2017 01:32:59 +0000 (10:32 +0900)]
Merge branch 'stable-4.6'

* stable-4.6:
  Update Jetty to 9.4.1.v20170120 in buck build
  Update Jetty to 9.4.1.v20170120
  Update build to use Tycho 1.0.0
  Update minimum JDK version in README

Change-Id: I735697c112094e883986ce13026d967291d88494
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoUpdate Jetty to 9.4.1.v20170120 in buck build 32/92432/1
Jonathan Nieder [Sun, 26 Feb 2017 23:09:04 +0000 (15:09 -0800)]
Update Jetty to 9.4.1.v20170120 in buck build

5e8e2179b218ede7d14b69dc5149b0691b5859cf (Update Jetty to
9.4.1.v201470120, 2017-01-26) updated Jetty in the maven build.
Update the buck build to match so buck builds work again.

The buck build will go away soon, but in the meantime (until the bazel
build gets the same level of support) it is convenient as a faster way
of running tests than using maven.

The bazel build doesn't need this change since it doesn't build or run
http tests yet.

Change-Id: Ibbdaf2880e76b32fc9f6b5605a2ff29e3deffda2
(cherry picked from commit 2470f01d0f8bca4c8c754475846c83b9f99c93b8)

7 years agoUpdate Jetty to 9.4.1.v20170120 31/92431/1
Matthias Sohn [Thu, 26 Jan 2017 00:03:16 +0000 (01:03 +0100)]
Update Jetty to 9.4.1.v20170120

MappedLoginService is no longer available in Jetty 9.4 therefore base
TestLoginService on AbstractLoginService.

Apparently Jetty now uses slf4j hence adapt RecordingLogger accordingly
so we can log error messages containing slf4j style formatting anchors
"{}".

Change-Id: Ibb36aba8782882936849b6102001a88b699bb65c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 5e8e2179b218ede7d14b69dc5149b0691b5859cf)

7 years agoUpdate build to use Tycho 1.0.0 30/92430/1
Matthias Sohn [Wed, 15 Feb 2017 22:44:12 +0000 (23:44 +0100)]
Update build to use Tycho 1.0.0

Change-Id: I10f61962e1496f079a39e0f533506816be56e925
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 92d8c9bec2bd990cec937b3a6c5f4ab4011d3f73)

7 years agoUpdate minimum JDK version in README 29/92429/1
David Pursehouse [Fri, 10 Feb 2017 06:58:26 +0000 (15:58 +0900)]
Update minimum JDK version in README

Change-Id: I655d896b268e946e3492661b08add0ebac22c6f0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
(cherry picked from commit 67da5635a47ad7680b3c60358a1fec080eef7d1e)

7 years agoFetchCommand: Add basic support for recursing into submodules 55/81855/17
David Pursehouse [Mon, 13 Feb 2017 12:37:30 +0000 (21:37 +0900)]
FetchCommand: Add basic support for recursing into submodules

Extend FetchCommand to expose a new method, setRecurseSubmodules(mode),
which allows to set the mode to ON, OFF or ON_DEMAND.

After fetching a repository, its submodules are recursively fetched:

- When the mode is YES, submodules are always fetched.

- When the mode is NO, submodules are not fetched.

- When the mode is ON_DEMAND, submodules are only fetched when the
  parent repository receives an update of the submodule and the new
  revision is not already in the submodule.

The mode is determined in the following order of precedence:

- Value specified in the API call using setRecurseSubmodules.

- Value specified in the repository's config under the key
  submodule.name.fetchRecurseSubmodules

- Defaults to ON_DEMAND if neither of the previous is set.

Extend FetchResult to recursively include results for submodules, as
a map of the submodule path to an instance of FetchResult.

Test setup is based on testCloneRepositoryWithNestedSubmodules.

Change-Id: Ibc841683763307cb76e78e142e0da5b11b1add2a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoRemove unnecessary @SuppressWarnings("nls") 06/92306/1
David Pursehouse [Sat, 4 Mar 2017 00:26:53 +0000 (09:26 +0900)]
Remove unnecessary @SuppressWarnings("nls")

Change-Id: Idc5f82af17ecc944b5657b02823412ea46b38413
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoMake Repository.normalizeBranchName less strict 88/91488/7
Thomas Wolf [Thu, 23 Feb 2017 21:49:43 +0000 (22:49 +0100)]
Make Repository.normalizeBranchName less strict

This operation was added recently with the goal to provide some
way to auto-correct invalid user input, or to provide a correction
suggestion to the user -- EGit uses it now that way. But the initial
implementation was very restrictive; it removed all non-ASCII
characters and even slashes.

Understandably end users were not happy with that. Git has no such
restriction to ASCII-only; nor does JGit. Branch names should be
meaningful to the end user, and if a user-supplied branch name is
invalid for technical reasons, a "normalized" name should still
be meaningful to the user.

Rewrite to attempt a minimal fix such that the result will pass
isValidRefName.

* Replace all Unicode whitespace by underscore.
* Replace troublesome special characters by dash.
* Collapse sequences of underscores, dots, and dashes.
* Remove underscores, dots, and dashes following slashes, and
  collapse sequences of slashes.
* Strip leading and trailing sequences of slashes, dots, dashes,
  and underscores.
* Avoid the ".lock" extension.
* Avoid the Windows reserved device names.
* If input name is null return an empty String so callers don't need to
check for null.

This still allows branch names with single slashes as separators
between components, avoids some pitfalls that isValidRefName() tests
for, and leaves other character untouched and thus allows non-ASCII
branch names.

Also move the function from the bottom of the file up to where
isValidRefName is implemented.

Bug: 512508
Change-Id: Ia0576d9b2489162208c05e51c6d54e9f0c88c3a7
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge "SHA-1: collision detection support"
Jonathan Nieder [Thu, 2 Mar 2017 18:26:42 +0000 (13:26 -0500)]
Merge "SHA-1: collision detection support"

7 years agoSHA-1: collision detection support 52/91852/8
Shawn Pearce [Sat, 25 Feb 2017 19:43:42 +0000 (11:43 -0800)]
SHA-1: collision detection support

Update SHA1 class to include a Java port of sha1dc[1]'s ubc_check,
which can detect the attack pattern used by the SHAttered[2] authors.

Given the shattered example files that have the same SHA-1, this
modified implementation can identify there is risk of collision given
only one file in the pair:

  $ jgit ...
  [main] WARN org.eclipse.jgit.util.sha1.SHA1 - SHA-1 collision 38762cf7f55934b34d179ae6a4c80cadccbb7f0a

When JGit detects probability of a collision the SHA1 class now warns
on the logger, reporting the object's SHA-1 hash, and then throws a
Sha1CollisionException to the caller.

From the paper[3] by Marc Stevens, the probability of a false positive
identification of a collision is about 14 * 2^(-160), sufficiently low
enough for any detected collision to likely be a real collision.

git-core[4] may adopt sha1dc before the system migrates to an entirely
new hash function.  This commit enables JGit to remain compatible with
that move to sha1dc, and help protect users by warning if similar
attacks as SHAttered are identified.

Performance declined about 8% (detection off), now:

  MessageDigest        238.41 MiB/s
  MessageDigest        244.52 MiB/s
  MessageDigest        244.06 MiB/s
  MessageDigest        242.58 MiB/s

  SHA1                 216.77 MiB/s (was ~240.83 MiB/s)
  SHA1                 220.98 MiB/s
  SHA1                 221.76 MiB/s
  SHA1                 221.34 MiB/s

This decline in throughput is attributed to the step loop unrolling in
compress(), which was necessary to easily fit the UbcCheck logic into
the hash function.  Using helper functions s1-s4 reduces the code
explosion, providing acceptable throughput.

With detection enabled (default):

  SHA1 detectCollision 180.12 MiB/s
  SHA1 detectCollision 181.59 MiB/s
  SHA1 detectCollision 181.64 MiB/s
  SHA1 detectCollision 182.24 MiB/s

  sha1dc (native C)   ~206.28 MiB/s
  sha1dc (native C)   ~204.47 MiB/s
  sha1dc (native C)   ~203.74 MiB/s

Average time across 100,000 calls to hash 4100 bytes (such as a commit
or tree) for the various algorithms available to JGit also shows SHA1
is slower than MessageDigest, but by an acceptable margin:

  MessageDigest        17 usec
  SHA1                 18 usec
  SHA1 detectCollision 22 usec

Time to index-pack for git.git (217982 objects, 69 MiB) has increased:

  MessageDigest   SHA1 w/ detectCollision
  -------------   -----------------------
         20.12s   25.25s
         19.87s   25.48s
         20.04s   25.26s

    avg  20.01s   25.33s    +26%

Being implemented in Java with these additional safety checks is
clearly a penalty, but throughput is still acceptable given the
increased security against object name collisions.

[1] https://github.com/cr-marcstevens/sha1collisiondetection
[2] https://shattered.it/
[3] https://marc-stevens.nl/research/papers/C13-S.pdf
[4] https://public-inbox.org/git/20170223230621.43anex65ndoqbgnf@sigill.intra.peff.net/

Change-Id: I9fe4c6d8fc5e5a661af72cd3246c9e67b1b9fee6

7 years agoSilence API error caused by changed return type of digest() 48/92048/1
Matthias Sohn [Tue, 28 Feb 2017 23:34:59 +0000 (00:34 +0100)]
Silence API error caused by changed return type of digest()

Change-Id: Ic0810ed7fea837c45cbc9a4649ca51d140bad6e6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoCorrect the boolean logic for filtering paths 32/91432/6
Magnus Vigerlöf [Sat, 18 Feb 2017 18:28:39 +0000 (19:28 +0100)]
Correct the boolean logic for filtering paths

The TreeWalk filtering classes need to support the three different
meanings of the return value the path comparison generates.
A new path comparison method (isPathMatch) is created with
three distinct return values (isPathPrefix use value '0' to
encode two of these) which will makes it possible for the logical
operators (especially NOT) to aggregate a correct verdict.

A filter like: AND(Path("path"), NOT(Path("path/to/other")))
Should filter out 'path/to/other/file', but not 'path/to/my/file'.

The path-limiting feature when testing path/to/my/file, would
result to run test for the following paths:

    path
    path/to
    path/to/my
    path/to/my/file

isPathPrefix('path/to/other') will return '0' for the first two
and since there is no way for NOT to distinguish between an exact
match and a match indicating that the tested path is a 'parent',
it will incorrectly return false and thus remove everything below
'path' immediately.
isPathMatch has a distinguished value for 'parent' matches that
will be preserved through the logic operators and should not
cause an over-eager removal of paths.

The functionality of isPathPrefix is required by other parts
and is untouched.

Unit tests are included to ensure that the logical functionality
is correct and can be preserved.

Change-Id: Ice2ca9406f09f1b179569e99b86a0e5d77baa20d
Signed-off-by: Magnus Vigerlöf <magnus.vigerlof@gmail.com>
7 years agoMerge "SHA1: support reset() and reuse instances"
Jonathan Nieder [Mon, 27 Feb 2017 00:01:36 +0000 (19:01 -0500)]
Merge "SHA1: support reset() and reuse instances"

7 years agoSHA1: support reset() and reuse instances 72/91872/5
Shawn Pearce [Sun, 26 Feb 2017 19:44:51 +0000 (11:44 -0800)]
SHA1: support reset() and reuse instances

Allow SHA1 instances to be reused to compute another hash value, and
resume caching them in ObjectInserter and PackParser.  This shaves a
small amount of running time off parsing git.git's pack file:

  before   after
  ------   ------
  25.25s   25.55s
  25.48s   25.06s
  25.26s   24.94s

Almost noise (small difference), but recycling the instances reduces
some stress on the memory allocator finding two 80 word message block
arrays needed for hashing and collision detection.

Change-Id: I4af88a720e81460293bc5c5d1d3db1a831e7e228

7 years agoMerge changes from topic 'SHAttered'
Jonathan Nieder [Sun, 26 Feb 2017 23:17:02 +0000 (18:17 -0500)]
Merge changes from topic 'SHAttered'

* changes:
  Switch to pure Java SHA1 for ObjectId
  Pure Java SHA-1

7 years agoUpdate Jetty to 9.4.1.v20170120 in buck build 76/91876/2
Jonathan Nieder [Sun, 26 Feb 2017 23:09:04 +0000 (15:09 -0800)]
Update Jetty to 9.4.1.v20170120 in buck build

5e8e2179b218ede7d14b69dc5149b0691b5859cf (Update Jetty to
9.4.1.v201470120, 2017-01-26) updated Jetty in the maven build.
Update the buck build to match so buck builds work again.

The buck build will go away soon, but in the meantime (until the bazel
build gets the same level of support) it is convenient as a faster way
of running tests than using maven.

The bazel build doesn't need this change since it doesn't build or run
http tests yet.

Change-Id: Ibbdaf2880e76b32fc9f6b5605a2ff29e3deffda2

7 years agoSwitch to pure Java SHA1 for ObjectId 37/91837/4
Shawn Pearce [Sat, 25 Feb 2017 07:33:18 +0000 (23:33 -0800)]
Switch to pure Java SHA1 for ObjectId

Generate names for objects using only the pure Java SHA1
implementation, but continue using MessageDigest in tests.
This opens the possibility of changing the hashing function
to incorporate additional safety measures, such as those
used in sha1dc[1].

Since MessageDigest has higher throughput, continue using
MessageDigest for computing pack, idx and DirCache trailers.
These are less likely to be sensitive to SHAttered[2] types
of attacks, as Git uses them to detect random bit flips
during transfer, and not for content identity.

[1] https://github.com/cr-marcstevens/sha1collisiondetection
[2] https://shattered.it/

Change-Id: If6da98334201f7f20cb916e46f782c45f373784e

7 years agoPure Java SHA-1 36/91836/4
Shawn Pearce [Fri, 24 Feb 2017 22:57:20 +0000 (14:57 -0800)]
Pure Java SHA-1

This implementation is derived straight from the description written
in RFC 3174.  On Mac OS X with Java 1.8.0_91 it offers similar
throughput as MessageDigest SHA-1:

  system   239.75 MiB/s
  system   244.71 MiB/s
  system   245.00 MiB/s
  system   244.92 MiB/s

  sha1     234.08 MiB/s
  sha1     244.50 MiB/s
  sha1     242.99 MiB/s
  sha1     241.73 MiB/s

This is the fastest implementation I could come up with.  Common SHA-1
implementation tricks such as unrolling loops creates a method too
large for the JIT to effectively optimize, resulting in lower overall
hashing throughput. Using a preprocessor to perform the register
renaming of A-E also didn't help, as again the method was too large
for the JIT to effectively optimize.

Fortunately the fastest version is a naive, straight-forward
implementation very close to the description in RFC 3174.

Change-Id: I228b05c4a294ca2ad51386cf0e47978c68e1aa42

7 years agoRemove unused imported package in org.eclipse.jgit.ant.test 10/91510/1
David Pursehouse [Mon, 20 Feb 2017 23:46:10 +0000 (08:46 +0900)]
Remove unused imported package in org.eclipse.jgit.ant.test

Change-Id: Id8e31a4d7cc25c3b953c67674797dc575b65f6c5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoEnable and fix warnings about redundant specification of type arguments 50/91450/3
David Pursehouse [Mon, 20 Feb 2017 04:17:27 +0000 (13:17 +0900)]
Enable and fix warnings about redundant specification of type arguments

Since the introduction of generic type parameter inference in Java 7,
it's not necessary to explicitly specify the type of generic parameters.

Enable the warning in Eclipse, and fix all occurrences.

Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoFix hamcrest dependency in org.eclipse.jgit.ant.test 48/91448/2
David Pursehouse [Mon, 20 Feb 2017 04:05:25 +0000 (13:05 +0900)]
Fix hamcrest dependency in org.eclipse.jgit.ant.test

Change-Id: I3361dce600698048b73a70cd991ad1a6b093e1da
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoAdd API filter for usage of FileRepository in test classes 47/91447/3
David Pursehouse [Mon, 20 Feb 2017 03:51:42 +0000 (12:51 +0900)]
Add API filter for usage of FileRepository in test classes

FileRepository is in the package org.eclipse.jgit.internal, and is
thus non-API. This causes warnings in Eclipse when FileRepository is
used.

Add a filter to prevent the warnings.

Change-Id: I9a8ae106c085bb0e826031fa183b4c4bdabcc5fc
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoFix bad test fix from 0bff481 "Limit receive commands" 97/91497/1
Shawn Pearce [Mon, 20 Feb 2017 18:51:27 +0000 (10:51 -0800)]
Fix bad test fix from 0bff481 "Limit receive commands"

In 0bff481d45db74db81a3b1b86f7401443a60d970 to accurately use the two
limits it was necessary to move the LimitedInputStream out of the
PacketLineIn and further down to the PackParser. Unfortuantely this
didn't survive review, as a buggy test failed and the "fix" was to
drop this part of the code.

The maxPackSizeLimit should apply to the pack stream, not the pkt-line
framing used to send commands to control the ReceivePack instance. The
commands are controlled using a different limit. The failing test allowed
too many bytes in the pack and was only failing because it was including
the command framing. The correct fix for the test was simply to drop the
limit lower, to more closely match the actual pack size.

Change-Id: I47d3885b9d7d527e153df7ac9c62fc2865ceecf4

7 years agoFix timestamp in Zip archives 96/91496/1
Shawn Pearce [Mon, 20 Feb 2017 18:30:58 +0000 (10:30 -0800)]
Fix timestamp in Zip archives

RevCommit.getCommitTime returns time in seconds since the epoch.
ZipArchiveEntry.setTime expects time in milliseconds.

Add the missing unit conversion to get the correct result.
Correct formatting to be consistent with the rest of the code.

Change-Id: I990b92f1d996ec8538d4857755694d91b142eb53

7 years agoAdd some more missing @Override annotations 44/91444/1
David Pursehouse [Mon, 20 Feb 2017 02:32:22 +0000 (11:32 +0900)]
Add some more missing @Override annotations

Change-Id: Ic13160920b986edde87c928c473240cc9c034f50
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoEnable and fix 'Should be tagged with @Override' warning 32/88732/7
David Pursehouse [Mon, 16 Jan 2017 05:39:32 +0000 (14:39 +0900)]
Enable and fix 'Should be tagged with @Override' warning

Set missingOverrideAnnotation=warning in Eclipse compiler preferences
which enables the warning:

  The method <method> of type <type> should be tagged with @Override
  since it actually overrides a superclass method

Justification for this warning is described in:

  http://stackoverflow.com/a/94411/381622

Enabling this causes in excess of 1000 warnings across the entire
code-base. They are very easy to fix automatically with Eclipse's
"Quick Fix" tool.

Fix all of them except 2 which cause compilation failure when the
project is built with mvn; add TODO comments on those for further
investigation.

Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoUpdate Jetty to 9.4.1.v20170120 43/91443/2
Matthias Sohn [Thu, 26 Jan 2017 00:03:16 +0000 (01:03 +0100)]
Update Jetty to 9.4.1.v20170120

MappedLoginService is no longer available in Jetty 9.4 therefore base
TestLoginService on AbstractLoginService.

Apparently Jetty now uses slf4j hence adapt RecordingLogger accordingly
so we can log error messages containing slf4j style formatting anchors
"{}".

Change-Id: Ibb36aba8782882936849b6102001a88b699bb65c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoFix typo in @since 35/91435/1
Thomas Wolf [Sun, 19 Feb 2017 15:46:44 +0000 (16:46 +0100)]
Fix typo in @since

Change-Id: I266b0c72d2827bcf2b86ddc6c1892d1a46c548eb
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
7 years agoPullCommand: Allow to set tag behavior 43/91243/2
David Pursehouse [Thu, 16 Feb 2017 06:57:54 +0000 (15:57 +0900)]
PullCommand: Allow to set tag behavior

Add a new method setTagOpt which sets the annotated tag behavior during
fetch. Pass the option to the fetch command.

No explicit tests are added; the fetch with tags functionality is already
covered by the tests of the fetch command.

Change-Id: I131e1f68d8fcced178d8fa48abf7ffab17f8e173
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoAdd missing @Override annotations in org.eclipse.jgit.archive 19/91419/1
Matthias Sohn [Sat, 18 Feb 2017 09:48:58 +0000 (10:48 +0100)]
Add missing @Override annotations in org.eclipse.jgit.archive

Change-Id: I51e37ca7643da6abadbd36e9187ccb58fe713833
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoSet commit time to ZipArchiveEntry 16/91116/6
Naoki Takezoe [Thu, 29 Dec 2016 04:47:17 +0000 (13:47 +0900)]
Set commit time to ZipArchiveEntry

Archived zip files for a same commit have different MD5 hash because
mdate and mdate in the header of zip entries are not specified. In
this case, Commons Compress sets an archived time.

In the original git implementation, it's set a commit time:
https://github.com/git/git/blob/e2b2d6a172b76d44cb7b1ddb12ea5bfac9613a44/archive.c#L378

By this fix, archive command sets the commit time to ZipArchiveEntry
when RevCommit is given as an archiving target.

Change-Id: I30dd8710e910cdf42d57742f8709e9803930a123
Signed-off-by: Naoki Takezoe <takezoe@gmail.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoGC: don't loosen doomed objects 27/91327/3
David Turner [Thu, 16 Feb 2017 18:43:49 +0000 (13:43 -0500)]
GC: don't loosen doomed objects

If the pruneexpire config is set to "now", then any unreferenced loose
objects are immediately eligible for gc.  So there is no need to
actually write the loose objects.

Users who run hosting services which sometimes accept large, entirely
garbage packs might set the following configurations:

gc.pruneExpire = now
gc.prunePackExpire = 2.weeks

Then garbage objects will be kept around in packs, but after two weeks
the packs themselves will get deleted.

For client-side users of jgit, the default settings will loosen
garbage objects, and, after an hour, delete the old packs in which
they resided.

Change-Id: I8f686ac60b40181b1ee92ac6c313c3f33b55c44c
Signed-off-by: David Turner <dturner@twosigma.com>
7 years agoMerge "Update name of InsecureCipherMode error-prone pattern"
Jonathan Nieder [Thu, 16 Feb 2017 00:14:15 +0000 (19:14 -0500)]
Merge "Update name of InsecureCipherMode error-prone pattern"

7 years agoMerge "Update build to use Tycho 1.0.0"
Jonathan Nieder [Thu, 16 Feb 2017 00:06:04 +0000 (19:06 -0500)]
Merge "Update build to use Tycho 1.0.0"

7 years agoUpdate name of InsecureCipherMode error-prone pattern 27/91227/1
Jonathan Nieder [Thu, 16 Feb 2017 00:00:34 +0000 (16:00 -0800)]
Update name of InsecureCipherMode error-prone pattern

Without this, using bazel 0.4.4 to build fails:

 ERROR: jgit/org.eclipse.jgit/BUILD:29:1: Java compilation in rule '//org.eclipse.jgit:insecure_cipher_factory' failed: Worker process sent response with exit code: 1.
 jgit/src/org/eclipse/jgit/transport/InsecureCipherFactory.java:63: error: [InsecureCryptoUsage] Insecure usage of a crypto API: the transformation is not a compile-time constant expression.
                return Cipher.getInstance(algo);
                                         ^
    (see http://errorprone.info/bugpattern/InsecureCryptoUsage)

Change-Id: I7f9a3a5117e42cb68544674f5312df0368aa3674

7 years agoAdd missing skip garbage pack logic in DfsReader 25/91225/1
Zhen Chen [Wed, 15 Feb 2017 23:35:20 +0000 (15:35 -0800)]
Add missing skip garbage pack logic in DfsReader

* Missing garbage pack check in getObjectSize(AnyObjectId, int)
* Missing `last` pack check in has(AnyObjectId) and open(AnyObjectId,
int)

Change-Id: Idd1b9dd8db34c92d7da546fef1936ec9b2728718
Signed-off-by: Zhen Chen <czhen@google.com>
7 years agoUpdate build to use Tycho 1.0.0 23/91223/1
Matthias Sohn [Wed, 15 Feb 2017 22:44:12 +0000 (23:44 +0100)]
Update build to use Tycho 1.0.0

Change-Id: I10f61962e1496f079a39e0f533506816be56e925
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoSkip first pack if avoid garbage is set and it is a garbage pack 89/90989/5
Zhen Chen [Mon, 13 Feb 2017 20:36:25 +0000 (12:36 -0800)]
Skip first pack if avoid garbage is set and it is a garbage pack

At beginning of the OBJECT_SCAN loop, it will first check if the object
exists in the last pack, however, it forgot to avoid garbage pack for
the first iteration.

Change-Id: I8a99c0f439218d19c49cd4dae891b8cc4a57099d
Signed-off-by: Zhen Chen <czhen@google.com>
7 years agoRefactor skip garbage pack logic into a method 09/91009/2
Zhen Chen [Mon, 13 Feb 2017 23:28:10 +0000 (15:28 -0800)]
Refactor skip garbage pack logic into a method

There are multiple places in DfsReader to skip garbage pack if both of
the following conditions satisfied:

* AvoidUnreachable flag is set
* The pack is a garabge pack

Refactor them into a shared private method.

Change-Id: I67d6bb601db55f904437c807c6a3c36f0a723265
Signed-off-by: Zhen Chen <czhen@google.com>
7 years agoUpdate .mailmap 99/90899/1
David Pursehouse [Mon, 13 Feb 2017 01:19:42 +0000 (10:19 +0900)]
Update .mailmap

Change-Id: I88b219a90a4fd3b8111182bb519db58786dbbe6d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoLimit receive commands 08/77108/7
Shawn Pearce [Tue, 5 Jul 2016 01:04:43 +0000 (18:04 -0700)]
Limit receive commands

Place a configurable upper bound on the amount of command data
received from clients during `git push`.  The limit is applied to the
encoded wire protocol format, not the JGit in-memory representation.
This allows clients to flexibly use the limit; shorter reference names
allow for more commands, longer reference names permit fewer commands
per batch.

Based on data gathered from many repositories at $DAY_JOB, the average
reference name is well under 200 bytes when encoded in UTF-8 (the wire
encoding).  The new 3 MiB default receive.maxCommandBytes allows about
11,155 references in a single `git push` invocation.  A Gerrit Code
Review system with six-digit change numbers could still encode 29,399
references in the 3 MiB maxCommandBytes limit.

Change-Id: I84317d396d25ab1b46820e43ae2b73943646032c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoUpdate minimum JDK version in README 95/90795/2
David Pursehouse [Fri, 10 Feb 2017 06:58:26 +0000 (15:58 +0900)]
Update minimum JDK version in README

Change-Id: I655d896b268e946e3492661b08add0ebac22c6f0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoUpgrade jacoco-maven-plugin to 0.7.9 91/90791/2
David Pursehouse [Fri, 10 Feb 2017 01:39:42 +0000 (10:39 +0900)]
Upgrade jacoco-maven-plugin to 0.7.9

Change-Id: Ifc0b0f2899f4094f0525021236c3e73658138f7e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoUpgrade maven-build-helper-plugin to 3.0.0 90/90790/2
David Pursehouse [Fri, 10 Feb 2017 01:39:22 +0000 (10:39 +0900)]
Upgrade maven-build-helper-plugin to 3.0.0

Change-Id: Ib354bf3a1c064f54255dc05de9e89e79dbcc9182
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoUpgrade maven-shade-plugin to 3.0.0 89/90789/2
David Pursehouse [Fri, 10 Feb 2017 01:38:32 +0000 (10:38 +0900)]
Upgrade maven-shade-plugin to 3.0.0

Change-Id: I46bf48657eceefc65b710a054df14dea5b9f15f8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoFix inconsistent versioning of findbugs-maven-plugin 88/90788/2
David Pursehouse [Fri, 10 Feb 2017 01:36:37 +0000 (10:36 +0900)]
Fix inconsistent versioning of findbugs-maven-plugin

In one place version 3.0.4 is used, and in another place 3.0.3 is
used.

Define the version (3.0.4) in a property and use that in both places,
so it doesn't get inconsistent again next time the version is bumped.

Change-Id: If3a2489cec78c0c9ef76aa6b941fda51b098e04b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoUpgrade maven-compiler-plugin to 3.6.1 87/90787/2
David Pursehouse [Fri, 10 Feb 2017 01:28:57 +0000 (10:28 +0900)]
Upgrade maven-compiler-plugin to 3.6.1

Change-Id: Ia1c21c17ed6cd17c7ee353aa6a0bf1f88de5c045
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoLocalDiskRepositoryTestCase: Add clarifying comment in call to createRepository 14/90814/2
David Pursehouse [Fri, 10 Feb 2017 10:51:52 +0000 (19:51 +0900)]
LocalDiskRepositoryTestCase: Add clarifying comment in call to createRepository

Clarify that 'true' means 'auto close'. This makes it consistent with
other calls that have a boolean argument for 'bare'. It also makes it a
bit easier to see what's going on while stepping in the debugger, because
it's not necessary to scroll around to find the method declaration.

Change-Id: Idacd749407dcfd258af3efaaf44d129069925dd3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoIndexDiffSubmoduleTest: Fix negative use count 19/89719/4
David Pursehouse [Fri, 10 Feb 2017 10:48:52 +0000 (19:48 +0900)]
IndexDiffSubmoduleTest: Fix negative use count

submoduleStandalone is created by createWorkRepository() which adds
the created repository to the set of repositories to be closed in
the test teardown. It is therefore not necessary to explicitly close
it.

Change-Id: Ib6f525b644fdeaaf1934df39cc2d3583a0d883dc
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoBlameGenerator: Annotate #getRenameDetector as Nullable 23/89923/5
David Pursehouse [Tue, 31 Jan 2017 05:52:52 +0000 (14:52 +0900)]
BlameGenerator: Annotate #getRenameDetector as Nullable

The renameDetector member returned by this method will be null when
following file renames has been disabled by previously calling:

  setFollowFileRenames(false).

Annotate it as @Nullable and update the Javadoc to explicitly
document the null return.

Change-Id: I9bdf443a64cf3c45352d3ab023051a2e11f7426d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoFetchCommandTest: Don't declare specific exceptions in test methods 01/90601/2
David Pursehouse [Wed, 8 Feb 2017 02:12:28 +0000 (11:12 +0900)]
FetchCommandTest: Don't declare specific exceptions in test methods

Change-Id: Ie0f8a0f7a9c2c383be6ae8265353daac7f5a89fa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoPushCommandTest: Remove unused variables to prevent errors in Eclipse 97/90697/1
David Pursehouse [Thu, 9 Feb 2017 06:09:39 +0000 (15:09 +0900)]
PushCommandTest: Remove unused variables to prevent errors in Eclipse

Change-Id: Ie656b18fb151bf1e3c2dcc0438a77e32102991c2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoRefLeaseSpec: Fix Eclipse errors 96/90696/1
David Pursehouse [Thu, 9 Feb 2017 06:08:47 +0000 (15:08 +0900)]
RefLeaseSpec: Fix Eclipse errors

- Remove unused import

- Remove unused private constructor

- Add Javadoc for public constructor

Change-Id: I1253e9fe863ca0f63182461ee87357fbf726ea2e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoMerge "push: support per-ref force-with-lease"
Shawn Pearce [Thu, 9 Feb 2017 03:27:03 +0000 (22:27 -0500)]
Merge "push: support per-ref force-with-lease"

7 years agopush: support per-ref force-with-lease 27/88127/3
David Turner [Wed, 4 Jan 2017 04:56:08 +0000 (23:56 -0500)]
push: support per-ref force-with-lease

When rebasing, force-pushing has a race condition: someone else might
have pushed a commit since the one you just rewrote. The force-with-lease
option prevents this by ensuring that the ref's old value is the one
that you expected.

Change-Id: I97ca9f8395396c76332bdd07c486e60549ca4401
Signed-off-by: David Turner <dturner@twosigma.com>
7 years agoAssume GC_REST and GC_TXN also attempted deltas during packing 88/90688/1
Shawn Pearce [Wed, 8 Feb 2017 23:34:00 +0000 (15:34 -0800)]
Assume GC_REST and GC_TXN also attempted deltas during packing

In a DFS repository the DfsGarbageCollector will typically attempt
delta compression while creating the three main pack files: GC,
GC_REST and GC_TXN. Include all of these in the wasDeltaAttempted()
decision so that future packers can bypass delta compression of
non-delta objects.

Change-Id: Ic2330c69fab0c494b920b4df0a290f3c2e1a03d7

7 years agoPrefer smaller GC files during DFS garbage collection 82/90482/5
Shawn Pearce [Tue, 7 Feb 2017 00:04:29 +0000 (16:04 -0800)]
Prefer smaller GC files during DFS garbage collection

In 8ac65d33ed7a94f77cb066271669feebf9b882fc PackWriter changed its
behavior to always prefer the last object representation presented
to it by the ObjectReuseAsIs implementation. This was a fix to avoid
delta chain cycles.

Unfortunately it can lead to suboptimal compression when concurrent
GCs are run on the same repository. One case is automatic GC running
(with default settings) in parallel to a manual GC that has disabled
delta reuse in order to generate new smaller deltas for the entire
history of the repository.

Running GC with no-reuse generally requires more CPU time, which
also translates to a longer running time.  This can lead to a race
where the automatic GC completes before the no-reuse GC, leaving
the repository in a state such as:

  no-reuse GC:   size 1 GiB, mtime = 18:45
  auto GC:       size 8 GiB, mtime = 17:30

With the default sort ordering, the smaller no-reuse GC pack is
sorted earlier in the pack list, due to its more recent mtime.

During object reuse in a future GC, these smaller representations
are considered first by PackWriter, but are all discarded when the
auto GC file from 17:30 is examined second (due to its older mtime).

Work around this in two ways.

Well formed DFS repositories should have at most 1 GC pack. If
2 or more GC packs exist, break the sorting tie by selecting the
smaller file earlier in the pack list. This allows all normal read
code paths to favor the smaller file, which places less pressure
on the DfsBlockCache. If any GC race happens, readers serving clone
requests will prefer the file that is smaller.

During object reuse, flip this ordering so that the smaller file is
last. This allows PackWriter to see smaller deltas last, replacing
larger representations that were previously considered from other
pack files.

Change-Id: I0b7dc8bb9711c82abd6bd16643f518cfccc6d31a