]> source.dussan.org Git - jgit.git/log
jgit.git
6 years agoLfsServerText: Fix formatting of invalidPathInfo message 79/112979/4
David Pursehouse [Thu, 7 Dec 2017 01:18:21 +0000 (10:18 +0900)]
LfsServerText: Fix formatting of invalidPathInfo message

The message is formatted as:

  Invalid pathInfo '/abc' does not match '/{SHA-256}'

but should be:

  Invalid pathInfo: '/abc' does not match '/{SHA-256}'

(i.e. including a colon) to be consistent with other messages.

Change-Id: Ic38aa7d33dd02d7954b95c331a73919a90c69991
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoInvalidLongObjectIdException: Fix formatting of message 77/112977/3
David Pursehouse [Thu, 7 Dec 2017 00:51:56 +0000 (09:51 +0900)]
InvalidLongObjectIdException: Fix formatting of message

The message is formatted as:

  Invalid id: : abcde...

but should be:

  Invalid id: abcde...

Change-Id: Ie15cacdcf2f168edaee262e6cf8061ebfe9d998d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMove repeated LFS Gson handling to common class 76/112976/3
David Pursehouse [Wed, 6 Dec 2017 15:00:52 +0000 (00:00 +0900)]
Move repeated LFS Gson handling to common class

LfsProtocolServlet and FileLfsServlet both implement the same
setup of the Gson object.

Factor it out to a common class and reuse it.

Change-Id: I5696404fad140cbff1b712ebb04a7e8bba60e4b4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDownloadTest: Use ExpectedException instead of try..catch..fail 75/112975/2
David Pursehouse [Wed, 6 Dec 2017 23:42:39 +0000 (08:42 +0900)]
DownloadTest: Use ExpectedException instead of try..catch..fail

Change-Id: I5547e64de6cea3d2200887b504245c69692f00b5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFileLfsServlet: Do not pretty print json response 74/112974/1
David Pursehouse [Wed, 6 Dec 2017 23:25:50 +0000 (08:25 +0900)]
FileLfsServlet: Do not pretty print json response

Pretty printing the response is useful for human readers, but most
(if not all) of the time, the response will be read by programs.

Remove it to avoid the additional overhead of the formatting and
extra bytes in the response. Adjust the test accordingly.

Note that LfsProtocolServlet already doesn't use pretty printing,
so this change makes FileLfsServlet's behavior consistent. In fact,
both classes now have duplicate Gson handling; this will be cleaned
up in a separate change.

Change-Id: I113a23403f9222f16e2c0ddf39461398b721d064
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.9' 72/112972/1
David Pursehouse [Wed, 6 Dec 2017 23:13:45 +0000 (08:13 +0900)]
Merge branch 'stable-4.9'

* stable-4.9:
  LfsStore: Make inner class AppServer static
  DirCacheCheckout#processEntry: Fix typo in javadoc

Change-Id: Id8e4a3c4dc741e6e0182522e72ecb4b34ae419eb

6 years agoTransportHttp: retry on IOException with another mechanism 71/111671/4
Thomas Wolf [Wed, 15 Nov 2017 22:23:27 +0000 (23:23 +0100)]
TransportHttp: retry on IOException with another mechanism

When a 401 occurs on POST and the server advertises Negotiate, we
may get an exception from GSSAPI if the client isn't configured
at all for Kerberos.

Add exception logic similar to the GET case: keep trying other
authentication mechanisms if this occurs.

Bug: 501167
Change-Id: Ic3a3368378d4b3408a35aec93e78ef425d54b3e4
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoLfsStore: Make inner class AppServer static 51/112951/1
David Pursehouse [Wed, 6 Dec 2017 14:27:09 +0000 (23:27 +0900)]
LfsStore: Make inner class AppServer static

FindBugs reports:

  This class is an inner class, but does not use its embedded reference
  to the object which created it. This reference makes the instances
  of the class larger, and may keep the reference to the creator object
  alive longer than necessary. If possible, the class should be made
  static.

Change-Id: I245e44678166176de0cfb275e22ddd159f88e0bd
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDirCacheCheckout#processEntry: Fix typo in javadoc 36/112936/1
David Pursehouse [Wed, 6 Dec 2017 10:59:55 +0000 (19:59 +0900)]
DirCacheCheckout#processEntry: Fix typo in javadoc

Change-Id: Ie08a6275f4656ebb46abe8748b73b0fb52a98a35
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoConfigTest: Move pathToString to FileUtils 41/112841/3
David Pursehouse [Tue, 5 Dec 2017 01:37:26 +0000 (10:37 +0900)]
ConfigTest: Move pathToString to FileUtils

ConfigTest#pathToString is not visible to FileBasedConfigTest when
bulding with bazel.

Move it to FileUtils rather than messing about with the bazel build
rules to make it visible.

Change-Id: Idcfd4822699dac9dc4a426088a929a9cd31bf53f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFileBasedConfig: support for relative includes 48/111848/5
Marc Strapetz [Sat, 18 Nov 2017 16:50:30 +0000 (17:50 +0100)]
FileBasedConfig: support for relative includes

Relative include.path are now resolved against the config's parent
directory. include.path starting with ~/ are resolved against the
user's home directory

