]> source.dussan.org Git - jgit.git/log
jgit.git
5 years agoSmartClientSmartServerTest: Stop using deprecated Repository#hasObject 95/135395/1
David Pursehouse [Sun, 20 Jan 2019 06:04:53 +0000 (15:04 +0900)]
SmartClientSmartServerTest: Stop using deprecated Repository#hasObject

Change-Id: I75d1105934aeaac89476603e15cf642a65a3acbe
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoDumbClientSmartServerTest: Open TestRepository in try-with-resource 94/135394/1
David Pursehouse [Sun, 20 Jan 2019 06:00:08 +0000 (15:00 +0900)]
DumbClientSmartServerTest: Open TestRepository in try-with-resource

Change-Id: Ica172a85ec9b7da1416ff1b22699809f2c8c9df7
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoDumbClientDumbServerTest: Open TestRepository in try-with-resource 93/135393/1
David Pursehouse [Sun, 20 Jan 2019 05:58:35 +0000 (14:58 +0900)]
DumbClientDumbServerTest: Open TestRepository in try-with-resource

Change-Id: Iaf339ae739689d4528a079776d6e945ba9006368
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoDirCacheCheckoutTest: Open TestRepository in try-with-resource 92/135392/1
David Pursehouse [Sun, 20 Jan 2019 05:54:14 +0000 (14:54 +0900)]
DirCacheCheckoutTest: Open TestRepository in try-with-resource

Change-Id: Iaf18ce230d6bf9b8bcb1895dd1bd3e4eb267de10
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoHttpTestCase#fsck: Open TestRepository in try-with-resource 91/135391/1
David Pursehouse [Sun, 20 Jan 2019 05:42:42 +0000 (14:42 +0900)]
HttpTestCase#fsck: Open TestRepository in try-with-resource

Change-Id: Ibda8c9970322871abf0fcf1244977bed04eaedd2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoCheckoutCommandTest: Add comment to document intentionally empty catch block 90/135390/1
David Pursehouse [Sun, 20 Jan 2019 05:39:52 +0000 (14:39 +0900)]
CheckoutCommandTest: Add comment to document intentionally empty catch block

Change-Id: I5156c3c2de67be015ef1d785fcf6084919765635
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agopgm: Fix missing braces in Describe.run() 88/135388/1
Matthias Sohn [Sun, 20 Jan 2019 00:46:21 +0000 (01:46 +0100)]
pgm: Fix missing braces in Describe.run()

Change-Id: I09e777fd4e77869952d2614ac2cde508b96d61e2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Handle exceptions in Describe command 09/135309/2
Matthias Sohn [Sun, 20 Jan 2019 00:45:38 +0000 (01:45 +0100)]
pgm: Handle exceptions in Describe command

This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Ic5d9d94c4a451f300fb7ad3f71b3e22db9a2c181
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Handle exceptions in Config command 08/135308/2
Matthias Sohn [Thu, 17 Jan 2019 23:15:32 +0000 (00:15 +0100)]
pgm: Handle exceptions in Config command

This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed. Also
externalize error message.

Change-Id: I909dc77385a672d8298053b12683c0cbbf9f2aa2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Fix too wide lines in Commit.run() 87/135387/1
Matthias Sohn [Sun, 20 Jan 2019 00:38:36 +0000 (01:38 +0100)]
pgm: Fix too wide lines in Commit.run()

Change-Id: I695d1771b808217b0fbde29805e53a819d8c3303
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Fix missing braces in Commit.run() 86/135386/1
Matthias Sohn [Sun, 20 Jan 2019 00:30:24 +0000 (01:30 +0100)]
pgm: Fix missing braces in Commit.run()

Change-Id: Ia9e7e846ba1abfdb490896e5bcb82e2c0039439c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Handle exceptions in Commit command 07/135307/2
Matthias Sohn [Sun, 20 Jan 2019 00:27:57 +0000 (01:27 +0100)]
pgm: Handle exceptions in Commit command

This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Idf5325bcc235fbcf4418239a1d49572409576a7d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Handle exceptions in Clean command 02/135202/3
Matthias Sohn [Wed, 16 Jan 2019 23:31:58 +0000 (00:31 +0100)]
pgm: Handle exceptions in Clean command

This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: Ic06bf16c9bfc79753a9ec767f8030a12887df168
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Handle GitAPIException in Fetch command 01/135201/3
Matthias Sohn [Wed, 16 Jan 2019 17:02:39 +0000 (18:02 +0100)]
pgm: Handle GitAPIException in Fetch command

This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I043838143df7280351186ee1bcca4d1cc4832257
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix missing braces in Branch.run() 85/135385/1
Matthias Sohn [Sun, 20 Jan 2019 00:19:45 +0000 (01:19 +0100)]
Fix missing braces in Branch.run()

Change-Id: Ie8a757552846d2454017a95e20dc14fdf6a93982
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Handle exceptions in Branch command 00/135200/3
Matthias Sohn [Sun, 20 Jan 2019 00:17:10 +0000 (01:17 +0100)]
pgm: Handle exceptions in Branch command

This avoids we show a stacktrace on the console by default when one of
the expected exceptions is thrown during the run method is executed.

Change-Id: Ib07cc8dd26b45b62de1d77739380eb36833082f1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix missing braces in Blame.run() 06/135306/2
Matthias Sohn [Thu, 17 Jan 2019 22:50:01 +0000 (23:50 +0100)]
Fix missing braces in Blame.run()

Change-Id: I32a0e973bc73e85a67e975b728b425c148059b81
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Handle NoWorkTreeException and IOException in Blame command 99/135199/3
Matthias Sohn [Wed, 16 Jan 2019 17:04:55 +0000 (18:04 +0100)]
pgm: Handle NoWorkTreeException and IOException in Blame command

This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I9290b057b004e9ee4137d968ba4f5759442aacb6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUse try-with-resource for reader in Blame.run() 05/135305/1
Matthias Sohn [Thu, 17 Jan 2019 22:30:29 +0000 (23:30 +0100)]
Use try-with-resource for reader in Blame.run()

