]> source.dussan.org Git - jgit.git/log
jgit.git
4 years agoUsing StringBuilder in StringUtils#capitalize method 05/154705/2
Lars Vogel [Tue, 17 Dec 2019 22:51:00 +0000 (23:51 +0100)]
Using StringBuilder in StringUtils#capitalize method

StringBuffer is synchronized which is slower and should be replaced with
StringBuilder according to its Javadoc.

Change-Id: If4d4a5a49da289ded34bbec97132ab7636b937cc
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
4 years agoAdd resource preferences for top level jgit project 63/154563/1
Matthias Sohn [Mon, 16 Dec 2019 10:20:12 +0000 (11:20 +0100)]
Add resource preferences for top level jgit project

Define resource preferences for the root directory of the jgit
repository imported as an Eclipse project. This allows to work on files
in the root folder inside Eclipse workspace.

Change-Id: I1885841fd612a646b0b9a31f001ced5ca112e90d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agopgm: add option if reflogs should be written when converting to reftable 40/154540/3
Matthias Sohn [Sat, 14 Dec 2019 22:14:50 +0000 (23:14 +0100)]
pgm: add option if reflogs should be written when converting to reftable

Change-Id: Ie1c38121005965e63015d9a2af26a1caa88d73fa
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agopgm: add option to configure if convert-ref-storage should create backup 39/154539/3
Matthias Sohn [Sat, 14 Dec 2019 22:06:47 +0000 (23:06 +0100)]
pgm: add option to configure if convert-ref-storage should create backup

Change-Id: I926f116797508a5982961dfd30c2f765d9536eee
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoSet config "extensions" option when converting ref storage format 38/154538/2
Matthias Sohn [Sat, 14 Dec 2019 21:45:09 +0000 (22:45 +0100)]
Set config "extensions" option when converting ref storage format

When converting to reftable format the option extensions.refStorage must
be set to "reftable" [1]. When converting back to refdir format this
config option needs to be removed.

Introduce constants for refStorage config options, also for the
"reftree" format.

[1] https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/master/Documentation/technical/reftable.md#Version-1

Change-Id: I190222fa5edc1ad7309daa9be17ca934ff7971e3
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoExternalize error message in FileRepository#convertRefStorage 37/154537/1
Matthias Sohn [Sat, 14 Dec 2019 21:10:12 +0000 (22:10 +0100)]
Externalize error message in FileRepository#convertRefStorage

Change-Id: I5d3acaa883ee7eb8d244b55b3e708cbe018690c6
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoFix indentation in ConvertRefStorage 36/154536/1
Matthias Sohn [Sat, 14 Dec 2019 21:05:16 +0000 (22:05 +0100)]
Fix indentation in ConvertRefStorage

Change-Id: Icd007b035e728f641c70cda68befa11a6197003f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoReplace chain of if statements with switch 64/140164/18
Carsten Hammer [Tue, 21 May 2019 15:04:18 +0000 (17:04 +0200)]
Replace chain of if statements with switch

and switch over strings where possible. Sometimes if statements are
chained and form a series of comparisons against constants. Using switch
statements improves readability.

Bug: 545856
Change-Id: Iacb78956ee5c20db4d793e6b668508ec67466606
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge "Update API baseline for 5.7 to 5.6.0.201912101111-r"
David Pursehouse [Thu, 12 Dec 2019 07:55:08 +0000 (02:55 -0500)]
Merge "Update API baseline for 5.7 to 5.6.0.201912101111-r"

4 years agoMinor - Removes unnecessary whitespace in ReftableReader 17/154317/2
Lars Vogel [Wed, 11 Dec 2019 14:44:20 +0000 (15:44 +0100)]
Minor - Removes unnecessary whitespace in ReftableReader

Change-Id: Id0c3463d1b03e258d8633298828ef7cfcd44e13f
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
4 years agoUpdate API baseline for 5.7 to 5.6.0.201912101111-r 99/154299/1
Matthias Sohn [Wed, 11 Dec 2019 13:43:37 +0000 (14:43 +0100)]
Update API baseline for 5.7 to 5.6.0.201912101111-r

Change-Id: I93280812f8db8fdd91dfcd9e4faa13ed4d6e464c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge branch 'stable-5.6' 98/154298/1
Matthias Sohn [Wed, 11 Dec 2019 13:41:04 +0000 (14:41 +0100)]
Merge branch 'stable-5.6'

* stable-5.6:
  Prepare 5.6.1-SNAPSHOT builds
  JGit v5.6.0.201912101111-r

Change-Id: I7824278560d828e1c6e2d540e3372e19507a39c0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoPrepare 5.6.1-SNAPSHOT builds 60/154260/1
Matthias Sohn [Wed, 11 Dec 2019 01:04:21 +0000 (02:04 +0100)]
Prepare 5.6.1-SNAPSHOT builds

Change-Id: Iaa72d2ea6764ccd4fb6a124b51d89fe6492c602d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoJGit v5.6.0.201912101111-r 22/154222/1 v5.6.0.201912101111-r
Matthias Sohn [Tue, 10 Dec 2019 16:35:05 +0000 (17:35 +0100)]
JGit v5.6.0.201912101111-r

Change-Id: Icbb3b46f9d04e45da53936860e07e69fde12971c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoChange the wildcard import to explicit ones. 57/154157/1
Yunjie Li [Mon, 9 Dec 2019 22:34:16 +0000 (14:34 -0800)]
Change the wildcard import to explicit ones.

Change-Id: Ia7bc1c4b6b82c127e1e4e0e657f69d249684e8e6
Signed-off-by: Yunjie Li <yunjieli@google.com>
4 years agoMerge branch 'stable-5.6' 96/154096/1
Matthias Sohn [Mon, 9 Dec 2019 09:14:38 +0000 (10:14 +0100)]
Merge branch 'stable-5.6'