Change-Id: I91911ef404126618b1ddd3589294824a0ad919e6
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
6 years agoConfig: extract method to read included config 47/111847/5
Marc Strapetz [Mon, 20 Nov 2017 09:21:30 +0000 (10:21 +0100)]
Config: extract method to read included config

Change-Id: I2c55af3e5fe29e0ce8e3d05e4b54ec961d3f863a
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
6 years agoConfigTest: fix on Windows 46/111846/5
Marc Strapetz [Mon, 20 Nov 2017 17:21:22 +0000 (18:21 +0100)]
ConfigTest: fix on Windows

Change-Id: I37a2ef611aef97faf1b891a9660c1745435a915d
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.9' 84/112784/2
David Pursehouse [Sun, 3 Dec 2017 23:19:46 +0000 (08:19 +0900)]
Merge branch 'stable-4.9'

* stable-4.9:
  Prepare 4.9.2-SNAPSHOT builds
  JGit v4.9.1.201712030800-r
  Silence API warnings for reintroduced ResolveMerger#processEntry

Change-Id: I8a703815a9b3d8b7e06e308cc46a8c458731c013

6 years agoPrepare 4.9.2-SNAPSHOT builds 72/112772/1
Matthias Sohn [Sun, 3 Dec 2017 13:17:43 +0000 (14:17 +0100)]
Prepare 4.9.2-SNAPSHOT builds

Change-Id: I5879ad4aee94ff6783b5589728912117f2495dd3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.9.1.201712030800-r 71/112771/1 v4.9.1.201712030800-r
Matthias Sohn [Sun, 3 Dec 2017 12:59:36 +0000 (13:59 +0100)]
JGit v4.9.1.201712030800-r

Change-Id: I8bf477778c9dac41cb65233a9e7d590531a836b7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoSilence API warnings for reintroduced ResolveMerger#processEntry 70/112770/1
Matthias Sohn [Sun, 3 Dec 2017 12:54:28 +0000 (13:54 +0100)]
Silence API warnings for reintroduced ResolveMerger#processEntry

This was silenced before but suppression was unintentionally lost in
merge commit 6858339c1e2878d5c5dc6cc9b422f9802be950ae.
This method was removed in 4.9.0 and reintroduced in 4.9.1 to avoid
breaking EMF compare versions which were built against older versions.

See: abf420302bb03b119c19ddf29ef0c968f77c318d
Change-Id: I152d58ac885e044bcab682b9423f6cc83b667989
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMake local assert methods private in test classes 83/112683/1
David Pursehouse [Fri, 1 Dec 2017 01:56:18 +0000 (10:56 +0900)]
Make local assert methods private in test classes

Change-Id: I1bed28a1eac3c7f84cc40841853b9540c72be265
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpgrade error_prone_core to 2.1.3 82/112682/1
David Pursehouse [Fri, 1 Dec 2017 01:27:34 +0000 (10:27 +0900)]
Upgrade error_prone_core to 2.1.3

Change-Id: I45619f8089a3cd1390e57158c4bf808c84330a50
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.9' 29/112629/3
Matthias Sohn [Thu, 30 Nov 2017 12:37:30 +0000 (13:37 +0100)]
Merge branch 'stable-4.9'

* stable-4.9:
  GC: Delete stale temporary packs and indexes

Change-Id: I49b37845ee8a465404b801a2d8de0205a2e7ba30
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpdate Jetty to 9.4.8.v20171121 96/112596/1
Matthias Sohn [Wed, 29 Nov 2017 22:09:17 +0000 (23:09 +0100)]
Update Jetty to 9.4.8.v20171121

Change-Id: I4ea421758e3469a59fa4fbbf46ce86757dd267e9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge "Break down DfsBlockCache stats by pack file extension."
Shawn Pearce [Tue, 28 Nov 2017 20:37:30 +0000 (15:37 -0500)]
Merge "Break down DfsBlockCache stats by pack file extension."

6 years agoRepoCommand: Skip RemoteReader when encountering a full SHA-1 67/112467/1
Jonathan Nieder [Tue, 28 Nov 2017 16:16:56 +0000 (08:16 -0800)]
RepoCommand: Skip RemoteReader when encountering a full SHA-1

There is no point in calling back to the RemoteReader to resolve a
40-digit hex SHA-1 to itself.  We already skip that call when not
ignoring remote failures; skip it when ignoring remote failures, too.

This should simplify RemoteReader implementations.

Reported-by: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I7566968ed1f39b1ad73574fa903faf3ee308eb87

6 years agoBreak down DfsBlockCache stats by pack file extension. 91/112391/2
Minh Thai [Mon, 27 Nov 2017 22:28:11 +0000 (14:28 -0800)]
Break down DfsBlockCache stats by pack file extension.

Change-Id: Iaecf0580279b33e3e2439784528cae7b69fb28bc
Signed-off-by: Minh Thai <mthai@google.com>
6 years agoUpgrade spotbugs-maven-plugin to 3.1.0-RC8 30/112230/2
David Pursehouse [Fri, 24 Nov 2017 01:12:36 +0000 (10:12 +0900)]
Upgrade spotbugs-maven-plugin to 3.1.0-RC8

Change-Id: I650d1a527063204aa9696fe99b4f59bfa7e5fb97
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoGC: Delete stale temporary packs and indexes 18/111018/4
Hector Caballero [Fri, 3 Nov 2017 18:39:37 +0000 (14:39 -0400)]
GC: Delete stale temporary packs and indexes