Change-Id: I115aa9854fefeccc2348686e6377b30413911c17
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agopgm: Handle GitAPIException in Add command 98/135198/1
Matthias Sohn [Wed, 16 Jan 2019 17:02:07 +0000 (18:02 +0100)]
pgm: Handle GitAPIException in Add command

This avoids we show a stacktrace on the console by default when this
type of exception is thrown during the run method is executed.

Change-Id: I02940bdc1645c1d5e0abeeb4f1bafde1b8c54a1c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoImplement signing commits using BouncyCastle 17/133417/31
Medha Bhargav Prabhala [Mon, 3 Dec 2018 19:13:27 +0000 (20:13 +0100)]
Implement signing commits using BouncyCastle

This also includes a change to generating the jgit CLI jar. Shading is
no longer possible because it breaks the signature of BouncyCastle.
Instead, the Spring Boot Loader Maven plug-in is now used to generate an
executable jar.

Bug: 382212
Change-Id: I35ee3d4b06d9d479475ab2e51b29bed49661bbdc
Also-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Signed-off-by: Medha Bhargav Prabhala <mprabhala@salesforce.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoAdd signing options to commit CLI 03/133403/14
Medha Bhargav Prabhala [Sun, 2 Dec 2018 19:54:54 +0000 (20:54 +0100)]
Add signing options to commit CLI

Bug: 382212
Change-Id: I02194fc566dd5baa963424b1bac78607964436a3
Also-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
Signed-off-by: Medha Bhargav Prabhala <mprabhala@salesforce.com>
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
5 years agoAllow CommitCommand to sign commits 02/133402/14
Gunnar Wagenknecht [Wed, 5 Dec 2018 19:39:07 +0000 (20:39 +0100)]
Allow CommitCommand to sign commits

This change introduces the concept of a GpgSigner which will sign
commits. The GpgSigner will be of a specific implementation (eg.,
Bouncycastle or OpenPgP executable). The actual implementation is not
part of this change.

Bug: 382212
Change-Id: Iea5da1e885c039e06bc8d679d46b124cbe504c8e
Also-by: Medha Bhargav Prabhala <mprabhala@salesforce.com>
Signed-off-by: Medha Bhargav Prabhala <mprabhala@salesforce.com>
Signed-off-by: Gunnar Wagenknecht <gunnar@wagenknecht.org>
5 years agopgm: propagate generic exceptions when throwing Die exception 43/135143/2
Matthias Sohn [Wed, 16 Jan 2019 00:13:38 +0000 (01:13 +0100)]
pgm: propagate generic exceptions when throwing Die exception

If a command is stopped by throwing a Die exception since a generic
exception was caught this exception contains additional information
which is not available in the error message. Hence chain it to the Die
exception in order to allow printing a complete stacktrace including
causes to the error stream of the JGit command line by adding option
--show-stack-trace, e.g.

$ jgit --show-stack-trace commit -m "test"

Change-Id: I7ad8c56b997ab60d2bd08f4e7b4d0b80c84021c3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate Eclipse Java compiler 07/135007/2
Matthias Sohn [Sat, 12 Jan 2019 22:06:37 +0000 (23:06 +0100)]
Update Eclipse Java compiler

Update
- orb.eclipse.jdt:ecj to 3.16.0
- plexus-compiler-eclipse to 2.8.5

Change-Id: I56d6d57c4c49646a9c98d2d1ca01b1b1d92280cf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUpdate Jetty to 9.4.14 06/135006/2
Matthias Sohn [Sat, 12 Jan 2019 22:02:11 +0000 (23:02 +0100)]
Update Jetty to 9.4.14

Change-Id: I255d4d03a35bf7701b021339623dfb8c28d24c35
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agodfs: Remove synchronization in BlockBasedFile#LazyChannel 55/135055/2
Jonathan Nieder [Mon, 14 Jan 2019 18:48:06 +0000 (10:48 -0800)]
dfs: Remove synchronization in BlockBasedFile#LazyChannel

As explained in 'The "Double-Checked Locking is Broken"
Declaration'[*], Java's memory model does not support double-checked
locking:

 class LazyReadableChannel {
   private ReachableChannel rc = null;

   public ReadableChannel get() {
     if (rc == null) {
       synchronized (this) {
         if (rc == null) {
           rc = new ReadableChannel();
 }
       }
     }
     return rc;
   }
 }

With JDK 5 and newer, there is a formal memory model that ensures this
works if "rc" is volatile, but it is still not thread-safe without
that.

Fortunately, this ReadableChannelSupplier is never passed between
threads, so it does not need to be thread-safe.  Simplify by removing
the synchronization.

[*] https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

Change-Id: I0698ee6618d734fc129dd4f63fc047c1c17c94a9
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoUploadPack: Read wanted refs in one shot 72/134972/3
Jonathan Nieder [Fri, 11 Jan 2019 17:45:01 +0000 (09:45 -0800)]
UploadPack: Read wanted refs in one shot

This allows scanning through refs once instead of once per ref, which
should make the lookup less expensive for some RefDatabase
implementations.

Change-Id: I1434f834186cc9a6b4e52659e692b1000c926995
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoMerge branch 'stable-5.2' 27/134927/2
Jonathan Nieder [Fri, 11 Jan 2019 04:23:33 +0000 (20:23 -0800)]
Merge branch 'stable-5.2'

* stable-5.2:
  Prepare 5.2.2-SNAPSHOT builds
  JGit v5.2.1.201812262042-r
  Prepare 5.1.6-SNAPSHOT builds
  JGit v5.1.5.201812261915-r
  UploadPack: Filter refs used for deepen-not resolution
  UploadPack: Avoid calling AdvertiseRefsHook twice
  Prepare 5.1.5-SNAPSHOT builds
  JGit v5.1.4.201812251853-r
  UploadPack: Filter refs used for want-ref resolution
  UploadPack: Defer want-ref resolution to after parsing
  Call AdvertiseRefsHook for protocol v2
  Prepare 4.11.7-SNAPSHOT builds
  JGit v4.11.6.201812241910-r
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: Ia56348e54d62630d7c50a4747df89516fc5afad9
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoBazel: Automatically format build file with buildifier 0.20.0 67/134867/2
David Pursehouse [Thu, 10 Jan 2019 07:32:17 +0000 (16:32 +0900)]
Bazel: Automatically format build file with buildifier 0.20.0