* stable-5.6:
  Add ability to redirect stderr from git hooks
  Add possibility to get pure stderr output from AbortedByHookException

Change-Id: Ifc02675542dad6ced25fdd8b9fae80b5736db688
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoAdd ability to redirect stderr from git hooks 36/153536/2
Tim Neumann [Thu, 28 Nov 2019 14:56:50 +0000 (15:56 +0100)]
Add ability to redirect stderr from git hooks

This will change the behavior in the CLI to resemble that of C-Git more
closely by printing the stderr of the hooks to the CLI stderr
independently of the exit code of the hook.

This is also useful for the corresponding EGIT-Change, which will add
the ability to show the hook output in eclipse.
With this also the stderr can be shown even if the exit code is 0.

Bug: 553471
Change-Id: Ie7bc503fe39e270e9b93dd1108b5879f02a12b4c
Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
4 years agoAdd possibility to get pure stderr output from AbortedByHookException 28/153528/2
Tim Neumann [Thu, 28 Nov 2019 11:56:12 +0000 (12:56 +0100)]
Add possibility to get pure stderr output from AbortedByHookException

This is a preparation for the corresponding EGit change to remove
redundant output in the aborted by commit hook popup.

Bug: 553469
Change-Id: Id5f39a4df659fafc9d951668e6f53fed4380de9d
Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge branch 'stable-5.6' 58/153958/1
David Pursehouse [Fri, 6 Dec 2019 01:19:58 +0000 (10:19 +0900)]
Merge branch 'stable-5.6'

* stable-5.6:
  Cleanup CommitAndLogCommandTest
  CLI: Add support for excluding paths from Git log command

Change-Id: I2f48e16640ab1b13f0c32779422add3162260c50
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoFix API check errors introduced in ReceivePack in 945d43d5 54/153954/1
Matthias Sohn [Thu, 5 Dec 2019 22:34:40 +0000 (23:34 +0100)]
Fix API check errors introduced in ReceivePack in 945d43d5

- add missing @since tag on new field connectivityChecker
- suppress warning for this added field which may affect subclasses
which is ok

Change-Id: Id6c22258efd10fa3847290f3dcfa42893b6ae882
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoCleanup CommitAndLogCommandTest 49/153949/1
Matthias Sohn [Thu, 5 Dec 2019 21:48:55 +0000 (22:48 +0100)]
Cleanup CommitAndLogCommandTest

- if a test can throw different exceptions declare it throws Exception
- fix code formatting

Change-Id: I55d63918f3163b31f2297d6217d5855108dd43b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoCLI: Add support for excluding paths from Git log command 73/153673/5
John Tipper [Mon, 2 Dec 2019 23:00:19 +0000 (23:00 +0000)]
CLI: Add support for excluding paths from Git log command

Git log supports the exclude pathspec, which allows for excluding paths
from the log command. JGit only supports adding paths to the log
command. See the following StackOverflow question for details:
https://stackoverflow.com/questions/59143934/java-jgit-how-to-get-git-
commits-not-affecting-certain-directories
This commit adds an excludePath() method to the log command. It does not
yet support regex or glob wildcards.

Change-Id: I8cd59950b87850b55a15c7e2ea5470145c9aae28
Signed-off-by: John Tipper <john_tipper@hotmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoReceivePack: Moves connectivity check to separate class 97/152097/11
Demetr Starshov [Tue, 8 Oct 2019 23:53:22 +0000 (16:53 -0700)]
ReceivePack: Moves connectivity check to separate class

Move all connectivity check to separate classes. Set default to be
FullConnectivityChecker i.e. checker which will check connectivity
from all advertised refs. Add ability to set other connectivity
checker which can use different approach.

Signed-off-by: Demetr Starshov <dstarshov@google.com>
Change-Id: Ibb107dbfbdde8ad109be25b5ecf42be7660ef736

4 years agoUpgrade error_prone_core to 2.3.4 55/153755/3
David Pursehouse [Wed, 4 Dec 2019 03:57:40 +0000 (12:57 +0900)]
Upgrade error_prone_core to 2.3.4

Change-Id: I7e91acc4d094d92cac41d5044268dfc2208bb663
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.6' 72/153872/1
David Pursehouse [Thu, 5 Dec 2019 01:46:40 +0000 (10:46 +0900)]
Merge branch 'stable-5.6'

* stable-5.6:
  ReftableTest: Clean up boxing warnings on usage of String.format
  MergedReftable: Remove unnecessary semicolon

Change-Id: Id35406acfdd91c3ddf17ce4e1023395f774774f2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoSuppress API error for RefDatabase.hasFastTipsWithSha1() 66/153866/1
Matthias Sohn [Thu, 5 Dec 2019 00:56:31 +0000 (01:56 +0100)]
Suppress API error for RefDatabase.hasFastTipsWithSha1()

This method was added in stable-5.6 after 5.6 RC1 was tagged. It's shown
as an API error when using 5.6.0 RC1 as the API baseline for master.
This suppression can be removed when 5.6 is released which will serve as
the API baseline for 5.7.

Change-Id: Ic6359fe59ed2d2a9431583b0854ec86bbac76880
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoRemove API filters which became obsolete after bumping version to 5.7.0 65/153865/1
Matthias Sohn [Thu, 5 Dec 2019 00:55:04 +0000 (01:55 +0100)]
Remove API filters which became obsolete after bumping version to 5.7.0

Change-Id: I00b8d3e2e1023794f24d9447e3b0214c50353838
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoReftableTest: Clean up boxing warnings on usage of String.format 67/153867/1
David Pursehouse [Thu, 5 Dec 2019 00:54:14 +0000 (09:54 +0900)]
ReftableTest: Clean up boxing warnings on usage of String.format

Passing int as an argument to String.format causes a warning:

  The expression of type int is boxed into Integer