When a GC operation is interrupted, temporary packs and indexes can be
left on the pack folder. In big, busy repositories this can lead to
significant amounts of wasted disk space if this interruption is done
with a certain frequency.

Remove stale temporary packs and indexes at the end of the GC process so
they do not accumulate. To avoid interfering with a possible concurrent
JGit GC process in the same repository, only delete temporary files that
are older than one day.

Change-Id: If9b6c1e57fac8a6a0ecc0a703089634caba4caae
Signed-off-by: Hector Caballero <hector.caballero@ericsson.com>
6 years agoPerformance improvement on writing a large index 67/112067/4
Stephen Lawson [Wed, 22 Nov 2017 12:41:05 +0000 (12:41 +0000)]
Performance improvement on writing a large index

The index header consists of a 4-byte version number. The current
supported version numbers are 2 and 3. The code checks if any entries
are extended. If it finds any entries that are extended it picks version
'3', otherwise it chooses version '2'.

DirCache.java
-Changed the 'extended' check to exit early when any entry is considered
'extended' in the index.

(Of course, I maybe missing a bitwise optimization that is made in
the Java bytecode.)

Change-Id: If70db9454befe683319b974ebd3774060be9445d
Signed-off-by: Stephen Lawson <slawson@ptc.com>
6 years agoUpgrade maven-compiler-plugin to 3.7.0 40/112040/2
David Pursehouse [Wed, 22 Nov 2017 07:55:11 +0000 (16:55 +0900)]
Upgrade maven-compiler-plugin to 3.7.0

Change-Id: I9c4a591b809cee702b2d064d74c9809c023c78c8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFix discouraged access warnings in RefsUnreadableInMemoryRepository 28/112228/1
Matthias Sohn [Fri, 24 Nov 2017 00:23:07 +0000 (01:23 +0100)]
Fix discouraged access warnings in RefsUnreadableInMemoryRepository

Change-Id: I16e291f533625c80b1d39f7cbaf40efbdfcc2c3c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.9' 27/112227/1
Matthias Sohn [Fri, 24 Nov 2017 00:18:13 +0000 (01:18 +0100)]
Merge branch 'stable-4.9'

* stable-4.9:
  Ignore warning for minor version change without API change
  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: Icc33d2e36f140e8714fce088379673a8834ae9de

6 years agoIgnore warning for minor version change without API change 26/112226/1
Matthias Sohn [Fri, 24 Nov 2017 00:12:14 +0000 (01:12 +0100)]
Ignore warning for minor version change without API change

- this is a new warning option in Eclipse 4.7 and higher
- we always change version of all bundles in a release to keep release
engineering simple

Change-Id: Ic7523d77b67b2802f1bab3bc70af250d712a034f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.8' into stable-4.9 29/112129/2
Matthias Sohn [Wed, 22 Nov 2017 22:46:39 +0000 (23:46 +0100)]
Merge branch 'stable-4.8' into stable-4.9

* stable-4.8:
  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: I7cf2e48934195430b3945b6d74b092f93a3ccd36
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 agoMerge branch 'stable-4.9' 29/112029/1
David Pursehouse [Wed, 22 Nov 2017 02:31:20 +0000 (11:31 +0900)]
Merge branch 'stable-4.9'

* stable-4.9:
  Yet another work-around for a Jsch bug: timeouts

Change-Id: I7cf227c62a3c06f91cee1a6c61719b6fe50da883
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
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

6 years agoYet another work-around for a Jsch bug: timeouts 21/111421/2
Thomas Wolf [Sat, 11 Nov 2017 10:41:10 +0000 (11:41 +0100)]
Yet another work-around for a Jsch bug: timeouts

Jsch 0.1.54 passes on the values from ~/.ssh/config for
"ServerAliveInterval" and "ConnectTimeout" as read from
the config file to java.net.Socket.setSoTimeout(). That
method expects milliseconds, but the values in the config
file are seconds!

The missing conversion in Jsch means that the timeout is
set way too low, and if the server doesn't respond within
that very short time frame, Jsch kills the connection and
then throws an exception with a message such as "session is
down" or "timeout in waiting for rekeying process".

As a work-around, do the conversion to milliseconds in the
Jsch-facing Config interface of OpenSshConfig. That way Jsch
already gets these values as milliseconds.

Bug: 526867
Change-Id: Ibc9b93f7722fffe10f3e770dfe7fdabfb3b97e74
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoConfig: Handle leading/trailing single whitespaces 20/111920/1
Dave Borowitz [Mon, 20 Nov 2017 18:55:25 +0000 (13:55 -0500)]
Config: Handle leading/trailing single whitespaces

Change-Id: I468106acd2006d0a174c76dfd4bce231f1c7a6f8

6 years agoMerge branch 'stable-4.9' 72/111872/2
David Pursehouse [Mon, 20 Nov 2017 06:38:43 +0000 (15:38 +0900)]
Merge branch 'stable-4.9'

* stable-4.9:
  Fix NPE in TransportGitSsh.ExtSession.exec()
  Add missing help text for rev-parse's --verify option
  Remove final modifier on args4j argument field in RevParse

Change-Id: I5ac9e2f185f2210ee76970501710b99b12e93e75
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFix NPE in TransportGitSsh.ExtSession.exec() 28/111828/3
Matthias Sohn [Fri, 17 Nov 2017 21:16:31 +0000 (22:16 +0100)]
Fix NPE in TransportGitSsh.ExtSession.exec()