Version 0.20.0 of buildifier has a lint mode that can fix the
formatting issues automatically:

  buildifier --lint=fix

Apply this to BUILD files.

Change-Id: I1120a0f15771d0bbea4daa34037be0b860385389
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoMerge "Lazily open ReadableChannel in BlockBasedFile.getOrLoadBlock"
Terry Parker [Fri, 11 Jan 2019 00:01:57 +0000 (19:01 -0500)]
Merge "Lazily open ReadableChannel in BlockBasedFile.getOrLoadBlock"

5 years agoLazily open ReadableChannel in BlockBasedFile.getOrLoadBlock 60/134860/2
Minh Thai [Wed, 9 Jan 2019 20:53:51 +0000 (12:53 -0800)]
Lazily open ReadableChannel in BlockBasedFile.getOrLoadBlock

To avoid opening the readable channel in case of DfsBlockCache
hits. Also cleaning up typos around DfsBlockCache.

Change-Id: I615e349cb4838387c1e6743cdc384d1b81b54369
Signed-off-by: Minh Thai <mthai@google.com>
5 years agoMake TestRepository AutoCloseable 12/134912/1
Jackson Toeniskoetter [Thu, 10 Jan 2019 19:51:29 +0000 (11:51 -0800)]
Make TestRepository AutoCloseable

Currently, unit tests need to either close the Repository underlying a
TestRepository manually, or not close it at all. Both are error prone.

The TestRepository holds a reference to 4 AutoCloseable objects:
Repository, ObjectInserter, Git, and RevWalk. The last two can escape
the TestRepository scope, so they are not closed when TestRepository is
closed.

Change-Id: I4461bb9104d517bd6bef09c38507c7c2ef5c31d4
Signed-off-by: Jackson Toeniskoetter <jackdt@google.com>
5 years agoFix warnings for usage of deprecated RefDatabase#getRef 90/134590/4
Matthias Sohn [Tue, 1 Jan 2019 00:06:44 +0000 (01:06 +0100)]
Fix warnings for usage of deprecated RefDatabase#getRef

Change-Id: I22a244114ef973b3801cf3b639ff782f21c02f98
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoDfsBlockCache: Consolidate where ReadableChannel is opened 18/134218/10
Minh Thai [Tue, 18 Dec 2018 23:06:59 +0000 (15:06 -0800)]
DfsBlockCache: Consolidate where ReadableChannel is opened

Opening a readable channel can be expensive and the number of channels
can be limited in DFS. Ensure that caller of
BlockBasedFile.readOneBlock() is responsible for opening and closing
the file, and that the ReadableChannel is reused in the request. As a side
effect, this makes the code easier to read, with better use of
try-with-resources.

The downside is that this means a readable channel is always opened, even
when the entire pack is already available for copying from cache. This
should be an acceptable cost: it's rare enough not to overload the server
and from a client latency perspective, the latency cost is in the noise
relative to the data transfer cost involved in a clone. If this turns out
to be a problem in practice, we can reintroduce that optimization in a
followup change.

Change-Id: I340428ee4bacd2dce019d5616ef12339a0c85f0b
Signed-off-by: Minh Thai <mthai@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoDfsBlockCache to lock while loading object references 28/134428/15
Minh Thai [Sat, 22 Dec 2018 00:27:16 +0000 (16:27 -0800)]
DfsBlockCache to lock while loading object references

We see the same index being loaded by multiple threads. Each is
hundreds of MB and takes several seconds to load, causing server to
run out of memory.  This change introduces a lock to avoid these
duplicate works.  It uses a new set of locks similar in implementation
to the loadLocks for getOrLoad of blocks.  The locks are kept separate
to prevent long-running index loading from blocking out fast block
loading. The cache instance can be configured with a consumer to
monitor the wait time of the new locks.

Change-Id: I44962fe84093456962d5981545e3f7851ecb6e43
Signed-off-by: Minh Thai <mthai@google.com>
5 years agoFix "jgit checkout -f" to overwrite dirty worktree files 81/117181/9
Christian Halstrick [Mon, 12 Feb 2018 14:44:04 +0000 (15:44 +0100)]
Fix "jgit checkout -f" to overwrite dirty worktree files

CheckoutCommand had a setForce() method. But this didn't correspond
to native git's 'git checkout -f' option. Deprecate the old setForce()
method and move its implementation to a new method setForceRefUpdate()
and use it to implement the -B option in the CLI class Checkout.

Add a setForced() method and use it to fix the associated '-f' option of
the CLI Checkout class to behave like native git's 'git checkout -f'
which overwrites dirty worktree files during checkout.

This is still not fully matching native git's behavior: updating
additionally dirty index entries is not done yet.

Bug: 530771
Change-Id: I776b78eb623b6ea0aca42f681788f2e4b1667f15
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoReturn 'this' from setters in commands 08/134508/7
Mario Molina [Wed, 26 Dec 2018 09:48:05 +0000 (10:48 +0100)]
Return 'this' from setters in commands

To avoid breaking ABI, take the opportunity to give these setters
(hopefully sometimes better) names and deprecate their old names.

Change-Id: Ib45011678c3d941f8ecc1a1e0fdf4c09cdc337e3
Signed-off-by: Mario Molina <mmolimar@gmail.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoUpgrade wagon-ssh to 3.3.1 05/134705/2
David Pursehouse [Mon, 7 Jan 2019 09:18:21 +0000 (18:18 +0900)]
Upgrade wagon-ssh to 3.3.1

Change-Id: I7428e55302e673380b1ab024b5ee2fd71308b40f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoUpgrade spotbugs-maven-plugin to 3.1.10 95/134695/2
David Pursehouse [Mon, 7 Jan 2019 02:39:20 +0000 (11:39 +0900)]
Upgrade spotbugs-maven-plugin to 3.1.10