Most of these are already suppressed, but there are a couple that are
not. Add suppressions for those.

For the existing ones, move the suppression scope from the method to
the actual usage. Where necessary extract the usage out to a local
variable.

Change-Id: I7a7ff6dec49467e4b5c58d27a231c74e6e1c5437
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoAdd missing @since tag for ReceivePack#receiveWithExceptionPropagation 64/153864/1
Matthias Sohn [Thu, 5 Dec 2019 00:51:29 +0000 (01:51 +0100)]
Add missing @since tag for ReceivePack#receiveWithExceptionPropagation

Change-Id: Ie64abc3e5bcf6dbaecfa8f2cb50796703ebd1f39
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMergedReftable: Remove unnecessary semicolon 61/153861/1
David Pursehouse [Thu, 5 Dec 2019 00:42:52 +0000 (09:42 +0900)]
MergedReftable: Remove unnecessary semicolon

Change-Id: I67d2b8ba3cd8f94363cea864918c8ed6026f2d18
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoPrepare 5.7.0-SNAPSHOT builds 63/153863/1
Matthias Sohn [Thu, 5 Dec 2019 00:32:59 +0000 (01:32 +0100)]
Prepare 5.7.0-SNAPSHOT builds

Change-Id: I7efa0cd08dee711d6fefc3e6bb478a3cb11fe85c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge branch 'stable-5.6' 62/153862/1
Matthias Sohn [Thu, 5 Dec 2019 00:31:32 +0000 (01:31 +0100)]
Merge branch 'stable-5.6'

* stable-5.6:
  Introduce RefDatabase#hasFastTipsWithSha1
  Update Orbit to R20191126223242 for 2019-12
  Prepare 5.6.0-SNAPSHOT builds
  JGit v5.6.0.201912041214-rc1
  Prepare 5.6.0-SNAPSHOT builds
  JGit v5.6.0.201911271000-m3

Change-Id: Id33b054131bbcd27a0ae7200f564775049698d2c

4 years agoIntroduce RefDatabase#hasFastTipsWithSha1 43/152843/13
Han-Wen Nienhuys [Mon, 18 Nov 2019 00:29:16 +0000 (16:29 -0800)]
Introduce RefDatabase#hasFastTipsWithSha1

The reftable format supports fast inverse (SHA1 => ref) queries.

If the ref database does not support fast inverse queries, it may be
advantageous to build a complete SHA1 to ref map in advance for
multiple uses. To let applications decide, this function indicates
whether the inverse map is available.

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

4 years agoUpdate Orbit to R20191126223242 for 2019-12 50/153850/1
Matthias Sohn [Wed, 4 Dec 2019 21:41:13 +0000 (22:41 +0100)]
Update Orbit to R20191126223242 for 2019-12

Change-Id: I205d4f4a529f34c15a1afb4c791088a8e22986f0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoPrepare 5.6.0-SNAPSHOT builds 43/153843/1
Matthias Sohn [Wed, 4 Dec 2019 21:13:56 +0000 (22:13 +0100)]
Prepare 5.6.0-SNAPSHOT builds

Change-Id: I5e737ff7f262fdd43fc975a0b3594c8b33919663
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoJGit v5.6.0.201912041214-rc1 24/153824/1 v5.6.0.201912041214-rc1
Matthias Sohn [Wed, 4 Dec 2019 17:14:43 +0000 (18:14 +0100)]
JGit v5.6.0.201912041214-rc1

Change-Id: I5ed21fbc5f83096bf0b79f2aa751db415cbcc7e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge changes I1f968649,Ied678797
Terry Parker [Mon, 2 Dec 2019 23:21:33 +0000 (18:21 -0500)]
Merge changes I1f968649,Ied678797

* changes:
  UploadPackServlet: Use uploadWithExceptionPropagation
  GitSmartHttpTools: Do not use sideband when sending an error

4 years agoserver: Add a custom error handler 62/152362/3
Masaya Suzuki [Fri, 8 Nov 2019 18:48:03 +0000 (10:48 -0800)]
server: Add a custom error handler

Same as UploadPack, add a custom error handler.

Change-Id: I9c708aa5a22e01214c1d997fa6f72f4b8bf814f0
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Add methods that do not handle exceptions 61/152361/2
Masaya Suzuki [Fri, 8 Nov 2019 18:31:16 +0000 (10:31 -0800)]
transport: Add methods that do not handle exceptions

Same as UploadPack. These methods do not handle exceptions and the
caller can handle them. This makes it possible to customize the error
handling.

Change-Id: Ia5203f80133cb5b3e5d754859b4167ac920eaf14
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Let users specify an error handler for unpacking a pack file 60/152360/2
Masaya Suzuki [Fri, 8 Nov 2019 18:12:20 +0000 (10:12 -0800)]
transport: Let users specify an error handler for unpacking a pack file

Currently, there's no way for a user to customize the error handler for
the exception happened during unpacking an incoming pack file. Create an
error handler class and let them specify one.

Change-Id: Id07638ee58c88e1365181c3ddd17ee0266f3934d
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agoReceivePack: Use try-with-resources for PostReceiveHook 59/152359/2
Masaya Suzuki [Fri, 8 Nov 2019 03:07:57 +0000 (19:07 -0800)]
ReceivePack: Use try-with-resources for PostReceiveHook

Instead of dropping a second exception, use try-with-resources so that
exception thrown by a hook is attached as a suppressed exception.

This removes a need of holding an exception that is thrown while
unpacking an incoming packfile.

Change-Id: I74d8b944931abbf53d9d1ae5db2e889639fba027
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Consolidate status reporting code 58/152358/2
Masaya Suzuki [Fri, 8 Nov 2019 02:52:17 +0000 (18:52 -0800)]
transport: Consolidate status reporting code