Bug: 527383
Change-Id: I965860b4e0e9aa1adf6a1bb0735940cbd22adced
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoAdd missing help text for rev-parse's --verify option 54/111854/1
Matthias Sohn [Sat, 18 Nov 2017 23:38:05 +0000 (00:38 +0100)]
Add missing help text for rev-parse's --verify option

Change-Id: I3345f52e0c2a555e4c5edb7effe4be4af4cca10a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove final modifier on args4j argument field in RevParse 53/111853/1
Rüdiger Herrmann [Sat, 18 Nov 2017 19:23:57 +0000 (20:23 +0100)]
Remove final modifier on args4j argument field in RevParse

Args4J does no longer allow to use final fields to reference
arguments or options [1]. Change RevParse to be compatibel with this
change.

[1] https://github.com/kohsuke/args4j/commit/6e11f89d40dcc518c0e5eb9eef5d74f05d58e6af

See-also: a0558b709448cea01cc0725fff73408d9b223c72
Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
Change-Id: I33b233f195c06855d9e094c8c9ba804fbe7b1438

6 years agoMerge changes from topic 'includeDeletes'
Shawn Pearce [Thu, 16 Nov 2017 15:45:57 +0000 (10:45 -0500)]
Merge changes from topic 'includeDeletes'

* changes:
  Add flag for keeping ref tombstones in GC reftable
  Preserve ref tombstone when compact top retable stack

6 years agoAdd flag for keeping ref tombstones in GC reftable 62/111662/7
Minh Thai [Thu, 16 Nov 2017 06:48:04 +0000 (22:48 -0800)]
Add flag for keeping ref tombstones in GC reftable

A tombstone will prevent a delayed reference update from resurrecting the
deleted reference.

Change-Id: Id9f4df43d435a299ff16cef614821439edef9b11
Signed-off-by: Minh Thai <mthai@google.com>
6 years agoPreserve ref tombstone when compact top retable stack 85/111685/1
Minh Thai [Thu, 16 Nov 2017 06:45:32 +0000 (22:45 -0800)]
Preserve ref tombstone when compact top retable stack

Change-Id: I07f5ad572b4642a7cdd76d92aa98f3b6c63d9fa2
Signed-off-by: Minh Thai <mthai@google.com>
6 years agoRemove unused import from ReftableCompactorTest 39/111639/1
Matthias Sohn [Wed, 15 Nov 2017 15:22:55 +0000 (16:22 +0100)]
Remove unused import from ReftableCompactorTest

Change-Id: Ib6d7fb6b56a94be307b07fefacf5d9c77fce0447
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoTreeWalk: Make getEolStreamType(OperationType) public 06/111206/5
David Pursehouse [Wed, 8 Nov 2017 11:20:45 +0000 (20:20 +0900)]
TreeWalk: Make getEolStreamType(OperationType) public

and deprecate getEolStreamType().

This resolves a TODO that was apparently supposed to be done in
version 4.4.

Change-Id: I5c9861aedabdc3f99dcf47519b3959a979e6a591

6 years agoTreeWalk: Fix indentation 05/111205/4
David Pursehouse [Wed, 8 Nov 2017 11:21:28 +0000 (20:21 +0900)]
TreeWalk: Fix indentation

Change-Id: I040aaaf4e3f1e3458e0ece52d1d046f501272fc2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge "ObjectDirectory: Add pack directory getter"
David Pursehouse [Wed, 15 Nov 2017 01:37:26 +0000 (20:37 -0500)]
Merge "ObjectDirectory: Add pack directory getter"

6 years agoMerge "Add return tag"
David Pursehouse [Wed, 15 Nov 2017 01:37:14 +0000 (20:37 -0500)]
Merge "Add return tag"

6 years agoMerge "ReftableCompactor should accept 0 for minUpdateIndex"
Jonathan Nieder [Tue, 14 Nov 2017 20:05:19 +0000 (15:05 -0500)]
Merge "ReftableCompactor should accept 0 for minUpdateIndex"

6 years agoReftableCompactor should accept 0 for minUpdateIndex 02/111502/5
Minh Thai [Tue, 14 Nov 2017 04:17:16 +0000 (20:17 -0800)]
ReftableCompactor should accept 0 for minUpdateIndex

Do not use 0 as the unset value for minUpdateIndex, as input reftables
may have minUpdateIndex starting at 0.

Change-Id: Ie040a6b73d4a5eba5521e51d0ee4580713c84a3e
Signed-off-by: Minh Thai <mthai@google.com>
6 years agoObjectDirectory: Add pack directory getter 74/111374/5
Hector Caballero [Sat, 4 Nov 2017 11:37:39 +0000 (07:37 -0400)]
ObjectDirectory: Add pack directory getter

So far, in order to get the pack directory it was necessary to resolve
it from the object directory. This resolution is already done when
creating the object directory, so simplify the call by just adding a
getter to the pack directory.

Change-Id: I69e783141dc6739024e8b3d5acc30843edd651a7
Signed-off-by: Hector Caballero <hector.caballero@ericsson.com>
6 years agoAdd return tag 48/111548/1
Hector Caballero [Tue, 14 Nov 2017 15:06:26 +0000 (10:06 -0500)]
Add return tag