Change-Id: I800930d34491ae5568d47ccc59271b6ad4a24c3d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoDon't swallow IOException 71/134671/4
Jonathan Nieder [Sat, 5 Jan 2019 00:02:07 +0000 (16:02 -0800)]
Don't swallow IOException

Swallowing intermittent errors and trying to recover from them
makes JGit's behavior hard to predict and difficult to debug.

Propagate the errors instead.  This doesn't violate JGit's usual
backward compatibility promise for clients because in these
contexts an IOException indicates either repository corruption or
a true I/O error.  Let's consider these cases one at a time.

In the case of repository corruption, falling back e.g. to an empty
set of refs or a missing ref will not serve a caller well.  The
fallback does not indicate the nature of the corruption, so they are
not in a good place to recover from the error.  This is analogous to
Git, which attempts to provide sufficient support to recover from
corruption (by ensuring commands like "git branch -D" cope with
corruption) but little else.

In the case of an I/O error, the best we can do is to propagate the
error so that the user sees a dialog and has an opportunity to try
again.  As in the corruption case, the fallback behavior does not
provide enough information for a caller to rely on the current error
handling, and callers such as EGit already need to be able to handle
runtime exceptions.

To be conservative, keep the existing behavior for the deprecated
Repository#peel method.  In this example, the fallback behavior is to
return an unpeeled ref, which is distinguishable from the ref not
existing and should thus at least be possible to debug.

Change-Id: I0eb58eb8c77519df7f50d21d1742016b978e67a3
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoMerge "Deprecate Repository#hasObject"
Jonathan Nieder [Mon, 7 Jan 2019 18:46:36 +0000 (13:46 -0500)]
Merge "Deprecate Repository#hasObject"

5 years agoApache MINA sshd client: less aggressive key file name caching 31/134131/2
Thomas Wolf [Mon, 17 Dec 2018 12:02:19 +0000 (13:02 +0100)]
Apache MINA sshd client: less aggressive key file name caching

Don't use the ~/.ssh directory as cache key for the key provider
but the configured paths of the default keys. Otherwise changes
in that list of paths are not picked up.

This is in particular a problem for EGit, where the user can modify
this list of keys interactively in the preferences. Without this
change, Eclipse needs to be restarted to pick up such changes.

Bug: 542845
Change-Id: I63432fb10729a90b3c5e14f13e39bf482aef811b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
5 years agoDeprecate Repository#hasObject 72/134672/1
Jonathan Nieder [Sat, 5 Jan 2019 01:19:00 +0000 (17:19 -0800)]
Deprecate Repository#hasObject

Its implementation contains

} catch (IOException e) {
// Legacy API, assume error means "no"
return false;
}

Better to use ObjectDatabase#has, which throws IOException to report
errors.

Change-Id: I7de02f7ceb8f57b2a8ebdb16d2aa4376775ff933
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoCorrect target name for jgit-4.10-staging 68/134668/1
Dave Borowitz [Fri, 4 Jan 2019 23:06:23 +0000 (15:06 -0800)]
Correct target name for jgit-4.10-staging

Change-Id: I130c7f1420b6b3753f4d419a37d16633755da21c

5 years agoDeprecate RawParseUtils.UTF8-CHARSET 07/134607/3
Michael Keppler [Thu, 3 Jan 2019 06:57:02 +0000 (07:57 +0100)]
Deprecate RawParseUtils.UTF8-CHARSET

That constant is just a redirection to a java standard constant
meanwhile. It is not referenced anymore in jgit code (and egit is just
removing it). Clients can use the redirection target directly.

Change-Id: I058d013f61da8d7b771c499d8743aafb8faa5ea8
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix detection of "initial checkout" 34/132134/2
Christian Halstrick [Tue, 6 Nov 2018 16:56:15 +0000 (17:56 +0100)]
Fix detection of "initial checkout"

