]> source.dussan.org Git - jgit.git/log
jgit.git
6 years agoMerge branch 'stable-4.7' into stable-4.8 49/130649/1
Jonathan Nieder [Mon, 8 Oct 2018 21:49:09 +0000 (21:49 +0000)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  SubmoduleValidator: Permit missing path or url

Change-Id: I94fdaf45abbf7665f9eddc14b1a7f7144aafeadf
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoSubmoduleValidator: Permit missing path or url 76/130576/2
Jonathan Nieder [Sun, 7 Oct 2018 21:55:52 +0000 (21:55 +0000)]
SubmoduleValidator: Permit missing path or url

A .gitmodules file can include a submodule without a path to configure
the URL for a submodule that is only present on other branches.

A .gitmodules file can include a submodule with no URL and no path to
reserve the name for a submodule that existed in earlier history but
is not available from any URL any more.

"git fsck" permits both of these cases.  Permit them in JGit as well
(instead of throwing NullPointerException).

Change-Id: I3b442639ad79ea7a59227f96406a12e62d3573ae
Reported-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 45/130545/1
David Pursehouse [Sun, 7 Oct 2018 02:04:18 +0000 (11:04 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  ObjectChecker#getGitsubmodules: Fix malformed javadoc

Change-Id: I51ddd8fa1c2fbcabfb010bc4662d2c925563b55a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoObjectChecker#getGitsubmodules: Fix malformed javadoc 30/130530/2
David Pursehouse [Sat, 6 Oct 2018 08:51:28 +0000 (17:51 +0900)]
ObjectChecker#getGitsubmodules: Fix malformed javadoc

The text "<tree, blob>" with angle brackets should not be used in javadoc
since it is interpreted as an HTML tag and then rejected since it's not a
valid HTML tag. Wrap the text in a @literal tag.

Also add a missing space.

Change-Id: Ide045e8c04a39a916f5b2e964e58c151e4555830
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 95/130495/3
Matthias Sohn [Fri, 5 Oct 2018 23:03:20 +0000 (01:03 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Prepare 4.7.6-SNAPSHOT builds
  JGit v4.7.5.201810051826-r
  BaseReceivePack: Validate incoming .gitmodules files
  ObjectChecker: Report .gitmodules files found in the pack
  SubmoduleAddCommand: Reject submodule URIs that look like cli options

Change-Id: Id6fabec4d0b682a7e20a46e88cbc05432efca062
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 4.7.6-SNAPSHOT builds 15/130515/1
Matthias Sohn [Fri, 5 Oct 2018 22:36:30 +0000 (00:36 +0200)]
Prepare 4.7.6-SNAPSHOT builds

Change-Id: I99b59116999742d8d6cdba26287ea7c6eba11a30
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.7.5.201810051826-r 14/130514/1 v4.7.5.201810051826-r
Matthias Sohn [Fri, 5 Oct 2018 22:27:38 +0000 (00:27 +0200)]
JGit v4.7.5.201810051826-r

Change-Id: I60c7a2eff3dab5083f71df0d9465a4e94b5e2513
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoBaseReceivePack: Validate incoming .gitmodules files 94/130494/6
Ivan Frade [Mon, 1 Oct 2018 20:44:00 +0000 (13:44 -0700)]
BaseReceivePack: Validate incoming .gitmodules files

The main concern are submodule urls starting with '-' that could pass as
options to an unguarded tool.

Pass through the parser the ids of blobs identified as .gitmodules
files in the ObjectChecker. Load the blobs and parse/validate them
in SubmoduleValidator.

Change-Id: Ia0cc32ce020d288f995bf7bc68041fda36be1963
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoObjectChecker: Report .gitmodules files found in the pack 93/130493/3
Ivan Frade [Thu, 27 Sep 2018 20:05:13 +0000 (13:05 -0700)]
ObjectChecker: Report .gitmodules files found in the pack

In order to validate .gitmodules files, we first need to find them
in the incoming pack.

Do it in the ObjectChecker stage. Check in the tree objects if they
point to a .gitmodules file and report the tree id and the .gitmodules
blob id.

This can be used later to check if the file is in the root of the
project and if the contents are good.

While we're here, make isMacHFSGit more accurate by detecting variants
of filenames that vary in case.

[jn: tweaked NTFS and HFS+ checking; added more tests]

Change-Id: I70802e7d2c1374116149de4f89836b9498f39582
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoSubmoduleAddCommand: Reject submodule URIs that look like cli options 92/130492/3
Ivan Frade [Mon, 24 Sep 2018 23:03:35 +0000 (16:03 -0700)]
SubmoduleAddCommand: Reject submodule URIs that look like cli options

In C git versions before 2.19.1, the submodule is fetched by running
"git clone <uri> <path>". A URI starting with "-" would be interpreted
as an option, causing security problems. See CVE-2018-17456.

Refuse to add submodules with URIs, names or paths starting with "-",
that could be confused with command line arguments.

[jn: backported to JGit 4.7.y, bringing portions of Masaya Suzuki's
 dotdot check code in v5.1.0.201808281540-m3~57 (Add API to specify
 the submodule name, 2018-07-12) along for the ride]

Change-Id: I2607c3acc480b75ab2b13386fe2cac435839f017
Signed-off-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 58/129958/1
David Pursehouse [Tue, 25 Sep 2018 23:16:47 +0000 (08:16 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  ObjectDownloadListener#onWritePossible: Add comment on return statement

Change-Id: Id0833112b0be4e78af375ee1fc78287743d7bc4c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoObjectDownloadListener#onWritePossible: Add comment on return statement 98/129898/2
David Ostrovsky [Tue, 25 Sep 2018 06:20:57 +0000 (08:20 +0200)]
ObjectDownloadListener#onWritePossible: Add comment on return statement

It is not obvious why this return statement is needed. Clarify with a
comment that otherwise endless loop may show up when recent versions
of Jetty are used.

Change-Id: I8e5d4de51869fb1179bf599bfb81bcd7d745874b
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
6 years agoMerge branch 'stable-4.7' into stable-4.8 26/129626/1
Matthias Sohn [Tue, 18 Sep 2018 13:20:57 +0000 (15:20 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Prepare 4.7.5-SNAPSHOT builds
  JGit v4.7.4.201809180905-r
  Update API problem filter

Change-Id: I9a9abcd2e48e19295d537241c951308cd0210019
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 4.7.5-SNAPSHOT builds 23/129623/1
Matthias Sohn [Tue, 18 Sep 2018 13:16:36 +0000 (15:16 +0200)]
Prepare 4.7.5-SNAPSHOT builds

Change-Id: Ifce4311fe9429d751cec5b326b540d6233762153
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.7.4.201809180905-r 22/129622/1 v4.7.4.201809180905-r
Matthias Sohn [Tue, 18 Sep 2018 13:05:11 +0000 (15:05 +0200)]
JGit v4.7.4.201809180905-r

Change-Id: Iceee69df5fd593bece4532d5781e3771f5761ef8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpdate API problem filter 21/129621/1
Matthias Sohn [Tue, 18 Sep 2018 13:03:40 +0000 (15:03 +0200)]
Update API problem filter

Change-Id: Ie15c7d0b320f75915c362f5bd3bd6b39d84a900a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 81/129581/2
David Pursehouse [Tue, 18 Sep 2018 00:15:02 +0000 (09:15 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Fix ObjectUploadListener#close
  Fix error handling in FileLfsServlet
  ObjectDownloadListener#onWritePossible: Make code spec compatible
  ObjectDownloadListener: Return from onWritePossible when data is written
  Fix IOException when LockToken#close fails

Change-Id: Iad9836811be034cf992ea25dad4409addba75115
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFix ObjectUploadListener#close 82/129582/1
Matthias Sohn [Mon, 17 Sep 2018 23:14:34 +0000 (01:14 +0200)]
Fix ObjectUploadListener#close

Do not try to set response status if response is already committed.

Change-Id: I9a7c2871c86eb53416b905324775f3ed961c8ae6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix error handling in FileLfsServlet 02/129502/2
Matthias Sohn [Sun, 16 Sep 2018 22:35:33 +0000 (00:35 +0200)]
Fix error handling in FileLfsServlet

Check in #sendError method if the response was committed already.

If yes we cannot set response status or send an error message, last
resort is to close the outputstream.

If the response wasn't yet committed first reset the response before
using writer to send the error message to the client since mixing STREAM
and WRITE mode (mixing asynchronous and blocking I/O) is illegal in
servlet 3.1.

see the following bugs in the gerrit and jetty issue trackers
https://bugs.chromium.org/p/gerrit/issues/detail?id=9667
https://bugs.chromium.org/p/gerrit/issues/detail?id=9721
https://github.com/eclipse/jetty.project/issues/2911

Change-Id: Ie35563c2e0ac1c5e918185a746622589a880dc7f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoObjectDownloadListener#onWritePossible: Make code spec compatible 01/129501/6
David Ostrovsky [Sat, 15 Sep 2018 19:09:51 +0000 (21:09 +0200)]
ObjectDownloadListener#onWritePossible: Make code spec compatible

Current code violates the ServletOutputStream contract. For every
out.isReady() == true either write or close of that ServletOutputStream
should be called.

See also this issue upstream for more context: [1].

[1] https://github.com/eclipse/jetty.project/issues/2911

Change-Id: Ied575f3603a6be0d2dafc6c3329d685fc212c7a3
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoObjectDownloadListener: Return from onWritePossible when data is written 73/129473/3
David Ostrovsky [Sat, 15 Sep 2018 19:09:51 +0000 (21:09 +0200)]
ObjectDownloadListener: Return from onWritePossible when data is written

When buffer was written not only call AsyncContext#complete() but also
return from the ObjectDownloadListener#onWritePossible(). This avoids
endless loop after upgrading from Jetty 9.3.x to 9.4.x lines.

In Jetty example implementation:[1] the return statemnt is also used:

  // If we are at EOF then complete
  if (len < 0)
  {
    async.complete();
    return;
  }

See also this issue upstream: [2].

[1] https://webtide.com/servlet-3-1-async-io-and-jetty
[2] https://github.com/eclipse/jetty.project/issues/2911

Change-Id: Iac73fb25e67d40228a378a8e34103f1d28b72a76
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
6 years agoFix IOException when LockToken#close fails 60/129460/3
Matthias Sohn [Sat, 15 Sep 2018 00:35:03 +0000 (02:35 +0200)]
Fix IOException when LockToken#close fails

This happened if the LockTokens hard link was already deleted earlier.

Bug: 531759
Change-Id: Idc84bd695fac1a763b3cbb797c9c4c636a16e329
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 86/129186/1
David Pursehouse [Wed, 12 Sep 2018 05:05:46 +0000 (14:05 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Fix NoSuchFileException during directory cleanup in RefDirectory
  Externalize warning message in RefDirectory.delete()
  Suppress warning for trying to delete non-empty directory

Change-Id: I9ec6352b5ff57aa1a3380079dc9165890cc76d49
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFix NoSuchFileException during directory cleanup in RefDirectory 84/129184/1
Matthias Sohn [Sun, 26 Aug 2018 23:13:38 +0000 (01:13 +0200)]
Fix NoSuchFileException during directory cleanup in RefDirectory

Bug: 538285
Change-Id: Iab5c381a412cb2c2176af55189668c267ed29fbc
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 8ab89ef066f91a7d39b705f4e61498f37291ffab)
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoExternalize warning message in RefDirectory.delete() 75/129075/1
Matthias Sohn [Thu, 23 Aug 2018 09:44:28 +0000 (11:44 +0200)]
Externalize warning message in RefDirectory.delete()

Change-Id: Icec16c01853a3f5ea016d454b3d48624498efcce
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
(cherry picked from commit 5e68fe245fb97f38620ea683dbeab724bf86da4c)
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoSuppress warning for trying to delete non-empty directory 74/129074/1
Thomas Wolf [Sun, 19 Aug 2018 18:48:06 +0000 (20:48 +0200)]
Suppress warning for trying to delete non-empty directory

This is actually a fairly common occurrence; deleting the parent
directories can work only if the file deleted was the last one
in the directory.

Bug: 537872
Change-Id: I86d1d45e1e2631332025ff24af8dfd46c9725711
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
(cherry picked from commit d9e767b431eae7978613cc8e0ade7467ec04376c)
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 75/128975/1
Matthias Sohn [Sun, 9 Sep 2018 06:48:59 +0000 (08:48 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Prepare 4.7.4-SNAPSHOT builds
  JGit v4.7.3.201809090215-r

Change-Id: I980807ad4701f9e510354b505c9556e123f32471
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix @since tag for LOCK_SUFFIX 74/128974/1
Matthias Sohn [Sun, 9 Sep 2018 06:46:11 +0000 (08:46 +0200)]
Fix @since tag for LOCK_SUFFIX

Change-Id: Ia65cf3f12ec6d35a21b4d9332be912f06d8bf834
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 4.7.4-SNAPSHOT builds 72/128972/1
Matthias Sohn [Sun, 9 Sep 2018 06:24:16 +0000 (08:24 +0200)]
Prepare 4.7.4-SNAPSHOT builds

Change-Id: Ie4d17e1604270946606e75145012c5b7fa1283eb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.7.3.201809090215-r 71/128971/1 v4.7.3.201809090215-r
Matthias Sohn [Sun, 9 Sep 2018 06:15:48 +0000 (08:15 +0200)]
JGit v4.7.3.201809090215-r

Change-Id: I1ded7a2b61235509c5a6ba95e7329e288bbfddb1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 46/128946/2
Matthias Sohn [Sat, 8 Sep 2018 05:19:13 +0000 (07:19 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Fix atomic lock file creation on NFS
  Use constant for ".lock"
  Fix handling of option core.supportsAtomicCreateNewFile
  GC: Avoid logging errors when deleting non-empty folders

Change-Id: Ia7a18f69eee173aec9e462c16eee2b0ca4565e76
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix atomic lock file creation on NFS 91/128091/8
Matthias Sohn [Sun, 26 Aug 2018 17:44:29 +0000 (19:44 +0200)]
Fix atomic lock file creation on NFS

FS_POSIX.createNewFile(File) failed to properly implement atomic file
creation on NFS using the algorithm [1]:
- name of the hard link must be unique to prevent that two processes
  using different NFS clients try to create the same link. This would
  render nlink useless to detect if there was a race.
- the hard link must be retained for the lifetime of the file since we
  don't know when the state of the involved NFS clients will be
  synchronized. This depends on NFS configuration options.

To fix these issues we need to change the signature of createNewFile
which would break API. Hence deprecate the old method
FS.createNewFile(File) and add a new method createNewFileAtomic(File).

The new method returns a LockToken which needs to be retained by the
caller (LockFile) until all involved NFS clients synchronized their
state. Since we don't know when the NFS caches are synchronized we need
to retain the token until the corresponding file is no longer needed.
The LockToken must be closed after the LockFile using it has been
committed or unlocked. On Posix, if core.supportsAtomicCreateNewFile =
false this will delete the hard link which guarded the atomic creation
of the file. When acquiring the lock fails ensure that the hard link is
removed.

[1] https://www.time-travellers.org/shane/papers/NFS_considered_harmful.html
also see file creation flag O_EXCL in
http://man7.org/linux/man-pages/man2/open.2.html

Change-Id: I84fcb16143a5f877e9b08c6ee0ff8fa4ea68a90d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUse constant for ".lock" 89/128889/2
Matthias Sohn [Fri, 8 Jun 2018 15:22:54 +0000 (17:22 +0200)]
Use constant for ".lock"

(cherry picked from commit 5f27032fb85694a093f827581216d4ffb99db68b)

Change-Id: I6bc0e9a910b110418a82d8e574fb2aecc3a31d6a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix handling of option core.supportsAtomicCreateNewFile 76/128876/1
Christian Halstrick [Fri, 17 Aug 2018 15:46:09 +0000 (17:46 +0200)]
Fix handling of option core.supportsAtomicCreateNewFile

When core.supportsAtomicCreateNewFile was set to false and the
repository was located on a filesystem which doesn't support the file
attribute "unix:nlink" then FS_POSIX#createNewFile may report an error
even if everything was ok. Modify FS_POSIX#createNewFile to silently
ignore this situation. An example of such a filesystem is sshfs where
reading "unix:nlink" always returns 1 (instead of throwing a exception).

Bug: 537969
Change-Id: I6deda7672fa7945efa8706ea1cd652272604ff19
Also-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoGC: Avoid logging errors when deleting non-empty folders 54/128654/2
Hector Caballero [Tue, 4 Sep 2018 15:15:44 +0000 (11:15 -0400)]
GC: Avoid logging errors when deleting non-empty folders

I88304d34c and Ia555bce00 modified the way errors are handled when
trying to delete non-empty reference folders. Before, this error was
silently ignored as it was considered an expected output. Now, every
failed folder delete is logged which can be noisy.

Ignore the DirectoryNotEmptyException but log any other error avoiding
deletion of an eligible folder.

Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com>
Change-Id: I194512f67885231d62c03976ae683e5cc450ec7c

6 years agoMerge branch 'stable-4.7' into stable-4.8 01/128401/1
David Pursehouse [Fri, 31 Aug 2018 00:24:57 +0000 (09:24 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Bazel: Use hyphen instead of underscore in external repository names
  Bazel: Format all build files with buildifier 0.15.0
  ChangeIdUtilTest: Remove unused notestCommitDashV

Change-Id: I414ade902dc38b696c566dd604000e3d289f3973
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoBazel: Use hyphen instead of underscore in external repository names 54/128354/1
David Pursehouse [Wed, 29 Aug 2018 23:48:41 +0000 (08:48 +0900)]
Bazel: Use hyphen instead of underscore in external repository names

Recent Bazel versions support the hyphen character in external
repository names. On the Gerrit project, the repository names
were harmonized to consistently use hyphen.

As a side effect, it is no longer possible to build jgit from source
in the gerrit tree, due to the different repository names.

Rename the dependencies to use hyphens, consistent with gerrit.

Change-Id: Ideebd858ddd3f0e6f765643001642dfb6c12441f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoBazel: Format all build files with buildifier 0.15.0 53/128353/1
David Pursehouse [Thu, 30 Aug 2018 06:27:20 +0000 (15:27 +0900)]
Bazel: Format all build files with buildifier 0.15.0

Change-Id: I8343b723da6e40d5ae7fc45c84f64c31276bd5dc
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoChangeIdUtilTest: Remove unused notestCommitDashV 51/128351/1
David Pursehouse [Sat, 30 Sep 2017 09:56:42 +0000 (10:56 +0100)]
ChangeIdUtilTest: Remove unused notestCommitDashV

This test was never being run. Since it was introduced it was
named "notest.." which meant it didn't run with JUnit3, and
since it is not annotated @Test it also doesn't run with JUnit4.

When compiling with Bazel 0.6.0, error-prone raises an error
that the public method is not annotated with @Ignore or @Test.

Given that the test has never been run anyway, we can just
remove it.

Bug: 525415
Change-Id: Ie9a54f89fe42e0c201f547ff54ff1d419ce37864
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 26/127626/2
Matthias Sohn [Sat, 18 Aug 2018 11:40:33 +0000 (13:40 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Fix GC run in foreground to not use executor

Change-Id: Ib150d132e2ce055d36ddffb2dbc37b5cb355e77a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix GC run in foreground to not use executor 47/127447/3
Hugo Arès [Wed, 15 Aug 2018 13:54:29 +0000 (09:54 -0400)]
Fix GC run in foreground to not use executor

Since I3870cadb4, GC task was always delegated to an executor even when
background option was set to false. This was an issue because if more
than one GC object was instantiated and executed in parallel, only one GC
was actually running because of the single thread executor.

Change-Id: I8c587d22d63c1601b7d75914692644a385cd86d6
Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 34/126634/2
David Pursehouse [Fri, 27 Jul 2018 07:22:51 +0000 (08:22 +0100)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Prepare 4.7.3-SNAPSHOT builds
  JGit v4.7.2.201807261330-r
  Delete all loose refs empty directories
  Use java.nio to delete path to get detailed errors
  GC: Remove empty references folders
  Do not ignore path deletion errors

Change-Id: Iadc8275fbaa3d6f7d08a96ab66d49f392f6aab78
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPrepare 4.7.3-SNAPSHOT builds 85/126685/1
Matthias Sohn [Thu, 26 Jul 2018 23:00:35 +0000 (01:00 +0200)]
Prepare 4.7.3-SNAPSHOT builds

Change-Id: I5c437f45d5bc469e3c32bef1180c127d96d24d23
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.7.2.201807261330-r 75/126675/1 v4.7.2.201807261330-r
Matthias Sohn [Thu, 26 Jul 2018 17:28:38 +0000 (19:28 +0200)]
JGit v4.7.2.201807261330-r

Change-Id: I0d8c7ca756e6236e315c91da000fe8103ce83d05
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoDelete all loose refs empty directories 55/125755/4
Luca Milanesio [Sat, 7 Jul 2018 22:35:20 +0000 (23:35 +0100)]
Delete all loose refs empty directories

Remove completely the empty directories under refs/<namespace>
including the first level partition of the changes, when they are
completely empty.

Bug: 536777
Change-Id: I88304d34cc42435919c2d1480258684d993dfdca
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUse java.nio to delete path to get detailed errors 54/125754/4
Luca Milanesio [Sat, 7 Jul 2018 22:09:36 +0000 (23:09 +0100)]
Use java.nio to delete path to get detailed errors

Get the full IOException of the reason why a directory
cannot be removed during GC.

Change-Id: Ia555bce009fa48087a73d677f1ce3b9c0b685b57
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoGC: Remove empty references folders 47/125747/4
Hector Caballero [Mon, 5 Feb 2018 13:58:46 +0000 (08:58 -0500)]
GC: Remove empty references folders

After packaging references, the folders containing these references are
not deleted. In a busy repository, this causes operations to slow down
as traversing the references tree becomes longer.

Delete empty reference folders after the loose references have been
packed.
To avoid deleting a folder that was just created by another concurrent
operation, only delete folders that were not modified in the last 30
seconds.

Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com>
Change-Id: Ie79447d6121271cf5e25171be377ea396c7028e0
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDo not ignore path deletion errors 67/125767/1
Luca Milanesio [Sun, 8 Jul 2018 22:41:00 +0000 (23:41 +0100)]
Do not ignore path deletion errors

Log as warning when an attempt to remove a directory
fails. This helps troubleshooting some bugs like the GC leaving
behind empty directories.

Change-Id: Idb94ce17f8be9668a970c7ecae31436bf434073c
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 82/125482/1
David Pursehouse [Wed, 4 Jul 2018 05:08:56 +0000 (14:08 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  ResolveMerger: Fix encoding with string; use bytes

Change-Id: If17328fbd101d596a8a16d9c4a190e9b6e120902
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoResolveMerger: Fix encoding with string; use bytes 60/124860/1
Marco Miller [Thu, 21 Jun 2018 18:18:48 +0000 (14:18 -0400)]
ResolveMerger: Fix encoding with string; use bytes

This change fixes the issue [1]. Before this fix, a merge involving
the caching of consecutive yet similar filenames with Norwegian
characters [2] used to throw an IllegalStateException: Duplicate
stages not allowed. This was caused by inaccurate decoding of the
filenames, using string values assuming default encoding. In the
toString method of DirCacheEntry, used before through getPathString,
UTF-8 encoding is used, but the end result becomes default encoding,
through Object's default toString usage. The special characters in
those two consecutive (particular) filenames [2] were becoming the
very same decoded /single character, lending consecutive -but then
identical- filenames. Thus the perceived duplicate 0-staging of the
file(s).

Replace getPathString usage with getRawPath for this specific case,
or use byte array representations of cached entries instead of string.

Adding a test for this change is not possible, as there is no known
way to change the default encoding for filenames such as [2] (e.g.).
JGitTestUtil does write file contents through UTF-8, but encoding like
so does not apply to the actual file name. Hence there is no way to
create files with names properly made of special characters such as
[2]'s. And the test that is necessary for this case assumes such
Norwegian (or similar characters) filenames. Changing the default
locale programmatically in a test has no effect either. And changing
the LANG value passed to the JVM is only possible upon starting it.

[1] https://bugs.chromium.org/p/gerrit/issues/detail?id=9153

[2] <=>
(...)
"a/b/SíÒr-Norge.map",
"a/b/Sør-Norge.map",
(...)

Change-Id: Ib9f2f5297932337c9817064cc09d9f774dd168f4
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 58/124758/1
David Pursehouse [Wed, 20 Jun 2018 07:07:48 +0000 (16:07 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: I016c9b3ec0081542bb903f361d9a3af1ea746ae3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.6' into stable-4.7 57/124757/1
David Pursehouse [Wed, 20 Jun 2018 07:06:44 +0000 (16:06 +0900)]
Merge branch 'stable-4.6' into stable-4.7

* stable-4.6:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: Idc653c22a9af2013a4c481bb19ca8d059f5c34d0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.5' into stable-4.6 38/124738/1
David Pursehouse [Tue, 19 Jun 2018 12:41:05 +0000 (21:41 +0900)]
Merge branch 'stable-4.5' into stable-4.6

* stable-4.5:
  Temporarily @Ignore flaky CommitCommandTest methods

Change-Id: I2a0e0b63a06f442f5a088d4bc8bb08eaf02ce952
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTemporarily @Ignore flaky CommitCommandTest methods 32/124732/1
Dave Borowitz [Fri, 7 Jul 2017 18:43:57 +0000 (14:43 -0400)]
Temporarily @Ignore flaky CommitCommandTest methods

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

6 years agoMerge branch 'stable-4.7' into stable-4.8 99/122399/1
Matthias Sohn [Thu, 10 May 2018 10:08:46 +0000 (12:08 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Retry stale file handles on .git/config file

Change-Id: Ib665c094b28eefb8236752bb273de0c2d9bf9578

6 years agoMerge branch 'stable-4.6' into stable-4.7 98/122398/1
Matthias Sohn [Thu, 10 May 2018 09:59:56 +0000 (11:59 +0200)]
Merge branch 'stable-4.6' into stable-4.7

* stable-4.6:
  Retry stale file handles on .git/config file

Change-Id: If5a21d38224528edfc551b3216daca6a2582e3ac

6 years agoMerge branch 'stable-4.5' into stable-4.6 95/122395/1
Matthias Sohn [Thu, 10 May 2018 09:39:52 +0000 (11:39 +0200)]
Merge branch 'stable-4.5' into stable-4.6

* stable-4.5:
  Retry stale file handles on .git/config file

Change-Id: Ib6e6ec0846c3ef261ec1016bfa6d26d2eadc3f26

6 years agoRetry stale file handles on .git/config file 73/120973/4
Nasser Grainawi [Fri, 6 Apr 2018 20:05:37 +0000 (14:05 -0600)]
Retry stale file handles on .git/config file

On a local non-NFS filesystem the .git/config file will be orphaned if
it is replaced by a new process while the current process is reading the
old file. The current process successfully continues to read the
orphaned file until it closes the file handle.

Since NFS servers do not keep track of open files, instead of orphaning
the old .git/config file, such a replacement on an NFS filesystem will
instead cause the old file to be garbage collected (deleted).  A stale
file handle exception will be raised on NFS clients if the file is
garbage collected (deleted) on the server while it is being read.  Since
we no longer have access to the old file in these cases, the previous
code would just fail. However, in these cases, reopening the file and
rereading it will succeed (since it will open the new replacement file).
Since retrying the read is a viable strategy to deal with stale file
handles on the .git/config file, implement such a strategy.

Since it is possible that the .git/config file could be replaced again
while rereading it, loop on stale file handle exceptions, up to 5 extra
times, trying to read the .git/config file again, until we either read
the new file, or find that the file no longer exists. The limit of 5 is
arbitrary, and provides a safe upper bounds to prevent infinite loops
consuming resources in a potential unforeseen persistent error
condition.

Change-Id: I6901157b9dfdbd3013360ebe3eb40af147a8c626
Signed-off-by: Nasser Grainawi <nasser@codeaurora.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.7' into stable-4.8 28/112128/2
Matthias Sohn [Wed, 22 Nov 2017 22:25:49 +0000 (23:25 +0100)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Silence boxing warning
  Prepare 4.5.5-SNAPSHOT builds
  JGit v4.5.4.201711221230-r
  Fix LockFile semantics when running on NFS
  Honor trustFolderStats also when reading packed-refs
  Prepare 4.5.4-SNAPSHOT builds
  JGit v4.5.3.201708160445-r

Change-Id: Iaa99ec84594baf733c993c2d6768281ff14f545a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.6' into stable-4.7 26/112126/1
Matthias Sohn [Wed, 22 Nov 2017 22:06:50 +0000 (23:06 +0100)]
Merge branch 'stable-4.6' into stable-4.7

* stable-4.6:
  Silence boxing warning
  Prepare 4.5.5-SNAPSHOT builds
  JGit v4.5.4.201711221230-r
  Fix LockFile semantics when running on NFS
  Honor trustFolderStats also when reading packed-refs
  Prepare 4.5.4-SNAPSHOT builds
  JGit v4.5.3.201708160445-r

Change-Id: I8f6bc09540727c6273d22775a9f9ca382a729c9b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoSilence boxing warning 17/112117/1
Matthias Sohn [Wed, 22 Nov 2017 20:34:37 +0000 (21:34 +0100)]
Silence boxing warning

Change-Id: I36c40eb91ce0c51f89b47911fa14beffcbc0a7cd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.5' into stable-4.6 16/112116/1
Matthias Sohn [Wed, 22 Nov 2017 20:34:08 +0000 (21:34 +0100)]
Merge branch 'stable-4.5' into stable-4.6

* stable-4.5:
  Prepare 4.5.5-SNAPSHOT builds
  JGit v4.5.4.201711221230-r
  Fix LockFile semantics when running on NFS
  Honor trustFolderStats also when reading packed-refs
  Prepare 4.5.4-SNAPSHOT builds
  JGit v4.5.3.201708160445-r

Change-Id: Ie9c8e0d9172c8d53f075c284bf2a9677980d8dfb
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 4.5.5-SNAPSHOT builds 06/112106/1
Matthias Sohn [Wed, 22 Nov 2017 18:27:22 +0000 (19:27 +0100)]
Prepare 4.5.5-SNAPSHOT builds

Change-Id: I71f946f2875716670a2d74c21a8ab38a1f53a25c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.5.4.201711221230-r 96/112096/1 v4.5.4.201711221230-r
Matthias Sohn [Wed, 22 Nov 2017 17:31:24 +0000 (18:31 +0100)]
JGit v4.5.4.201711221230-r

Change-Id: Ia1079da239c5b3fde1ba8d2acc4e465a46297b4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix LockFile semantics when running on NFS 16/112016/9
Christian Halstrick [Tue, 14 Nov 2017 16:08:56 +0000 (17:08 +0100)]
Fix LockFile semantics when running on NFS

When running on NFS there was a chance that JGits LockFile
semantic is broken because File#createNewFile() may allow
multiple clients to create the same file in parallel. This
change provides a fix which is only used when the new config
option core.supportsAtomicCreateNewFile is set to false. The
default for this option is true. This option can only be set in the
global or the system config file. The repository config file is not
taken into account in this case.

If the config option core.supportsAtomicCreateNewFile is true
then File#createNewFile() is trusted and the behaviour doesn't
change.

But if core.supportsAtomicCreateNewFile is set to false then after
successful creation of the lock file a hardlink to that lock file is
created and the attribute nlink of the lock file is checked to be 2. If
multiple clients manage to create the same lock file nlink would be
greater than 2 showing the error.

This expensive workaround is described in
 https://www.time-travellers.org/shane/papers/NFS_considered_harmful.html
section III.d) "Exclusive File Creation"

Change-Id: I3d2cc48d8eb280d5f7039eb94da37804f903be6a

6 years agoHonor trustFolderStats also when reading packed-refs 15/112015/1
Christian Halstrick [Tue, 14 Nov 2017 16:20:02 +0000 (17:20 +0100)]
Honor trustFolderStats also when reading packed-refs

Then list of packed refs was cached in RefDirectory based on mtime of
the packed-refs file. This may fail on NFS when attributes are cached.
A cached mtime of the packed-refs file could cause JGit to trust the
cached content of this file and to overlook that the file is modified.

Honor the config option trustFolderStats and always read the packed-refs
content if the option is false. By default this option is set to true
and this fix is not active.

Change-Id: I2b65cfaa8f4aba2efbf8a5e865d3f09f927e2eec

7 years agoPrepare 4.5.4-SNAPSHOT builds 27/103727/1
Matthias Sohn [Sat, 26 Aug 2017 06:08:46 +0000 (08:08 +0200)]
Prepare 4.5.4-SNAPSHOT builds

Change-Id: Id8b902bf2bf590b41f2e246c5ecf1592e1c411f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoJGit v4.5.3.201708160445-r 47/103147/1 v4.5.3.201708160445-r
Matthias Sohn [Wed, 16 Aug 2017 08:42:27 +0000 (10:42 +0200)]
JGit v4.5.3.201708160445-r

Change-Id: I2d57144976e3683e180d3a42edc6c3bf2905e87c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'stable-4.7' into stable-4.8 76/103076/2
Matthias Sohn [Mon, 14 Aug 2017 22:07:23 +0000 (00:07 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Update Oxygen Orbit p2 repository to R20170516192513
  Fix exception handling for opening bitmap index files

Change-Id: I1e4fcf84506ff4316567bbb1713e84d8d196c2a1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'stable-4.6' into stable-4.7 75/103075/2
Matthias Sohn [Mon, 14 Aug 2017 21:50:52 +0000 (23:50 +0200)]
Merge branch 'stable-4.6' into stable-4.7

* stable-4.6:
  Update Oxygen Orbit p2 repository to R20170516192513
  Fix exception handling for opening bitmap index files

Change-Id: I669fe48ce0034f9ea1977d38ee39099497422c1c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'stable-4.5' into stable-4.6 74/103074/2
Matthias Sohn [Mon, 14 Aug 2017 21:37:44 +0000 (23:37 +0200)]
Merge branch 'stable-4.5' into stable-4.6

* stable-4.5:
  Fix exception handling for opening bitmap index files

Change-Id: Ifb511238e3e98b1bc9f79a990807b940a17ebaa6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoUpdate Oxygen Orbit p2 repository to R20170516192513 80/103080/1
Matthias Sohn [Mon, 14 Aug 2017 21:37:21 +0000 (23:37 +0200)]
Update Oxygen Orbit p2 repository to R20170516192513

Change-Id: I7f1b733ca414d77c9df5572df02e742e0a84ba2f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoFix exception handling for opening bitmap index files 98/102598/3
Christian Halstrick [Mon, 7 Aug 2017 12:26:46 +0000 (14:26 +0200)]
Fix exception handling for opening bitmap index files

When creating a new PackFile instance it is specified whether this pack
has an associated bitmap index file or not. This information is cached
and the public method getBitmapIndex() will always assume a bitmap index
file must exist if the cached data tells so. But it may happen that the
packfiles are repacked during a gc in a different process causing the
packfile, bitmap-index and index file to be deleted. Since JGit still
has an open FileHandle on the packfile this file is not really deleted
and can still be accessed. But index and bitmap index file are deleted.
Fix getBitmapIndex() to invalidate the cached packfile instance if such
a situation occurs.

This problem showed up when a gerrit server was serving repositories
which where garbage collected with native git regularly. Fetch and
clone commands for certain repositories failed permanently after a
native git gc had deleted old bitmap index files.

Change-Id: I8e620bec74dd3f310ba42024f9a657062f868f0e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoPrepare 4.8.1-SNAPSHOT builds 89/99189/1
Matthias Sohn [Tue, 13 Jun 2017 02:19:30 +0000 (22:19 -0400)]
Prepare 4.8.1-SNAPSHOT builds

Change-Id: I7ca4186bbfe5ccc3fed4509a1fe4fc47bb2e8c50
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoJGit v4.8.0.201706111038-r 76/99076/1 v4.8.0.201706111038-r
Matthias Sohn [Sun, 11 Jun 2017 14:39:41 +0000 (16:39 +0200)]
JGit v4.8.0.201706111038-r

Change-Id: Ie33623a2191ffffc2ca5756fd078a7003c0c660f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoUse a dedicated executor to run auto-gc in command line interface 73/99073/2
Matthias Sohn [Sun, 11 Jun 2017 09:51:59 +0000 (11:51 +0200)]
Use a dedicated executor to run auto-gc in command line interface

WorkQueue uses daemon threads so auto-gc would not be executed after
short-lived commands run in command line. Hence use a dedicated executor
which we shutdown when the command finishes.

Change-Id: I0c2429ecfa04387389d159168ba78a020a696228
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoAllow to use an external ExecutorService for background auto-gc 70/99070/3
Matthias Sohn [Sat, 10 Jun 2017 23:20:34 +0000 (01:20 +0200)]
Allow to use an external ExecutorService for background auto-gc

If set use the external executor, otherwise use JGit's own simple
WorkQueue. Move WorkQueue to an internal package so we can reuse it
without exposing it in the public API.

Change-Id: I060d62ffd6692362a88b4bf13ee07b0dc857abe9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoFetch: Add --recurse-submodules and --no-recurse-submodules options 96/98396/7
David Pursehouse [Fri, 24 Mar 2017 01:26:44 +0000 (10:26 +0900)]
Fetch: Add --recurse-submodules and --no-recurse-submodules options

Add options to control recursion into submodules on fetch.

Add a callback interface on FetchCommand, to allow Fetch to display
an update "Fetching submodule XYZ" for each submodule.

Change-Id: Id805044b57289ee0f384b434aba1dbd2fd317e5b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoFix capitalization of command help summaries 71/99071/1
David Pursehouse [Sun, 11 Jun 2017 07:18:13 +0000 (16:18 +0900)]
Fix capitalization of command help summaries

Change-Id: Ibb245fdca5470efa6340af019b452dd17b01e9c2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoSubmoduleUpdateCommand#setCallback should return 'this' 61/99061/1
Matthias Sohn [Fri, 9 Jun 2017 22:58:23 +0000 (00:58 +0200)]
SubmoduleUpdateCommand#setCallback should return 'this'

The other methods in this class follow the builder pattern, and
return 'this', allowing multiple method calls to be chained in a
single statement.

Update the setCallback method to do the same.
Change-Id: I4ddaacd6d50601f47f61eb6be8b62c8d59cce062
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoCloneCommand#setCallback should return 'this' 93/98393/4
David Pursehouse [Thu, 1 Jun 2017 04:49:58 +0000 (13:49 +0900)]
CloneCommand#setCallback should return 'this'

The other methods in this class follow the builder pattern, and
return 'this', allowing multiple method calls to be chained in a
single statement.

Update the setCallback method to do the same.

Change-Id: I0366d28bf66ba47f08ee7eee636d613c9fe079f5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
7 years agoMerge branch 'stable-4.7' into stable-4.8 59/98959/1
Matthias Sohn [Thu, 8 Jun 2017 12:21:01 +0000 (14:21 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Prepare 4.7.2-SNAPSHOT builds

Change-Id: Icbbc642d37cc8261ed11d7e34548198ce2a003f4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoPrepare 4.7.2-SNAPSHOT builds 92/98892/1
Matthias Sohn [Thu, 8 Jun 2017 11:33:25 +0000 (13:33 +0200)]
Prepare 4.7.2-SNAPSHOT builds

Change-Id: I7c127bd402cd84c68d8f33a32c6aad093a2264c8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'stable-4.7' into stable-4.8 52/98852/2
David Pursehouse [Thu, 8 Jun 2017 00:03:25 +0000 (09:03 +0900)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  JGit v4.7.1.201706071930-r
  ArchiveCommand: Create prefix entry with commit time

Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Change-Id: Id4df76da84fde253ce04484f3437816dc145b4f2

7 years agoJGit v4.7.1.201706071930-r 53/98853/1 v4.7.1.201706071930-r
Matthias Sohn [Wed, 7 Jun 2017 23:19:38 +0000 (01:19 +0200)]
JGit v4.7.1.201706071930-r

Change-Id: I28cd8fbe995d76c8a00e7db6ddf826e983d89043
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'stable-4.7' into stable-4.8 18/98818/1
Matthias Sohn [Wed, 7 Jun 2017 14:58:18 +0000 (16:58 +0200)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Run auto GC in the background

Change-Id: I5e25765f65d833f13cbe99696ef33055d7f5c4cf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoArchiveCommand: Create prefix entry with commit time 78/98478/3
Yasuhiro Takagi [Sat, 29 Apr 2017 11:35:10 +0000 (20:35 +0900)]
ArchiveCommand: Create prefix entry with commit time

The cgit archive command creates a prefix (root) directory entry
in the archive file. That entry's time is set to the commit time.

This patch makes jgit's behavior consistent with with cgit:

prefix: hoge/     -> creates prefix directory "hoge/" entry.
prefix: hoge////  -> creates prefix directory "hoge/" entry.
prefix: hoge/foo  -> does not create prefix directory entry, but for
                     each file/directory entry, prefix is added.

Change-Id: I2610e40ce37972c5f7456fdca6337e7fb07176e5
Signed-off-by: Yasuhiro Takagi <ytakagi@bea.hi-ho.ne.jp>
7 years agoRun auto GC in the background 74/98474/2
David Turner [Wed, 8 Feb 2017 20:07:18 +0000 (15:07 -0500)]
Run auto GC in the background

When running an automatic GC on a FileRepository, when the caller
passes a NullProgressMonitor, run the GC in a background thread. Use a
thread pool of size 1 to limit the number of background threads spawned
for background gc in the same application. In the next minor release we
can make the thread pool configurable.

In some cases, the auto GC limit is lower than the true number of
unreachable loose objects, so auto GC will run after every (e.g) fetch
operation.  This leads to the appearance of poor fetch performance.
Since these GCs will never make progress (until either the objects
become referenced, or the two week timeout expires), blocking on them
simply reduces throughput.

In the event that an auto GC would make progress, it's still OK if it
runs in the background. The progress will still happen.

This matches the behavior of regular git.

Git (and now jgit) uses the lock file for gc.log to prevent simultaneous
runs of background gc. Further, it writes errors to gc.log, and won't
run background gc if that file is present and recent. If gc.log is too
old (according to the config gc.logexpiry), it will be ignored.

Change-Id: I3870cadb4a0a6763feff252e6eaef99f4aa8d0df
Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoUpdate Orbit to the Oxygen version R20170516192513 70/98270/1
Matthias Sohn [Sun, 28 May 2017 22:05:45 +0000 (00:05 +0200)]
Update Orbit to the Oxygen version R20170516192513

Change-Id: I13575c77540149d383747a34754ac338ed60fb52
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge branch 'master' into stable-4.8 97/98197/1
Matthias Sohn [Tue, 30 May 2017 11:01:53 +0000 (13:01 +0200)]
Merge branch 'master' into stable-4.8

* master:
  Fix out-of-bounds exception in RepoCommand#relative
  Fix null return from FS.readPipe when command fails to launch
  RenameDetector: Clarify rename limits <= 0
  Remove unnecessary cast for DfsReader
  Allow DfsReader to be subclassed
  Track read IO for DfsReader
  Fix javadoc of TooLargeObjectInPackException
  Exclude refs/tags from bitmap commit selection

Change-Id: I9cd20ded108d2e5d81fa1f0c2cb9aa0eabe1f256

7 years agoFix out-of-bounds exception in RepoCommand#relative 80/97680/3
Han-Wen Nienhuys [Mon, 22 May 2017 12:48:39 +0000 (14:48 +0200)]
Fix out-of-bounds exception in RepoCommand#relative

Change-Id: I9c91aa2ff037bff27a8131fba54be22f5f27d80d
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoFix null return from FS.readPipe when command fails to launch 09/97709/3
Bryan Donlan [Mon, 22 May 2017 18:37:14 +0000 (11:37 -0700)]
Fix null return from FS.readPipe when command fails to launch

When a command invoked from readPipe fails to launch (i.e. the exec call
fails due to a missing command executable), Process.start() throws,
which gets caught by the generic IOException handler, resulting in a
null return. This change detects this case and rethrows a
CommandFailedException instead.

Additionally, this change uses /bin/sh instead of bash for its posix
command failure test, to accomodate building in environments where bash
is unavailable.

Change-Id: Ifae51e457e5718be610c0a0914b18fe35ea7b008
Signed-off-by: Bryan Donlan <bdonlan@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoRenameDetector: Clarify rename limits <= 0 78/97878/1
Dave Borowitz [Wed, 24 May 2017 13:26:40 +0000 (09:26 -0400)]
RenameDetector: Clarify rename limits <= 0

Change-Id: I8da386e02272316b8e5e5c2f31ce10ad98bcdb28

7 years agoRemove unnecessary cast for DfsReader 04/97704/1
Zhen Chen [Mon, 22 May 2017 17:26:27 +0000 (10:26 -0700)]
Remove unnecessary cast for DfsReader

Change-Id: I22aaccfc9d589750f9d1d711b655dd0fd543fa57
Signed-off-by: Zhen Chen <czhen@google.com>
7 years agoMerge "Fix javadoc of TooLargeObjectInPackException"
David Pursehouse [Mon, 22 May 2017 05:12:10 +0000 (01:12 -0400)]
Merge "Fix javadoc of TooLargeObjectInPackException"

7 years agoAllow DfsReader to be subclassed 08/97608/1
Shawn Pearce [Fri, 19 May 2017 20:47:10 +0000 (13:47 -0700)]
Allow DfsReader to be subclassed

Necessary if a DFS implementation wants to override close()
to record DfsReaderIoStats.

Change-Id: I144575f9bf1abf2c1fd72030550c4f0795fcf44d

7 years agoTrack read IO for DfsReader 03/97603/1
Shawn Pearce [Fri, 19 May 2017 19:23:02 +0000 (12:23 -0700)]
Track read IO for DfsReader

Compute how much disk IO a DfsReader is performing, and how long the
sum of those operations took on this reader instance. Implementations
of DFS and interested applications can get the stats by calling the
new DfsReader.getIoStats() method at or after close().

Change-Id: If585741301f29182617933d6406d4a70497f2ca7

7 years agoFix javadoc of TooLargeObjectInPackException 43/97543/1
Matthias Sohn [Fri, 19 May 2017 09:22:05 +0000 (11:22 +0200)]
Fix javadoc of TooLargeObjectInPackException

The API exception should have the same javadoc like the internal
exception org.eclipse.jgit.errors.TooLargeObjectInPackException

Change-Id: Ia7508c77609e53c8e808412ac523a93194648e49
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
7 years agoMerge "Exclude refs/tags from bitmap commit selection"
Terry Parker [Thu, 18 May 2017 22:35:40 +0000 (18:35 -0400)]
Merge "Exclude refs/tags from bitmap commit selection"

7 years agoExclude refs/tags from bitmap commit selection 04/97404/7
Terry Parker [Thu, 18 May 2017 08:30:14 +0000 (01:30 -0700)]
Exclude refs/tags from bitmap commit selection

Commit db77610 ensured that all refs/tags commits are added to the
primary GC pack. It did that by adding all of the refs/tags commits
to the primary GC pack PackWriter's "interesting" object set.

Unfortunately, all commit objects in the "interesting" set are
selected as commits for which bitmap indices will be built. In a
repository like chromium with lots of tags, this changed the number of
bitmaps created from <700 to >10000. That puts huge memory pressure on
the GC task.

This change restores the original behavior of ignoring tags when
selecting commits for bitmaps.

In the "uninteresting" set, commits for refs/heads and refs/tags for
unannotated tags can not be differentiated. We instead identify
refs/tags commits by passing their ObjectIds as a new "noBitmaps"
parameter to the PackWriter.preparePack() methods.
PackWriterBitmapPreparer.setupTipCommitBitmaps() can then use that
"noBitmaps" parameter to exclude those commits.

Change-Id: Icd287c6b04fc1e48de773033fe432a9b0e904ac5
Signed-off-by: Terry Parker <tparker@google.com>