Eclipse was complaining about the missing tag for the return type.

Change-Id: I43c7e823c3090b19dc8202c1e4d7968e1fa8e6bb
Signed-off-by: Hector Caballero <hector.caballero@ericsson.com>
6 years agoFileUtils.toPath to convert File to Path 93/110593/3
Marc Strapetz [Tue, 14 Nov 2017 09:02:07 +0000 (10:02 +0100)]
FileUtils.toPath to convert File to Path

When invoking File.toPath(), an (unchecked) InvalidPathException may be
thrown which should be converted to a checked IOException.

For now, we will replace File.toPath() by FileUtils.toPath() only for
code which can already handle IOExceptions.

Change-Id: I0f0c5fd2a11739e7a02071adae9a5550985d4df6
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
6 years agoSilence invalid @since 3.5 API warning on ResolveMerge#processEntry 95/111495/1
Matthias Sohn [Mon, 13 Nov 2017 21:41:57 +0000 (22:41 +0100)]
Silence invalid @since 3.5 API warning on ResolveMerge#processEntry

This method was removed in 4.9 and reintroduced in
I48ba4308dee73925fa32d6c2fd6b5fd89632c571 as deprecated in 4.9.1 in
order to help EMF Compare to avoid breakage.

Change-Id: Ia638517178313da42ae13ebcf88ad535d9a02723
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge changes I335587ee,I4182a174
David Pursehouse [Sat, 11 Nov 2017 03:05:50 +0000 (22:05 -0500)]
Merge changes I335587ee,I4182a174

* changes:
  Merge branch 'stable-4.9'
  Remove an unused import from PackParserTest

6 years agoAdd a setting for fsck to check connectivity only 17/111417/4
Zhen Chen [Sat, 11 Nov 2017 00:05:28 +0000 (16:05 -0800)]
Add a setting for fsck to check connectivity only

The object checks may take a long time and sometimes we are only
interested in connectivity check.

This is similar to 'git fsck --connectivity-only'.

Change-Id: I654e8fdccdb16d796f920088429d188cc96734bc
Signed-off-by: Zhen Chen <czhen@google.com>
6 years agoMerge branch 'stable-4.9' 01/111401/2
Matthias Sohn [Fri, 10 Nov 2017 18:01:14 +0000 (19:01 +0100)]
Merge branch 'stable-4.9'

* stable-4.9:
  Work around a Jsch bug: ensure the user name is set from URI
  Reintroduce protected method which removal broke EMF Compare

Change-Id: I335587eee279f91bd36c9ba9fc149b17a6db6110
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove an unused import from PackParserTest 00/111400/2
Matthias Sohn [Fri, 10 Nov 2017 18:00:55 +0000 (19:00 +0100)]
Remove an unused import from PackParserTest

Change-Id: I4182a1746b09dedab648e457d1ece6d667a01f12
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge changes I22a8874b,I68ed4abd,I740bc4bf,Icbd17d15
Jonathan Nieder [Fri, 10 Nov 2017 23:52:53 +0000 (18:52 -0500)]
Merge changes I22a8874b,I68ed4abd,I740bc4bf,Icbd17d15

* changes:
  BitmapWalker: do not revisit objects in bitmap
  Use bitmaps for non-commit reachability checks
  Make PackWriterBitmapWalker public
  UploadPackTest: construct commits in test method

6 years agoBitmapWalker: do not revisit objects in bitmap 86/111086/8
Jonathan Tan [Thu, 2 Nov 2017 01:20:54 +0000 (18:20 -0700)]
BitmapWalker: do not revisit objects in bitmap

Currently, BitmapWalker walks through every object returned by the
internal ObjectWalk, regardless of whether that object has already
been marked in the bitmap. Set an object filter to ensure that only
bitmap-unmarked objects are walked through.

Change-Id: I22a8874b1e571df3c33643b365036d95f52fe7c7
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoUse bitmaps for non-commit reachability checks 85/111085/8
Jonathan Tan [Thu, 2 Nov 2017 00:36:18 +0000 (17:36 -0700)]
Use bitmaps for non-commit reachability checks