BaseReceivePack#sendStatusReport anyway needs to know
CAPABILITY_REPORT_STATUS. By moving this flag to BaseReceivePack,
simplify the status reporting code.

Change-Id: Iaa0878b1fc13057b687a7f01d25c85fd78c0423e
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Add ReceiveCommandErrorHandler 57/152357/2
Masaya Suzuki [Fri, 8 Nov 2019 02:22:17 +0000 (18:22 -0800)]
transport: Add ReceiveCommandErrorHandler

This gives a chance to handle an exception for a user. For example, when
an IOException is thrown while executing
`walk.parseAny(cmd.getNewId())`, it's always handled as
REJECTED_MISSING_OBJECT. However, IOException can mean a Git storage IO
error. By introducing an error handler class, a user can add a custom
error handler for these cases.

Change-Id: I3e03a536e1d8e137cb0f6e596d71642e72adde9e
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Move exception handler to the caller 56/152356/2
Masaya Suzuki [Fri, 8 Nov 2019 01:40:25 +0000 (17:40 -0800)]
transport: Move exception handler to the caller

Move exception handling code to the caller side. This is a preparation
for adding a custom error handler that is similar to UploadPack.

Note that `catch (Throwable t)` will not affect the exception spec since
Java will do an analysis of rethrown exceptions. See
https://docs.oracle.com/javase/8/docs/technotes/guides/language/catch-multiple.html.

Change-Id: I973a63d4b079c2cd1402afb3f2956e18b7d5a00c
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agotransport: Move handling code to the caller side 54/152354/2
Masaya Suzuki [Fri, 8 Nov 2019 01:15:57 +0000 (17:15 -0800)]
transport: Move handling code to the caller side

This removes a raw IOException at one level. Later we'll add a custom
exception handling mechanism like UploadPack.

Change-Id: I52a7423798c97b032d848351be8b6f144776b017
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agoUploadPackServlet: Use uploadWithExceptionPropagation 64/152364/2
Masaya Suzuki [Fri, 8 Nov 2019 22:30:29 +0000 (14:30 -0800)]
UploadPackServlet: Use uploadWithExceptionPropagation

As UploadPackErrorHandler's Javadoc says, UploadPackServlet should have
called uploadWithExceptionPropagation and let UploadPackErrorHandler to
handle the exception. Fix UploadPackServlet.

Change-Id: I1f9686495fcf3ef28598ccdff3e6f76a16c8bca3
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agoGitSmartHttpTools: Do not use sideband when sending an error 63/152363/2
Masaya Suzuki [Fri, 8 Nov 2019 22:40:19 +0000 (14:40 -0800)]
GitSmartHttpTools: Do not use sideband when sending an error

Unlike ReceivePack, the V0/V1 UploadPack response does not support
sideband except for the packfile parts. By sending an error in a
sideband packet, the JGit client says "Expected ACK/NACK, got: ...".

Use an error packet always. The recent Git clients will understand it
better than out-of-context sideband packets.

Change-Id: Ied6787973d3b6860c0b95c7910d4e4312bb7a184
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agoPrepare 5.6.0-SNAPSHOT builds 08/153508/1
Matthias Sohn [Wed, 27 Nov 2019 20:25:38 +0000 (21:25 +0100)]
Prepare 5.6.0-SNAPSHOT builds

Change-Id: I1e52d2dfb202b87ecb9d0273deaa2c8d8ce1864e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoJGit v5.6.0.201911271000-m3 91/153491/1 v5.6.0.201911271000-m3
Matthias Sohn [Wed, 27 Nov 2019 15:01:20 +0000 (16:01 +0100)]
JGit v5.6.0.201911271000-m3

Change-Id: I3810892c2bed947e4dfaa615a7b4d93eeb46abb9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge "ReceivePack: Open visibility for some methods"
Jonathan Nieder [Wed, 27 Nov 2019 04:56:40 +0000 (23:56 -0500)]
Merge "ReceivePack: Open visibility for some methods"

4 years agoReceivePack: Open visibility for some methods 24/152924/5
Ivan Frade [Tue, 19 Nov 2019 06:45:19 +0000 (22:45 -0800)]
ReceivePack: Open visibility for some methods