A checkout done directly after cloning (the "initial
checkout") has a different semantic as a default
checkout. That is defined in the documentation of
"git read-tree" [1]. JGit was detecting that it is
doing an initial checkout differently from native
git: jgit used to check that the index is empty
but native git required that the index file does
not exist [2]. Teach JGit to behave like native
git.

[1] https://github.com/git/git/blob/master/Documentation/git-read-tree.txt#L187
[2] https://marc.info/?t=154150811200001&r=1&w=2

Change-Id: I1dd0f1ede7cd7ea60d28607916d0165269a9f628

5 years agoUpgrade plexus-compiler-javac-errorprone to 2.8.5 69/134369/2
David Pursehouse [Fri, 21 Dec 2018 02:12:10 +0000 (11:12 +0900)]
Upgrade plexus-compiler-javac-errorprone to 2.8.5

Change-Id: I2898eef32472216a5fb33f5a036588dd022445cb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
5 years agoReplace deprecated FirstLine by FirstCommand 86/134586/2
Michael Keppler [Mon, 31 Dec 2018 07:31:09 +0000 (08:31 +0100)]
Replace deprecated FirstLine by FirstCommand

and allow package org.eclipse.jgit.http.server to use package
org.eclipse.jgit.internal.transport.parser.

Change-Id: Ief330c3e75a735853d0a5a265a9ff56fb5128b99
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMove BaseReceivePack#advertisedRefs getter and setter to ReceivePack 23/134523/7
Jonathan Nieder [Thu, 27 Dec 2018 00:11:07 +0000 (16:11 -0800)]
Move BaseReceivePack#advertisedRefs getter and setter to ReceivePack

Another step toward merging BaseReceivePack into ReceivePack.

Change-Id: If861e28ce512f556e574352fa7d4a0df0984693f
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMove BaseReceivePack#walk getter to ReceivePack 22/134522/6
Jonathan Nieder [Thu, 27 Dec 2018 00:05:34 +0000 (16:05 -0800)]
Move BaseReceivePack#walk getter to ReceivePack

Another step toward merging BaseReceivePack into ReceivePack.

Change-Id: I43cf2e36e2d5b0cd85bf23c81469909c14757b63
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMove BaseReceivePack#db getter to ReceivePack 21/134521/6
Jonathan Nieder [Wed, 26 Dec 2018 23:58:46 +0000 (15:58 -0800)]
Move BaseReceivePack#db getter to ReceivePack

Another step toward eliminating BaseReceivePack as a separate API.

Change-Id: If7b7d5c65a043607a2424211adb479fa33a9077b
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMove BaseReceivePack#pushCert getter and setter to ReceivePack 20/134520/6
Jonathan Nieder [Wed, 26 Dec 2018 23:59:36 +0000 (15:59 -0800)]
Move BaseReceivePack#pushCert getter and setter to ReceivePack

This is a first step toward eliminating the BaseReceivePack API.

Inspired by a larger change by Dan Wang <dwwang@google.com>.

Change-Id: I5c876a67d8db24bf808823d9ea44d991b1ce5277
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRemove unused API problem filters 73/134573/1
Matthias Sohn [Sat, 29 Dec 2018 10:55:02 +0000 (11:55 +0100)]
Remove unused API problem filters

Change-Id: I8ed98ac60362ba071506b0bdacd2941ab72b6bf4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoSilence API error for RefDatabase.getRef declared final 72/134572/1
Matthias Sohn [Sat, 29 Dec 2018 00:07:24 +0000 (01:07 +0100)]
Silence API error for RefDatabase.getRef declared final

RefDatabase.getRef was declared final in
c1954f6c366121f971699573322a2669c7dd9430
which only affects implementers.

Change-Id: I4c14232a119670d263d88db2b8d725dcdd36ab2a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoSuppress API errors and add missing @since tags caused by 6ea888a 45/134545/2
Matthias Sohn [Fri, 28 Dec 2018 02:18:58 +0000 (03:18 +0100)]
Suppress API errors and add missing @since tags caused by 6ea888a

Change-Id: Id042d46ba078af35b9c22a079da4ae14fc5fa231
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge changes Id3bb9443,I1be1948b
Jonathan Nieder [Fri, 28 Dec 2018 20:57:51 +0000 (15:57 -0500)]
Merge changes Id3bb9443,I1be1948b

* changes:
  RefDatabase: Introduce findRef synonym for getRef
  RefDirectory: Look up several exact refs in one shot

5 years agoMove first line parsing for v0 push out of BaseReceivePack 19/134519/6
Jonathan Nieder [Wed, 26 Dec 2018 23:36:39 +0000 (15:36 -0800)]
Move first line parsing for v0 push out of BaseReceivePack

This simplifies the BaseReceivePack class and decreases its API
surface, which should make merging with ReceivePack easier.

Inspired by 6aca8899a5c02b3f6be7b9196cf5e935914476f0 (Move first line
parsing for v0/v1 pack negotiation out of UploadPack, 2018-09-17).

Change-Id: I1fc175d15aa7cb5968c26fc83a95480403af617c

5 years agoRefDatabase: Introduce findRef synonym for getRef 70/49570/9
Jonathan Nieder [Thu, 12 Nov 2015 00:10:24 +0000 (16:10 -0800)]
RefDatabase: Introduce findRef synonym for getRef

Using findRef instead of getRef makes it clearer that the caller wants
to search for the ref in the search path, instead of looking for a ref
that exactly matches the input.

This change introduces the new findRef method and deprecates getRef.
It updates Repository#findRef to use the new method, ensuring some
test coverage.  Other callers will be updated in followup changes.

A nice side effect of introducing the new findRef method is that it is
final and based on firstExactRef, so implementers can focus on
implementing the latter efficiently and do not have to carefully write
custom path search code respecting SEARCH_PATH.

Change-Id: Id3bb944344a9743705fd1f20193ab679298fa51c
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoRefDirectory: Look up several exact refs in one shot 73/49573/5
Jonathan Nieder [Thu, 27 Dec 2018 04:33:55 +0000 (20:33 -0800)]
RefDirectory: Look up several exact refs in one shot

Override exactRef(String...) and firstExactRef(String...) with
implementations specific to FileRepository.

The specialized implementations are similar to the generic ones from
RefDatabase, but because these use readRef directly instead of
exactRef, they only need to call fireRefsChanged once.

This will allow replacing RefDirectory#getRef with a generic
implementation that uses firstExactRef without hurting performance.

Change-Id: I1be1948bd6121c1a1e8152e201aab97e7fb308bb
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoRefDirectory: Do not use search path to find additional refs 72/49572/6
Jonathan Nieder [Wed, 11 Nov 2015 23:50:39 +0000 (15:50 -0800)]
RefDirectory: Do not use search path to find additional refs

Psuedorefs like FETCH_HEAD and MERGE_HEAD are supposed to be directly
under the .git directory, not in other locations in the SEARCH_PATH
like refs/ and refs/heads/.  Use exactRef to access them.

Change-Id: Iab8ac47008822fa78fc0691e239e518c34d7a98e
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoPrepare 5.2.2-SNAPSHOT builds 29/134529/1
Matthias Sohn [Thu, 27 Dec 2018 02:32:48 +0000 (03:32 +0100)]
Prepare 5.2.2-SNAPSHOT builds

Change-Id: I9487f6a59ed684ad13bcfbff7d6c730ae4f37030
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.2.1.201812262042-r 28/134528/1 v5.2.1.201812262042-r
Matthias Sohn [Thu, 27 Dec 2018 01:44:17 +0000 (02:44 +0100)]
JGit v5.2.1.201812262042-r

Change-Id: Idfefc54e898f364407a931b787a26db2489b031c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.1' into stable-5.2 27/134527/1
Matthias Sohn [Thu, 27 Dec 2018 00:42:13 +0000 (01:42 +0100)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Prepare 5.1.6-SNAPSHOT builds
  JGit v5.1.5.201812261915-r

Change-Id: Idab456457200ec46f0e4e22bc6e54401b5b57285
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 5.1.6-SNAPSHOT builds 25/134525/1
Matthias Sohn [Thu, 27 Dec 2018 00:33:05 +0000 (01:33 +0100)]
Prepare 5.1.6-SNAPSHOT builds

Change-Id: If3313d602aa57cfa031ba2c9ec03bd51b464dc19
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.1.5.201812261915-r 24/134524/1 v5.1.5.201812261915-r
Matthias Sohn [Thu, 27 Dec 2018 00:16:15 +0000 (01:16 +0100)]
JGit v5.1.5.201812261915-r

Change-Id: I249a440d1ca1c997343da942ae55fcb27a645b92
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoRefDatabase: Remove fallback exactRef implementation 64/60164/3
Jonathan Nieder [Wed, 11 Nov 2015 22:51:02 +0000 (14:51 -0800)]
RefDatabase: Remove fallback exactRef implementation

This is simpler to implement than getRef.  Make it abstract so
implementers remember to override it.

Change-Id: I5f319be1fb1206d7a0142ea939dc4e1039f850ab
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoRefDirectory: Fire RefsChangedEvent on error, too 09/60109/4
Jonathan Nieder [Wed, 11 Nov 2015 01:03:06 +0000 (17:03 -0800)]
RefDirectory: Fire RefsChangedEvent on error, too

getRef and exactRef can produce recoverable exceptions --- for
example, a corrupt loose ref that cannot be parsed.  If readRef was
called and updated looseRefs in the process, RefsChangedEvent should
still be fired.

Noticed while improving the implementation of getRef.  This commit
only affects exactRef and getRef.  Other methods might be similarly
skipping firing RefsChangedEvent in their error handling code, and
this change does not fix them.

Change-Id: I0f460f6c8d9a585ad8453a4a47c1c77e24a1fb83
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoRefDirectory: Refactor getRef and exactRef to share code 08/60108/4
Jonathan Nieder [Wed, 11 Nov 2015 00:56:41 +0000 (16:56 -0800)]
RefDirectory: Refactor getRef and exactRef to share code

Both getRef and exactRef look for a ref or pseudoref in the $GIT_DIR
directory, with careful error handling to handle non-refs like
.git/config.

Avoid the duplication by factoring out a helper that takes care of
this.  This should make the code easier to understand and manipulate.

Change-Id: I2ea67816d2385e84e2d3394b897e23df5826ba50
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoUploadPack: Filter refs used for deepen-not resolution 59/134459/5
Jonathan Nieder [Sat, 22 Dec 2018 21:53:10 +0000 (13:53 -0800)]
UploadPack: Filter refs used for deepen-not resolution

Clients can use --shallow-exclude to obtain information about what
commits are reachable from refs they are not supposed to be able to
see.  Plug the hole by allowing the AdvertiseRefsHook and RefFilter to
take effect here, too.

Change-Id: If2b8e95344fa49e10a6a202144318b60d002490e
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoMerge branch 'stable-5.1' into stable-5.2 58/134458/5
Jonathan Nieder [Wed, 26 Dec 2018 21:26:23 +0000 (13:26 -0800)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  UploadPack: Avoid calling AdvertiseRefsHook twice
  Prepare 5.1.5-SNAPSHOT builds
  JGit v5.1.4.201812251853-r
  UploadPack: Filter refs used for want-ref resolution
  UploadPack: Defer want-ref resolution to after parsing
  Call AdvertiseRefsHook for protocol v2
  Prepare 4.11.7-SNAPSHOT builds
  JGit v4.11.6.201812241910-r
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: I5879df9b723a0dbf6a1eff89a34bbb269f3b773d
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoMerge branch 'stable-5.0' into stable-5.1 16/134516/2
Jonathan Nieder [Wed, 26 Dec 2018 21:24:26 +0000 (13:24 -0800)]
Merge branch 'stable-5.0' into stable-5.1

* stable-5.0:
  UploadPack: Avoid calling AdvertiseRefsHook twice

Change-Id: Ie9ce67921e38fff8338a148c4d9f2776be01d0b0
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoUploadPack: Avoid calling AdvertiseRefsHook twice 15/134515/2
Jonathan Nieder [Wed, 26 Dec 2018 20:40:28 +0000 (12:40 -0800)]
UploadPack: Avoid calling AdvertiseRefsHook twice

The AdvertiseRefsHook can be called twice if the following conditions
hold:

 1. This AdvertiseRefsHook doesn't set this.refs.
 2. getAdvertisedOrDefaultRefs is called after getFilteredRefs.

For example, this can happen when fetchV2 is called after lsRefsV2
when using a stateful bidirectional transport.

The second call does not accomplish anything useful.  Guard it with
'if (!advertiseRefsHookCalled)' to avoid wasted work.

Reported-by: Jonathan Tan <jonathantanmy@google.com>
Change-Id: Ib746582e4ef645b767a5b3fb969596df99ac2ab5
Signed-off-by: Jonathan Nieder <jrn@google.com>
5 years agoMerge changes from topic 'update-index-ref-decorator'
Jonathan Nieder [Wed, 26 Dec 2018 18:12:14 +0000 (13:12 -0500)]
Merge changes from topic 'update-index-ref-decorator'

* changes:
  RefCursor: Remove unnecessary getUpdateIndex method
  RefDatabase/Ref: Add versioning to reference database

5 years agoRefCursor: Remove unnecessary getUpdateIndex method 01/134301/10
Ivan Frade [Thu, 20 Dec 2018 06:25:55 +0000 (22:25 -0800)]
RefCursor: Remove unnecessary getUpdateIndex method

Now the reference carries its updateIndex, so the cursor doesn't need
to expose it.

Change-Id: Icbfca46f92a13f3d8215ad10b2a166a6f40b0b0f
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoRefDatabase/Ref: Add versioning to reference database 92/133092/20
Ivan Frade [Thu, 20 Dec 2018 00:43:56 +0000 (16:43 -0800)]
RefDatabase/Ref: Add versioning to reference database

In DFS implementations the reference table can fall out of sync, but
it is not possible to check this situation in the current API.

Add a property to the Refs indicating the order of its updates.  This
version is set only by RefDatabase implementations that support
versioning (e.g reftable based).

Caller is responsible to check if the reference db creates versioned
refs before accessing getUpdateIndex(). E.g:

   Ref ref = refdb.exactRef(...);
   if (refdb.hasVersioning()) {
       ref.getUpdateIndex();
   }

Change-Id: I0d5ec8e8df47c730301b2e12851a6bf3dac9d120
Signed-off-by: Ivan Frade <ifrade@google.com>
5 years agoPrepare 5.1.5-SNAPSHOT builds 05/134505/1
Matthias Sohn [Tue, 25 Dec 2018 23:55:40 +0000 (00:55 +0100)]
Prepare 5.1.5-SNAPSHOT builds

Change-Id: I3eeb24b01a4f955e7e933238defb42635ebfec7d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v5.1.4.201812251853-r 04/134504/1 v5.1.4.201812251853-r
Matthias Sohn [Tue, 25 Dec 2018 23:42:14 +0000 (00:42 +0100)]
JGit v5.1.4.201812251853-r

Change-Id: I30ba167bcd8144074553d7446a45fa6be19584fe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUploadPack: Filter refs used for want-ref resolution 57/134457/3
Jonathan Nieder [Wed, 19 Dec 2018 05:00:42 +0000 (21:00 -0800)]
UploadPack: Filter refs used for want-ref resolution

In the longer term, we can add support for this to the
RequestValidator interface.  In the short term, this is a minimal
band-aid to ensure any refs the client requests are visible to the
client.

Change-Id: I0683c7a00e707cf97eef6c6bb782671d0a550ffe
Reported-by: Ivan Frade <ifrade@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUploadPack: Defer want-ref resolution to after parsing 56/134456/3
Jonathan Nieder [Wed, 19 Dec 2018 03:44:39 +0000 (19:44 -0800)]
UploadPack: Defer want-ref resolution to after parsing

ProtocolV2Parser explains:

  // TODO(ifrade): This validation should be done after the
  // protocol parsing. It is not a protocol problem asking for an
  // unexisting ref and we wouldn't need the ref database here.

Do so.  This way all ref database accesses are in one place, in the
UploadPack class.

No user-visible change intended --- this is just to make the code
easier to manipulate.

Change-Id: I68e87dff7b9a63ccc169bd0836e8e8baaf5d1048
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-5.0' into stable-5.1 55/134455/3
Matthias Sohn [Tue, 25 Dec 2018 22:58:53 +0000 (23:58 +0100)]
Merge branch 'stable-5.0' into stable-5.1

* stable-5.0:
  Call AdvertiseRefsHook for protocol v2
  Prepare 4.11.7-SNAPSHOT builds
  JGit v4.11.6.201812241910-r
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: Icdc212bf5be2485d0f8028acf6c62fb8531d0e3c
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoCall AdvertiseRefsHook for protocol v2 54/134454/3
Masaya Suzuki [Tue, 18 Dec 2018 17:20:54 +0000 (09:20 -0800)]
Call AdvertiseRefsHook for protocol v2

AdvertiseRefsHook is used to limit the visibility of the refs in Gerrit.
If this hook is not called, then all refs are treated as visible.

In protocol v2, the hook is not called, causing the server to advertise
all refs.  This bug was introduced in v5.0.0.201805221745-rc1~1^2~9
(Execute AdvertiseRefsHook only for protocol v0 and v1, 2018-05-14).

Even before then, the hook was not called in requests after the
capability advertisement, so in transports like HTTP that do not retain
state between round-trips, the server would advertise all refs in
response to an ls-refs (ls-remote) request.

Fix both cases by using getAdvertisedOrDefaultRefs to retrieve the
advertised refs in lsRefs, ensuring the hook is called in all cases that
use its result.

[jn: backported to stable-5.0; split out from a larger patch that also
 fixes protocol v0; avoided filtering this.refs by ref prefix]

Change-Id: I64bce0e72d15b90baccc235c067e57b6af21b55f
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.11' into stable-5.0 53/134453/3
Matthias Sohn [Tue, 25 Dec 2018 22:27:13 +0000 (23:27 +0100)]
Merge branch 'stable-4.11' into stable-5.0

* stable-4.11:
  Prepare 4.11.7-SNAPSHOT builds
  JGit v4.11.6.201812241910-r
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: Ie81284ca6d580b0712c49eec610393d0c0c50203
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 4.11.7-SNAPSHOT builds 97/134497/1
Matthias Sohn [Tue, 25 Dec 2018 00:04:50 +0000 (01:04 +0100)]
Prepare 4.11.7-SNAPSHOT builds

Change-Id: I97dc0f4aeb51c2084f40531ceac84e90bf70608d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v4.11.6.201812241910-r 96/134496/1 v4.11.6.201812241910-r
Matthias Sohn [Mon, 24 Dec 2018 23:56:54 +0000 (00:56 +0100)]
JGit v4.11.6.201812241910-r

Change-Id: I21bfe7a76450184bce43cbe8ebcaa7891e4b12ed
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.10' into stable-4.11 52/134452/3
Matthias Sohn [Mon, 24 Dec 2018 23:49:46 +0000 (00:49 +0100)]
Merge branch 'stable-4.10' into stable-4.11

* stable-4.10:
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: I937e9a4547fc10e4de7c887163022d1ab0322d64
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.9' into stable-4.10 51/134451/3
Matthias Sohn [Mon, 24 Dec 2018 23:33:44 +0000 (00:33 +0100)]
Merge branch 'stable-4.9' into stable-4.10

* stable-4.9:
  Prepare 4.9.9-SNAPSHOT builds
  JGit v4.9.8.201812241815-r
  UploadPack: Test filtering by AdvertiseRefsHook in stateless transports
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: I2e499f34b1c481af794fa9325b0dfebaccdf3cb0
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 4.9.9-SNAPSHOT builds 95/134495/1
Matthias Sohn [Mon, 24 Dec 2018 23:10:49 +0000 (00:10 +0100)]
Prepare 4.9.9-SNAPSHOT builds

Change-Id: I0f7238ce8f79063a410c85701020ffce2b1234cf
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v4.9.8.201812241815-r 94/134494/1 v4.9.8.201812241815-r
Matthias Sohn [Mon, 24 Dec 2018 23:01:29 +0000 (00:01 +0100)]
JGit v4.9.8.201812241815-r

Change-Id: Ic75e4611cce396b186680bc962f0c73b2ee5fff1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoUploadPack: Test filtering by AdvertiseRefsHook in stateless transports 62/134462/3
Masaya Suzuki [Tue, 18 Dec 2018 17:20:54 +0000 (09:20 -0800)]
UploadPack: Test filtering by AdvertiseRefsHook in stateless transports

AdvertiseRefsHook is used to limit the visibility of the refs in Gerrit.
If this hook is not called, then all refs are treated as visible,
causing the server to serve commits reachable from branches the client
should not be able to access, if asked to via a request naming a guessed
object id.

Until 3a529361a76e8267467071e0b13ebb36b97d8fb2 (Call AdvertiseRefsHook
before validating wants, 2018-12-18), UploadPack would invoke this hook
at ref advertisement time but not during negotiation and when serving a
pack file.  Add a test to avoid regressing. Stateful bidirectional
transports were not affected, so the test uses HTTP.

[jn: split out when backporting the fix to stable-4.5.  The test passes
 as long as v4.9.0.201710071750-r~169 (fetch: Accept any SHA-1 on lhs of
 refspec, 2017-06-04) is cherry picked along with it.]

Change-Id: I8c017107336adc7cb4c826985779676bf043e648
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.8' into stable-4.9 50/134450/3
Matthias Sohn [Mon, 24 Dec 2018 22:32:51 +0000 (23:32 +0100)]
Merge branch 'stable-4.8' into stable-4.9

* stable-4.8:
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: Ib44e314a68bca2349b45f4937257aa1298c8d74b
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.7' into stable-4.8 49/134449/4
Matthias Sohn [Mon, 24 Dec 2018 22:27:25 +0000 (23:27 +0100)]
Merge branch 'stable-4.7' into stable-4.8

* stable-4.7:
  Prepare 4.7.8-SNAPSHOT builds
  JGit v4.7.7.201812240805-r
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: I68a21067705b580b40840f8039001ff1e5273c15
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 4.7.8-SNAPSHOT builds 88/134488/2
Matthias Sohn [Mon, 24 Dec 2018 14:29:10 +0000 (15:29 +0100)]
Prepare 4.7.8-SNAPSHOT builds

Change-Id: Ic4ab4aae6d87392d1a5a8bbda06384b7a5b64182
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v4.7.7.201812240805-r 87/134487/1 v4.7.7.201812240805-r
Matthias Sohn [Mon, 24 Dec 2018 12:50:12 +0000 (13:50 +0100)]
JGit v4.7.7.201812240805-r

Change-Id: I57b6001b1fbd6042299ccd4dd7d70765a46ea10b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.6' into stable-4.7 48/134448/3
Matthias Sohn [Mon, 24 Dec 2018 12:25:31 +0000 (13:25 +0100)]
Merge branch 'stable-4.6' into stable-4.7

* stable-4.6:
  Fix feature versions imported by feature org.eclipse.jgit.pgm
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: If637694f80dbd1e774d60c672fe78a6500650bb8
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoFix feature versions imported by feature org.eclipse.jgit.pgm 68/134468/1
Matthias Sohn [Mon, 24 Dec 2018 11:13:29 +0000 (12:13 +0100)]
Fix feature versions imported by feature org.eclipse.jgit.pgm

On stable-4.6 we are currently at version 4.6.2-SNAPSHOT

Change-Id: Ia2972d0697c3476850ecf4a3c6691b3987866cd9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoMerge branch 'stable-4.5' into stable-4.6 47/134447/3
Matthias Sohn [Mon, 24 Dec 2018 11:09:39 +0000 (12:09 +0100)]
Merge branch 'stable-4.5' into stable-4.6

* stable-4.5:
  Prepare 4.5.6-SNAPSHOT builds
  JGit v4.5.5.201812240535-r
  Call AdvertiseRefsHook before validating wants

Change-Id: I0fd67ddd9c4966c20d82cdfe78b2f9d4898b4665
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoPrepare 4.5.6-SNAPSHOT builds 66/134466/1
Matthias Sohn [Mon, 24 Dec 2018 11:00:26 +0000 (12:00 +0100)]
Prepare 4.5.6-SNAPSHOT builds

Change-Id: I57c55187ada6d824b94a17f5a79a5bcff61f9ee9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoJGit v4.5.5.201812240535-r 65/134465/1 v4.5.5.201812240535-r
Matthias Sohn [Mon, 24 Dec 2018 10:21:27 +0000 (11:21 +0100)]
JGit v4.5.5.201812240535-r

Change-Id: I6e89e937c08757887967d91afb39cfbe8372d6b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
5 years agoCall AdvertiseRefsHook before validating wants 46/134446/3
Masaya Suzuki [Tue, 18 Dec 2018 17:20:54 +0000 (09:20 -0800)]
Call AdvertiseRefsHook before validating wants

AdvertiseRefsHook is used to limit the visibility of the refs in Gerrit.
If this hook is not called, then all refs are treated as visible,
causing the server to serve commits reachable from branches the client
should not be able to access, if asked to via a request naming a guessed
object id.

This bug was introduced in v2.0.0.201206130900-r~123 (Modify refs in
UploadPack/ReceivePack using a hook interface, 2012-02-08).  Stateful
bidirectional transports are not affected.

Fix it by moving the AdvertiseRefsHook call to
getAdvertisedOrDefaultRefs, ensuring the hook is called in all cases.

[jn: backported to stable-4.5 by splitting out tests and the protocol v2
 specific parts]

Change-Id: I159f396216354f2eda3968d17802e166d8c8ec2d
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>