Currently, unless RequestPolicy#ANY is used, UploadPack rejects all
non-commit "want" lines unless they were advertized. This is fine,
except when "uploadpack.allowreachablesha1inwant" is true
(corresponding to RequestPolicy#REACHABLE_COMMIT), in which case one
would expect that "want"-ing anything reachable would work.

(There is no restriction that "want" lines must only contain commits -
it is allowed for refs to directly point to trees and blobs, and
requesting for them using "want" lines works.)

This commit has been written to avoid performance regressions as much
as possible. In the usual (and currently working) case where the only
unadvertized things requested are commits, we do a standard RevWalk in
order to avoid incurring the cost of loading bitmaps. However, if
unadvertized non-commits are requested, bitmaps are used instead, and
if there are no bitmaps, a WantNotValidException is thrown (as is
currently done).

Change-Id: I68ed4abd0e477ff415c696c7544ccaa234df7f99
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoMake PackWriterBitmapWalker public 84/111084/7
Jonathan Tan [Wed, 25 Oct 2017 21:09:17 +0000 (14:09 -0700)]
Make PackWriterBitmapWalker public

Make PackWriterBitmapWriter class public and move it to a more central
location, in preparation for its use by another class (in a subsequent
commit).

One of its inner static classes, AddUnseenToBitmapFilter, previously
package-private, is also used directly in its former package. Therefore,
AddUnseenToBitmapFilter and its sibling class have been moved to an
internal package instead.

Change-Id: I740bc4bfc4e4e3c857d1ee7d25fe45e90cd22a75
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoWork around a Jsch bug: ensure the user name is set from URI 59/111359/1
Thomas Wolf [Tue, 7 Nov 2017 07:19:56 +0000 (08:19 +0100)]
Work around a Jsch bug: ensure the user name is set from URI

JSch unconditionally overrides the user name given in the connection
URI by the one found in ~/.ssh/config (if that does specify one for
the used host). If the SSH config file has a different user name,
we'll end up using the wrong name, which typically results in an
authentication failure or in Eclipse/EGit asking for a password for
the wrong user.

Unfortunately there is no way to prevent or circumvent this Jsch
behavior up front; it occurs already in the Session constructor at
com.jcraft.jsch.Session() and the Session.applyConfig() method. And
while there is a Session.setUserName() that would enable us to correct
this, that latter method has package visibility only.

So resort to reflection to invoke that setUserName() method to ensure
that Jsch uses the user name from the URI, if there is one.

Bug: 526778
Change-Id: Ia327099b5210a037380b2750a7fd76ff25c41a5a
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoReject pack if delta exceeds array size limit 12/111312/3
Shawn Pearce [Thu, 9 Nov 2017 17:12:59 +0000 (09:12 -0800)]
Reject pack if delta exceeds array size limit

JGit's delta handling code requires the target to be a single byte
array. Any attempt to inflate a delta larger than fits in the 2GiB
limit will fail with some form of array index exceptions. Check for
this overflow early and abort pack parsing.

Change-Id: I5bb3a71f1e4f4e0e89b8a177c7019a74ee6194da

6 years agoCheck non-flushed packs for existence of object 76/111176/4
Zhen Chen [Tue, 7 Nov 2017 20:48:47 +0000 (12:48 -0800)]
Check non-flushed packs for existence of object

Change-Id: Id466909d70ec6f828c904692139891dec880305e
Signed-off-by: Zhen Chen <czhen@google.com>
6 years agoSuppress "Unlikely argument type for equals()" warnings in tests 61/106061/4
David Pursehouse [Sun, 1 Oct 2017 05:08:17 +0000 (06:08 +0100)]
Suppress "Unlikely argument type for equals()" warnings in tests

This new warning was introduced in Eclipse 4.7 Oxygen [1].

The only instances of the warning are in test code that is asserting
that some class does not compare equal to Strings. As in the Gerrit
project [2] these asserts are arguably overkill, but arguably also
a reasonable test of an equals implementation. Ignore the warning in
these cases.

Note that if the project is opened in an earlier version of Eclipse,
a warning "Unsupported @SuppressWarnings" will be emitted.

[1] https://www.eclipse.org/eclipse/news/4.7/M6/
[2] https://gerrit-review.googlesource.com/#/c/gerrit/+/110339/

Change-Id: I08ea33d71e6009cf0f37e6492a475931f447256b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpdate spotbugs-maven-plugin to 3.1.0-RC7 48/110948/2
Matthias Sohn [Thu, 2 Nov 2017 21:48:00 +0000 (22:48 +0100)]
Update spotbugs-maven-plugin to 3.1.0-RC7

Change-Id: Ic1c2c5b6e3955a1404780e51206513d226600e4b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge "Reintroduce protected method which removal broke EMF Compare" into stable-4.9
Matthias Sohn [Thu, 2 Nov 2017 16:59:11 +0000 (12:59 -0400)]
Merge "Reintroduce protected method which removal broke EMF Compare" into stable-4.9

6 years agoUploadPackTest: construct commits in test method 83/111083/1
Jonathan Tan [Wed, 1 Nov 2017 23:23:32 +0000 (16:23 -0700)]
UploadPackTest: construct commits in test method

In a subsequent commit, more tests will be added. This commit allows
those tests to reuse fields.

Change-Id: Icbd17d158cfe3ba4dacbd8a11a67f9e7607b41b3
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoMerge branch 'stable-4.9' 90/110890/1
David Pursehouse [Wed, 1 Nov 2017 23:29:56 +0000 (08:29 +0900)]
Merge branch 'stable-4.9'

* stable-4.9:
  PackInserter: Implement newReader()
  Move some strings from DfsText to JGitText
  FileRepository: Add pack-based inserter implementation
  ObjectDirectory: Factor a method to close open pack handles
  ObjectDirectory: Remove last modified check in insertPack

Change-Id: Ifc9ed6f5d8336bc978818a64eae122bceb933e5d

6 years agoPackInserter: Implement newReader() 66/110866/3
Dave Borowitz [Wed, 1 Nov 2017 15:46:48 +0000 (11:46 -0400)]
PackInserter: Implement newReader()

Change-Id: Ib9e7f6439332eaed3d936f895a5271a7d514d3e9

6 years agoMove some strings from DfsText to JGitText 65/110865/2
Dave Borowitz [Wed, 1 Nov 2017 15:45:22 +0000 (11:45 -0400)]
Move some strings from DfsText to JGitText

Change-Id: I60050e5127d12b6139d81859dba929fcfaabe504

6 years agoFileRepository: Add pack-based inserter implementation 64/110864/2
Dave Borowitz [Tue, 31 Oct 2017 14:05:29 +0000 (10:05 -0400)]
FileRepository: Add pack-based inserter implementation

Applications that use ObjectInserters to create lots of individual
objects may prefer to avoid cluttering up the object directory with
loose objects. Add a specialized inserter implementation that produces a
single pack file no matter how many objects. This inserter is loosely
based on the existing DfsInserter implementation, but is simpler since
we don't need to buffer blocks in memory before writing to storage.

An alternative for such applications would be to write out the loose
objects and then repack just those objects later. This operation is not
currently supported with the GC class, which always repacks existing
packs when compacting loose objects. This in turn requires more
CPU-intensive reachability checks and extra I/O to copy objects from old
packs to new packs.

So, the choice was between implementing a new variant of repack, or not
writing loose objects in the first place. The latter approach is likely
less code overall, and avoids unnecessary I/O at runtime.

The current implementation does not yet support newReader() for reading
back objects.

Change-Id: I2074418f4e65853b7113de5eaced3a6b037d1a17

6 years agoObjectDirectory: Factor a method to close open pack handles 63/110863/2
Dave Borowitz [Wed, 1 Nov 2017 14:42:46 +0000 (10:42 -0400)]
ObjectDirectory: Factor a method to close open pack handles

Change-Id: I9490c4583fdf801de9c0bb09595ebb8fb4926988

6 years agoObjectDirectory: Remove last modified check in insertPack 62/110862/1
Dave Borowitz [Wed, 1 Nov 2017 14:19:38 +0000 (10:19 -0400)]
ObjectDirectory: Remove last modified check in insertPack

GC explicitly handles the case where a new pack has the same name as an
existing pack due to it containing the exact same set of objects. In
this case, the pack passed to insertPack will have the same name as an
existing pack, but it will also almost certainly have a later mtime than
the existing pack.

The loop in insertPack tried to short-circuit when inserting a new pack,
to avoid walking more of the pack list than necessary. Unfortunately,
this means it will never get to the check for an identical name,
resulting in a duplicate entry for the same PackFile in the pack list.
Remove the short-circuit so that insertPack does not insert a duplicate
entry.

Change-Id: I00711b28594622ad3bd104332334e8a3592cda7f

6 years agoUpgrade error_prone_core to 2.1.2 23/110623/2
David Pursehouse [Thu, 26 Oct 2017 05:30:45 +0000 (14:30 +0900)]
Upgrade error_prone_core to 2.1.2

Change-Id: I2e6ea106ed5e6568eaf421ce5794bfe446c6cadb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMove loggers to the top of their class 74/110674/2
Saša Živkov [Fri, 27 Oct 2017 10:29:52 +0000 (12:29 +0200)]
Move loggers to the top of their class

There is a possibility of hitting NPE on a logger if it is not the first
statically initialized member. For example, if another static
initializer creates an instance of its class and the logger is used
from the constructor.

Change-Id: I51fa855a8883c107f2e4ef5ac039dc12a571a7ae

6 years agoMerge "Align PackStatistics and DfsPackDescription list length"
Terry Parker [Thu, 26 Oct 2017 22:22:49 +0000 (18:22 -0400)]
Merge "Align PackStatistics and DfsPackDescription list length"

6 years agoUpdate .mailmap 86/110586/1
David Pursehouse [Wed, 25 Oct 2017 01:56:00 +0000 (10:56 +0900)]
Update .mailmap

Before:

$ git shortlog -n -s | grep Han
    14    Han-Wen Nienhuys
     1    Han-Wen NIenhuys

After:

$ git shortlog -n -s | grep Han
    15    Han-Wen Nienhuys

Change-Id: I2874713f120f09bcbd33a1c48645e25fb5bf9259
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoReintroduce protected method which removal broke EMF Compare 79/110579/1
Matthias Sohn [Tue, 24 Oct 2017 21:13:37 +0000 (23:13 +0200)]
Reintroduce protected method which removal broke EMF Compare

So far we follow OSGi semantic versioning [1] which says the following:

"A change in the second (minor) part of the version signals that the
change is backward compatible with consumers of the API package but not
with the providers of that API. That is, when the API package goes from
version 1.5 to 1.6 it is no longer compatible with a provider of that
API but consumers of that API are backward compatible with that API
package."

The change Ib5fbf17bdaf727bc5d0e106ce88f2620d9f87a6f broke EMF Compare
which subclasses ResolveMerger since we added a new parameter to the
protected ResolveMerger.processEntry() method. According to the above
cited OSGi semantic versioning this is ok, implementers should expect
that they break on minor version changes of the API they implement.

This change reintroduces the old processEntry() method in order to help
avoid breakage for existing EMF Compare versions which expect breakage
also for the implementer case only for major version change (in this
case from JGit 4.x to 5.x).

[1] http://www.osgi.org/wp-content/uploads/SemanticVersioning1.pdf

See: https://dev.eclipse.org/mhonarc/lists/jgit-dev/msg03431.html
Change-Id: I48ba4308dee73925fa32d6c2fd6b5fd89632c571
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRevert "Throw BinaryBlobException from RawParseUtils#lineMap." 67/110567/2
Han-Wen NIenhuys [Tue, 24 Oct 2017 15:25:50 +0000 (11:25 -0400)]
Revert "Throw BinaryBlobException from RawParseUtils#lineMap."

This reverts commit f2e64cd895a6aa4f18ab3b876f13b7814fb98f04.

The newly added throws clause breaks backward compatibility.

Change-Id: Ifa76a1b95935e52640b81cd53c171eb17da175c2
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
6 years agoFix typo in comment 57/110557/2
Han-Wen Nienhuys [Tue, 24 Oct 2017 13:13:10 +0000 (15:13 +0200)]
Fix typo in comment

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

6 years agoThrow BinaryBlobException from RawParseUtils#lineMap. 09/110209/7
Han-Wen Nienhuys [Tue, 17 Oct 2017 13:17:34 +0000 (15:17 +0200)]
Throw BinaryBlobException from RawParseUtils#lineMap.

This makes detection of binaries exact for ResolveMerger and
DiffFormatter: they will classify files as binary regardless of where
the '\0' occurs in the text.

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

6 years agoAvoid loading and merging binary data in ResolveMerger 19/106519/14
Han-Wen Nienhuys [Tue, 10 Oct 2017 14:40:12 +0000 (16:40 +0200)]
Avoid loading and merging binary data in ResolveMerger

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

6 years agoIntroduce ObjectLoader.Filter for delegation 12/110512/2
Han-Wen Nienhuys [Mon, 23 Oct 2017 12:41:00 +0000 (14:41 +0200)]
Introduce ObjectLoader.Filter for delegation

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

6 years agoIntroduce RawText#load. 16/106516/12
Han-Wen Nienhuys [Mon, 9 Oct 2017 16:11:04 +0000 (18:11 +0200)]
Introduce RawText#load.

This method creates a RawText from a blob, but avoids reading the blob
if the start contains null bytes. This should reduce the amount of
garbage that Gerrit produces for changes with binaries.

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

6 years agoAdd missing @since tags for new API in ReceiveCommand 10/110510/1
Matthias Sohn [Mon, 23 Oct 2017 12:22:28 +0000 (14:22 +0200)]
Add missing @since tags for new API in ReceiveCommand

Change-Id: I6e5d29390b71a1c123bc90ec2e3435706ea9211c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.9' 96/110496/1
David Pursehouse [Mon, 23 Oct 2017 03:08:54 +0000 (12:08 +0900)]
Merge branch 'stable-4.9'

* stable-4.9:
  Avoid bad rounding "1 year, 12 months" in date formatter
  Ensure that ~ in ssh config is replaced before Jsch sees it

Change-Id: If6ca55f9447aaea3d7c2d36c03520d5e6dd5193e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAvoid bad rounding "1 year, 12 months" in date formatter 95/110495/1
Michael Keppler [Thu, 12 Oct 2017 07:38:31 +0000 (09:38 +0200)]
Avoid bad rounding "1 year, 12 months" in date formatter

Round first, then calculate the labels. This avoids "x years, 12 months"
and instead produces "x+1 years".

One test case has been added for the original example the bug was found
with, and one assertion has been moved from an existing test case to the
new test case, since it also triggered the bug.

Bug: 525907
Change-Id: I3270af3850c4fb7bae9123a0a6582f93055c9780
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoAlign PackStatistics and DfsPackDescription list length 73/110473/1
Masaya Suzuki [Fri, 20 Oct 2017 19:18:16 +0000 (12:18 -0700)]
Align PackStatistics and DfsPackDescription list length

Without this the caller cannot tell which PackStatistics is for which
pack file.

Change-Id: Ifa530f8bc82459611ae694c0a0d111daec3e08f3
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
7 years agodfs: Switch InMemoryRepository to DfsReftableDatabase 05/103205/16
Shawn Pearce [Sat, 12 Aug 2017 21:31:16 +0000 (14:31 -0700)]
dfs: Switch InMemoryRepository to DfsReftableDatabase

This ensure DfsReftableDatabase is tested by the same test suites that
use/test InMemoryRepository. It also simplifies the logic of
InMemoryRepository and brings its compatibility story closer to any
other DFS repository that uses reftables for its reference storage.

Change-Id: I881469fd77ed11a9239b477633510b8c482a19ca
Signed-off-by: Minh Thai <mthai@google.com>
Signed-off-by: Terry Parker <tparker@google.com>
7 years agoMerge changes from topic 'reftable'
Terry Parker [Thu, 19 Oct 2017 00:25:08 +0000 (20:25 -0400)]
Merge changes from topic 'reftable'

* changes:
  dfs: reftable backed DfsRefDatabase
  Support symbolic references in ReceiveCommand

7 years agodfs: reftable backed DfsRefDatabase 04/103204/16
Shawn Pearce [Sat, 12 Aug 2017 19:19:30 +0000 (12:19 -0700)]
dfs: reftable backed DfsRefDatabase

DfsReftableDatabase is a new alternative for DfsRefDatabase that
handles more operations for the implementor by delegating through
reftables. All reftable files are stored in sibling DfsObjDatabase
using PackExt.REFTABLE and PackSource.INSERT.

Its assumed the DfsObjDatabase periodically runs compactions and GCs
using DfsPackCompactor and DfsGarbageCollector. Those passes are
essential to collapsing the stack of reftables.

Change-Id: Ia03196ff6fd9ae2d0623c3747cfa84357c6d0c79
Signed-off-by: Minh Thai <mthai@google.com>
Signed-off-by: Terry Parker <tparker@google.com>