This partially reverts Ic6bb5e66. It made private some methods in
ReceivePack that were protected before. At least two of those methods
(#init and #receivePackAndCheckConnectivity) are used by out-of-tree
subclasses for tracing and testing.

Make ReceivePack#init() and ReceivePack#receivePackAndCheckConnectivity
protected again to allow tracing and testing.

Change-Id: I7ff22c091fbfc2d94009c449d58e7c5ac9f4f759
Signed-off-by: Ivan Frade <ifrade@google.com>
4 years agoJGit pgm: Format blame output to match canonical git 31/147131/13
Thomas Wolf [Tue, 6 Aug 2019 16:32:35 +0000 (18:32 +0200)]
JGit pgm: Format blame output to match canonical git

Canonical git shows the zero-Id for lines without commit, and
uses the current time stamp for such lines.

Also consider lines without commit when calculating the field
widths.

Change-Id: If0bee9b3e7f90861ad0f387f68e52ecc4a53dfd7
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMake blame work correctly on merge conflicts 30/147130/13
Thomas Wolf [Tue, 6 Aug 2019 16:31:35 +0000 (18:31 +0200)]
Make blame work correctly on merge conflicts

When a conflicting file was blamed, JGit would not identify lines
coming from the merge parents. The main cause for this was that
Blame and BlameCommand simply added the first DirCacheEntry found
for a file to its queue of candidates (blobs or commits) to consider.
In case of a conflict this typically is the merge base commit, and
comparing a auto-merged contents against that base would yield
incorrect results.

Such cases have to be handled specially. The candidate to be
considered by the blame must use the working tree contents, but
at the same time behave like a merge commit/candidate with HEAD
and the MERGE_HEADs as parents. Canonical git does something very
similar, see [1].

Implement that and add tests.

I first did this for the JGit pgm Blame command. When I then tried
to do the same in BlameCommand, I noticed that the latter also
included some fancy but incomplete CR-LF handling. In order to
be able to use the new BlameGenerator.prepareHead() also in
BlameCommand this CR-LF handling was also moved into BlameGenerator
and corrected in doing so.

(Just considering the git config settings was not good enough,
CR-LF behavior can also be influenced by .gitattributes, and even
by whether the file in the index has CR-LF. To correctly determine
CR-LF handling for check-in one needs to do a TreeWalk with at
least a FileTreeIterator and a DirCacheIterator.)

[1] https://github.com/git/git/blob/v2.22.0/blame.c#L174

Bug: 434330
Change-Id: I9d763dd6ba478b0b6ebf9456049d6301f478ef7c
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMerge branch 'stable-5.5' 83/153383/1
David Pursehouse [Tue, 26 Nov 2019 08:44:48 +0000 (17:44 +0900)]
Merge branch 'stable-5.5'

* stable-5.5:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: Ie32c3bae056fb0745892e6c20ad37d4994542d96
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.4' into stable-5.5 82/153382/1
David Pursehouse [Tue, 26 Nov 2019 08:44:06 +0000 (17:44 +0900)]
Merge branch 'stable-5.4' into stable-5.5

* stable-5.4:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: I3dd2554cbad5bb224c2799b6b133fe91ab10abc3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.3' into stable-5.4 81/153381/1
David Pursehouse [Tue, 26 Nov 2019 08:43:20 +0000 (17:43 +0900)]
Merge branch 'stable-5.3' into stable-5.4

* stable-5.3:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: I21878c42fd9abf7d858b534300df0fffe4bad431
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.2' into stable-5.3 80/153380/1
David Pursehouse [Tue, 26 Nov 2019 08:42:10 +0000 (17:42 +0900)]
Merge branch 'stable-5.2' into stable-5.3

* stable-5.2:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: Ie5e66f2e26c057c81101b0d110f91ea479eb362d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge branch 'stable-5.1' into stable-5.2 79/153379/1
David Pursehouse [Tue, 26 Nov 2019 08:41:04 +0000 (17:41 +0900)]
Merge branch 'stable-5.1' into stable-5.2

* stable-5.1:
  Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl
  Bazel: Add missing newlines at end of BUILD files

Change-Id: Ic1dc84a6c4a1cf430d329627642583fd6e0d0eaa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoBazel: Use java_plugin and java_binary from @rules_java in jmh.bzl 64/153364/2
David Pursehouse [Tue, 26 Nov 2019 03:17:52 +0000 (12:17 +0900)]
Bazel: Use java_plugin and java_binary from @rules_java in jmh.bzl

Change-Id: I80456f74bc17a1ebb0248fce8050a4cb07bf18f1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoBazel: Add missing newlines at end of BUILD files 63/153363/2
David Pursehouse [Tue, 26 Nov 2019 03:16:47 +0000 (12:16 +0900)]
Bazel: Add missing newlines at end of BUILD files

Change-Id: I11afc45141da988e28382898246995f6b45eb09c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoUpgrade maven-enforcer-plugin to 3.0.0-M3 57/153357/2
David Pursehouse [Tue, 26 Nov 2019 00:17:55 +0000 (09:17 +0900)]
Upgrade maven-enforcer-plugin to 3.0.0-M3

Change-Id: Ie6b090ada9bcb36e018b0f991c09307f79655ba4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoMerge changes I8698001d,I5c1177ac
Jonathan Nieder [Tue, 26 Nov 2019 01:56:23 +0000 (20:56 -0500)]
Merge changes I8698001d,I5c1177ac

* changes:
  Add missing license header to ReftableDatabase
  Add missing license header to UploadPackRefSortingForReachabilityTest

4 years agoAdd missing license header to ReftableDatabase 61/153361/1
Jonathan Nieder [Tue, 26 Nov 2019 01:42:59 +0000 (17:42 -0800)]
Add missing license header to ReftableDatabase

When this class was split from DfsReftableDatabase in commit
2b1e942729617c45d2cb03b7556ab3d63253f64f (reftable: split off generic
code from DFS code, 2019-09-26), we forgot to carry over the license
header.

Change-Id: I8698001dfb69f58784df643ef0185ab2d55e52aa
Reported-by: Masaya Suzuki <masayasuzuki@google.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
4 years agoAdd missing license header to UploadPackRefSortingForReachabilityTest 60/153360/2
Jonathan Nieder [Tue, 26 Nov 2019 01:37:40 +0000 (17:37 -0800)]
Add missing license header to UploadPackRefSortingForReachabilityTest

Forgot to add this in commit 989a927a5f0aa21745d560e77e9eb7c76682c117
(checkNotAdvertisedWants: Be lazy convering Ref to RevCommit,
2019-11-20).

Change-Id: I5c1177ac60eabb3a71959bbad4537e076a901b7e
Signed-off-by: Jonathan Nieder <jrn@google.com>
4 years ago[spotbugs] Fix potential NPE in FSTest 59/153359/1
Matthias Sohn [Tue, 26 Nov 2019 00:48:43 +0000 (01:48 +0100)]
[spotbugs] Fix potential NPE in FSTest

Change-Id: I6ca37d045642e3aada7e6b42b3cb8c3bba014455
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoRemove unused import in CreateFileSnapshotBenchmark 58/153358/1
Matthias Sohn [Tue, 26 Nov 2019 00:14:47 +0000 (01:14 +0100)]
Remove unused import in CreateFileSnapshotBenchmark

Change-Id: Ic02f32fb882602e573f34d0a38d850f43aadf7ba
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoRepositoryCache: don't require HEAD in git repositories 42/152842/8
Han-Wen Nienhuys [Sun, 17 Nov 2019 23:05:57 +0000 (15:05 -0800)]
RepositoryCache: don't require HEAD in git repositories

Reftable-enabled repositories don't have a file called HEAD. Check for
reftable/ instead.

This fixes repository creation on reftable in Gerrit.

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

4 years agoFileRepository: cleanup refs outside refs/ on reftable conversion 14/153014/5
Han-Wen Nienhuys [Wed, 20 Nov 2019 03:55:06 +0000 (19:55 -0800)]
FileRepository: cleanup refs outside refs/ on reftable conversion

Change-Id: Iab7d3a08906e826e26572f534512a09d3a5876b0
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoMerge "UploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed"
Jonathan Nieder [Tue, 26 Nov 2019 00:40:50 +0000 (19:40 -0500)]
Merge "UploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed"

4 years agoUpdate Orbit to S20191118194249 for 2019-12 M3 54/153354/1
Matthias Sohn [Mon, 25 Nov 2019 22:57:24 +0000 (23:57 +0100)]
Update Orbit to S20191118194249 for 2019-12 M3

Change-Id: I22426309dec6caabd26abb1eb31bdbff945d220c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoSilence API error for new method in ReachabilityChecker 52/153352/2
Matthias Sohn [Mon, 25 Nov 2019 22:41:04 +0000 (23:41 +0100)]
Silence API error for new method in ReachabilityChecker

Following OSGi semantic versioning which tolerates breaking implementers
in a minor release.

Change-Id: I4600c5ee9cd4ae209b69870a5d1367f83678617e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoUploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed 83/153283/1
David Pursehouse [Mon, 25 Nov 2019 00:31:49 +0000 (09:31 +0900)]
UploadPackTest: Fix unused parameter in checkUnadvertisedIfUnallowed

Change-Id: I6042c401fff55325128d47e7e9098fc7e60d501d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoBitmappedReachabilityChecker: Use only one bitmap for the whole check 02/152702/16
Ivan Frade [Thu, 14 Nov 2019 21:56:27 +0000 (13:56 -0800)]
BitmappedReachabilityChecker: Use only one bitmap for the whole check

The checker is creating a new bitmap per branch leading to excessive
memory consumption. For the reachability check one bitmap with the
reachability of all branches aggregated is enough.

Build the reachability bitmap with a filter. The filter itself uses it
to emit only commits not reached before and the caller to check what
targets have been reached already.

BitmapCalculator is not required anymore.

Change-Id: Ic5c62f77fe0f188913215b7eaa51d849a9aae6a5
Signed-off-by: Ivan Frade <ifrade@google.com>
4 years agocheckNotAdvertisedWants: Be lazy converting Ref to RevCommit 89/152989/8
Ivan Frade [Tue, 19 Nov 2019 20:08:53 +0000 (12:08 -0800)]
checkNotAdvertisedWants: Be lazy converting Ref to RevCommit

The ref points to an ObjectId that then is translated into a RevCommit.
This translation can be costly and with the incremental reachability
check is probably not needed for most of the elements.

Delay the translation from ObjectId to RevCommit to when it is needed.
Use Streams, that have the laziness built-in, all the way from Ref to
RevCommit.

This should reduce the latency for reachability checks over big sets of
references.

Change-Id: I28693087321b2beff3eaa1f3d2e7840ab0eedc6d
Signed-off-by: Ivan Frade <ifrade@google.com>
4 years agoReachabilityChecker: Receive a Stream instead of a Collection 88/152988/6
Ivan Frade [Tue, 19 Nov 2019 18:40:21 +0000 (10:40 -0800)]
ReachabilityChecker: Receive a Stream instead of a Collection

Preparatory change. Converting ObjectIds to RevCommits is potentially
expensive and in the incremental reachability check, it is probably not
required for all elements in the collection.

Pass a Stream to the reachability checker. In the follow up we make
the conversion from ObjectId to RevCommit in the stream (i.e. on
demand). This should reduce the latency of reachability checks over big
sets of references.

Change-Id: I9f310e331de5b0bf8de34143bd7dcd34316d2fba
Signed-off-by: Ivan Frade <ifrade@google.com>
4 years agoUploadPack: Prioritize references for non-advertised wants checks 32/152532/6
Ivan Frade [Tue, 12 Nov 2019 22:33:29 +0000 (14:33 -0800)]
UploadPack: Prioritize references for non-advertised wants checks

UploadPack needs to check if object ids that weren't advertised before
are reachable from the references visible to the user. In the
bitmap-based reachability check, this is done incrementally: checking
against one reference, if anything remaining adding a second and so on.
It is more efficient to check first more common references (e.g. refs/heads/*)

Sort the references for the reachability checker. This should solve the
connectivity earlier and require less bitmap creation and less memory.

Change-Id: I48ac10d71e29fab2d346479802401eaea4aacb5c
Signed-off-by: Ivan Frade <ifrade@google.com>
4 years agoReceivePack: Fix name hiding of 'atomic' member 32/152832/1
David Pursehouse [Sun, 17 Nov 2019 18:30:46 +0000 (10:30 -0800)]
ReceivePack: Fix name hiding of 'atomic' member

Change-Id: Ia357d49ca793ff1cb86e7130bc1a5f59590496a9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoReceivePack: Remove unnecessarily nested else-clause 31/152831/1
David Pursehouse [Sun, 17 Nov 2019 18:27:05 +0000 (10:27 -0800)]
ReceivePack: Remove unnecessarily nested else-clause

Change-Id: I604ea76e03503300a381eca9c213f73677b5e21f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoSimplify comparator code 28/152828/1
Michael Keppler [Sun, 17 Nov 2019 17:07:09 +0000 (18:07 +0100)]
Simplify comparator code

Use lambda style comparators where possible. They are easier to read.

Change-Id: I5b80cfcd90909c94286742fa83af71015532809f
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
4 years agoFix typo in Javadoc 27/152827/1
Michael Keppler [Sun, 17 Nov 2019 17:05:46 +0000 (18:05 +0100)]
Fix typo in Javadoc

No functional changes.

Change-Id: Ic7f9bb85806eca2788303c2f808d003cdfc7cc7c
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
4 years agopgm: add write stats to BenchmarkReftable 07/152607/21
Han-Wen Nienhuys [Wed, 13 Nov 2019 23:23:01 +0000 (15:23 -0800)]
pgm: add write stats to BenchmarkReftable

Usage:

  git ls-remote https://gerrit.googlesource.com/gerrit > lsr

  bazel build org.eclipse.jgit.pgm:jgit && rm -rf /tmp/reftable* && \
    ./bazel-bin/org.eclipse.jgit.pgm/jgit debug-benchmark-reftable \
    --test write_stack lsr /tmp/reftable

On my Lenovo x250 laptop, this yields about 1ms per ref write.

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

4 years agopgm: add command to convert repo to reftable 35/148735/57
Han-Wen Nienhuys [Thu, 29 Aug 2019 18:18:10 +0000 (20:18 +0200)]
pgm: add command to convert repo to reftable

Change-Id: I2f870699995da164a3e7adec430301ac7a53c425
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agofile: implement FileReftableDatabase 68/146568/92
Han-Wen Nienhuys [Mon, 12 Aug 2019 15:33:51 +0000 (17:33 +0200)]
file: implement FileReftableDatabase

Reftable is a binary, block-based storage format for the ref-database.
It provides several advantages over the traditional packed + loose
storage format:

 * O(1) write performance, even for deletions and transactions.

 * atomic updates to the ref database.

 * O(log N) lookup and prefix scans

 * free from restrictions imposed by the file system: it is
   case-sensitive even on case-insensitive file systems, and has
   no inherent limitations for directory/file conflicts

 * prefix compression reduces space usage for repetitive ref names,
   such as gerrit's refs/changes/xx/xxxxx format.

FileReftableDatabase is based on FileReftableStack, which does
compactions inline. This is simple, and has good median performance,
but every so often it will rewrite the entire ref database.

For testing, a FileReftableTest (mirroring RefUpdateTest) is added to
check for Reftable specific behavior. This must be done separately, as
reflogs have different semantics.

Add a reftable flavor of BatchRefUpdateTest.

Add a FileReftableStackTest to exercise compaction.

Add FileRepository#convertToReftable so existing testdata can be
reused.

CQ: 21007
Change-Id: I1837f268e91c6b446cb0155061727dbaccb714b8
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoFix Maven missing version warning 92/152792/1
Michael Keppler [Sat, 16 Nov 2019 15:49:38 +0000 (16:49 +0100)]
Fix Maven missing version warning

[WARNING] Some problems were encountered while building the effective
model for org.eclipse.jgit:org.eclipse.jgit.benchmarks:jar:5.6.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-shade-plugin is missing. @ line 131,
column 15

Change-Id: Id25916c460bc4a10d0f797779d24f53292df2b77
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
4 years agoUse Java 8 source and target in Maven 90/152790/1
Michael Keppler [Sat, 16 Nov 2019 15:23:34 +0000 (16:23 +0100)]
Use Java 8 source and target in Maven

Building the jgit aggregator with Maven leads to a compiler level 1.6
for me, thereby failing the build. Multiple profiles specify
source/target level separately, but there seems no global setting.
Adding the global properties makes the jgit aggregator compile on my
system.

Change-Id: Ia5613cc0fcf6085265a9e48f940e5a7d3f998608
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
4 years agoReceivePack: Reduce visibility of methods 26/152626/7
David Pursehouse [Thu, 14 Nov 2019 00:40:14 +0000 (16:40 -0800)]
ReceivePack: Reduce visibility of methods

Several methods were protected when they were defined in BaseReceivePack
which has since been squashed into ReceivePack. Those methods no longer
need to be protected, and can now be private instead.

Change-Id: Ic6bb5e66f353fcbdc7919847423234af398c88b4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoSuppress API error raised for constant added in 345e2648 70/152770/1
Matthias Sohn [Sat, 16 Nov 2019 08:17:32 +0000 (00:17 -0800)]
Suppress API error raised for constant added in 345e2648

Change-Id: I29fb091f27f38c74843d50c2602164fc63ab8a16
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoTopoSortGenerator: simplify first-parent handling 61/151661/3
Thomas Wolf [Sat, 26 Oct 2019 17:46:31 +0000 (19:46 +0200)]
TopoSortGenerator: simplify first-parent handling

Change-Id: I74b40f1a2f81911c1d5ac5ae93b4a160fccf8f73
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoRewriteGenerator: avoid adding null parent 57/151657/4
Thomas Wolf [Fri, 25 Oct 2019 23:00:16 +0000 (01:00 +0200)]
RewriteGenerator: avoid adding null parent

Prevent adding a null parent to a commit's parent array. Doing so
can cause NPEs later on.

Bug: 552160
Change-Id: Ib24b7b9b7b08e0b6f246006b4a4cade7eeb830b9
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoDiffFormatter: support core.quotePath = false 10/151710/4
Thomas Wolf [Mon, 28 Oct 2019 17:11:57 +0000 (18:11 +0100)]
DiffFormatter: support core.quotePath = false

core.quotePath = false means that "bytes higher than 0x80 are not
considered "unusal" anymore"[1], i.e., they are not escaped. In
essence this preserves non-ASCII characters in path names in output.

Note that control characters and other special characters in the
ASCII range will still be escaped.

Add a new QuotedString.GIT_PATH_MINIMAL singleton implementing this.
Change the normal GIT_PATH algorithm to use bytes instead of characters
so it can be re-used. Provide a setter in DiffFormatter for the quoting
style so that an application can override the default, which is the
setting from the git config (and by default "true"). Use the new
QuotedString.GIT_PATH_MINIMAL when core.quotePath == false.

[1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath

Bug: 552467
Change-Id: Ifcb233e7d10676333bf42011e32d01a4e1138059
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoIndexDiff/SubmoduleWalk: make the RepositoryBuilder configurable 60/151660/6
Thomas Wolf [Sat, 26 Oct 2019 17:58:07 +0000 (19:58 +0200)]
IndexDiff/SubmoduleWalk: make the RepositoryBuilder configurable

Some applications using JGit use their own repository caching. In
such applications, it may be needlessly inefficient to create new
submodule repositories from a SubmoduleWalk or in an IndexDiff. It
can be much more efficient to use an already cached repository
instance.

Provide a way to configure a SubmoduleWalk with a factory to create
BaseRepositoryBuilders to use to create repositories, and use it in
IndexDiff. Provide new IndexDiff.diff() operations that take such an
additional factory as parameter.

An application that caches Repository instances (for instance EGit)
can use a factory that provides builders that don't create a new
Repository instance but that return the already cached instance, if
one is available. Note that in such a case, the application may need
to be prepared to deal with IndexDiff.diff() also _closing_ the
obtained repository; if the application expects its cached Repository
instances to remain open while being cached, it'll have to use
Repository.incrementOpen() to prevent that the repository instance
gets closed.

Bug: 550878
Change-Id: Icc1b34dfc4cebd8ed4739dd09d37744d41adf711
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoIndexDiff/SubmoduleWalk: handle submodule.<name>.ignore correctly 07/151407/4
Thomas Wolf [Mon, 21 Oct 2019 20:28:50 +0000 (22:28 +0200)]
IndexDiff/SubmoduleWalk: handle submodule.<name>.ignore correctly

IndexDiff would apply ignore mode ALL from .gitmodules to all remaining
submodules, and would ignore other settings from .gitignore and always
apply the setting defined on the IndexDiff instead. Correct that.

In canonical git the ignore setting from .gitmodules can also be
overridden by .git/config.[1] Implement that override in SubmoduleWalk.

[1] https://git-scm.com/docs/gitmodules#Documentation/gitmodules.txt-submoduleltnamegtignore

Bug: 521613
Change-Id: I9199fd447e41c7838924856dce40678370b66395
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
4 years agoMerge changes I583491f6,Idd44e3bb
Jonathan Nieder [Thu, 14 Nov 2019 23:21:04 +0000 (18:21 -0500)]
Merge changes I583491f6,Idd44e3bb

* changes:
  Run Eclipse formatter on BatchRefUpdateTest
  Move KetchSystem.delay to FileUtils.

4 years agoRun Eclipse formatter on BatchRefUpdateTest 00/152700/1
Han-Wen Nienhuys [Thu, 14 Nov 2019 21:48:28 +0000 (13:48 -0800)]
Run Eclipse formatter on BatchRefUpdateTest

Change-Id: I583491f621e54401c60150efb285fcc7243a9355
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
4 years agoSuppress the API errors introduced by 3e9a5f99 85/152685/1
Matthias Sohn [Thu, 14 Nov 2019 18:08:24 +0000 (10:08 -0800)]
Suppress the API errors introduced by 3e9a5f99

I1ce92869435d5eebb7d671be44561e69c6233134 merged BaseReceivePack into
ReceivePack which breaks API but is only affecting the few jgit based
servers out in the wild.

Change-Id: Iad856a2afaf3cad95d01ad81a0116cebcd9de2d9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
4 years agoReceivePack: Remove unused getLockMessageProcessName method 25/152625/1
David Pursehouse [Thu, 14 Nov 2019 00:33:34 +0000 (16:33 -0800)]
ReceivePack: Remove unused getLockMessageProcessName method

Change-Id: I85a0c3e3a53f87ad6f6eda41c7c6cb41b403b3bb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agoReceivePack: Remove unnecessary ReceivePack. prefix on static call 24/152624/1
David Pursehouse [Thu, 14 Nov 2019 00:31:48 +0000 (16:31 -0800)]
ReceivePack: Remove unnecessary ReceivePack. prefix on static call

Change-Id: I2d9a95266f5baa5a2298451adbd9ca0259b26c4b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
4 years agotransport: Merge BaseReceivePack into ReceivePack 36/146536/6
Masaya Suzuki [Tue, 23 Jul 2019 19:54:43 +0000 (12:54 -0700)]
transport: Merge BaseReceivePack into ReceivePack

Move the BaseReceivePack implementation back into ReceivePack. This is a
backward-incompatible change. For example, BaseReceivePack.FirstLine no
longer exists and cannot be referenced.  However, most of the code
should just work by replacing BaseReceivePack with ReceivePack.

Although this is an API change, it only affects callers using JGit as a
server, and there are very few of those in the wild.

Change-Id: I1ce92869435d5eebb7d671be44561e69c6233134
Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
4 years agoMove KetchSystem.delay to FileUtils. 88/152588/5
Han-Wen Nienhuys [Wed, 13 Nov 2019 15:12:05 +0000 (07:12 -0800)]
Move KetchSystem.delay to FileUtils.

This will provide exponential backoff with jitter to other JGit
components too.

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

4 years agoBaseReceivePack: Add hasReceivedPack method 97/152597/2
David Pursehouse [Wed, 13 Nov 2019 18:16:25 +0000 (10:16 -0800)]
BaseReceivePack: Add hasReceivedPack method

The getPackSize method will throw IllegalStateException if it is
called when the pack size is not set. This is the case for example
when the received commands are all DELETE and there is no pack.

Add a new method hasReceivedPack that can be called prior to calling
getPackSize, to avoid causing the IllegalStateException.

See [1] for context.

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

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