]> source.dussan.org Git - jgit.git/log
jgit.git
6 years agoDiffCommand: Open DiffFormatter in try-with-resource 37/118737/1
David Pursehouse [Tue, 6 Mar 2018 01:40:35 +0000 (10:40 +0900)]
DiffCommand: Open DiffFormatter in try-with-resource

Change-Id: I22bd1062d64b01bb98cdaf612482538114624b7f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDiffAlgorithms: Open Repository in try-with-resource 33/118733/1
David Pursehouse [Tue, 6 Mar 2018 00:52:12 +0000 (09:52 +0900)]
DiffAlgorithms: Open Repository in try-with-resource

Change-Id: I67cb486283213f8aa964333533c55966518baa36
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDescribeCommandTest: Open FileWriter in try-with-resource 32/118732/1
David Pursehouse [Tue, 6 Mar 2018 00:49:16 +0000 (09:49 +0900)]
DescribeCommandTest: Open FileWriter in try-with-resource

Change-Id: Ida79bdae652faa88fbdb1b81e7e10b5019ff2c16
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCommitCommand: Open InputStream in try-with-resource 31/118731/1
David Pursehouse [Tue, 6 Mar 2018 00:48:19 +0000 (09:48 +0900)]
CommitCommand: Open InputStream in try-with-resource

Change-Id: I800a2afae17f84636cae593be7f07628fb8476c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDefaultNoteMerger: Open UnionInputStream in try-with-resource 30/118730/1
David Pursehouse [Tue, 6 Mar 2018 00:47:11 +0000 (09:47 +0900)]
DefaultNoteMerger: Open UnionInputStream in try-with-resource

Change-Id: I035aa89cdbf235992f41e752f49d735be4e5df0a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCommitCommandTest: Open Repository in try-with-resource 27/118727/1
David Pursehouse [Mon, 5 Mar 2018 23:24:28 +0000 (08:24 +0900)]
CommitCommandTest: Open Repository in try-with-resource

Change-Id: Id9961a120ef9f949f04fc95455fae06ba95d8031
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCommitAndLogCommandTest: Open PrintWriter in try-with-resource 26/118726/1
David Pursehouse [Mon, 5 Mar 2018 23:22:48 +0000 (08:22 +0900)]
CommitAndLogCommandTest: Open PrintWriter in try-with-resource

Change-Id: I0c7f07e27d1881d8856dac008110fcaa85c98fbb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCloneCommandTest: Open Repository in try-with-resource 24/118724/1
David Pursehouse [Mon, 5 Mar 2018 23:20:45 +0000 (08:20 +0900)]
CloneCommandTest: Open Repository in try-with-resource

Change-Id: Id09d2126fb17d84581f8637e83a75dfa2e85ebe8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAutoCRLFInputStreamTest: Open auto-closeable resources in try-with-resource 68/118668/1
David Pursehouse [Mon, 5 Mar 2018 11:59:31 +0000 (20:59 +0900)]
AutoCRLFInputStreamTest: Open auto-closeable resources in try-with-resource

Change-Id: I427ab43a82861f7bc69b104e29dc4360048aec4e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCleanCommandTest: Open Repository in try-with-resource 67/118667/1
David Pursehouse [Mon, 5 Mar 2018 11:56:38 +0000 (20:56 +0900)]
CleanCommandTest: Open Repository in try-with-resource

Change-Id: If87cb729432ae711a2e7cfd08d288d7fec3f6de2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCGitVsJGitRandomIgnorePatternTest: Open OutputStream in try-with-resource 66/118666/1
David Pursehouse [Mon, 5 Mar 2018 11:55:20 +0000 (20:55 +0900)]
CGitVsJGitRandomIgnorePatternTest: Open OutputStream in try-with-resource

Change-Id: I08e27d0ee48dabd94a4eeb608508f815a3000ec9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoArchiveTest: Open auto-closeable resources in try-with-resource 64/118664/1
David Pursehouse [Mon, 5 Mar 2018 11:23:03 +0000 (20:23 +0900)]
ArchiveTest: Open auto-closeable resources in try-with-resource

Change-Id: If11017f21027b46c7a66e52e4bc0cc73f4fbdc07
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoArchiveCommand: Create archive output stream in try-with-resource 63/118663/1
David Pursehouse [Mon, 5 Mar 2018 11:19:25 +0000 (20:19 +0900)]
ArchiveCommand: Create archive output stream in try-with-resource

Change-Id: I72f4d303945275d400723aa17212b302e051dc15
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoApplyCommand: Open FileWriter in try-with-resource 62/118662/1
David Pursehouse [Mon, 5 Mar 2018 11:17:32 +0000 (20:17 +0900)]
ApplyCommand: Open FileWriter in try-with-resource

Change-Id: Ia473f74dc4608fc43edd57eda4f193c226e9004d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAmazonS3Client: Open Input/OutputStream in try-with-resource 59/118659/1
David Pursehouse [Mon, 5 Mar 2018 11:13:51 +0000 (20:13 +0900)]
AmazonS3Client: Open Input/OutputStream in try-with-resource

Change-Id: I32d4031159dff9005e839d0b53940431cba12beb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAmazonS3: Open InputStream/FileInputStream in try-with-resource 58/118658/1
David Pursehouse [Mon, 5 Mar 2018 11:11:59 +0000 (20:11 +0900)]
AmazonS3: Open InputStream/FileInputStream in try-with-resource

Change-Id: I71606e14d2b3cf085b8d1343c3858e7a729a173e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAdvertiseErrorTest: Open Transport in try-with-resource 57/118657/1
David Pursehouse [Mon, 5 Mar 2018 11:10:12 +0000 (20:10 +0900)]
AdvertiseErrorTest: Open Transport in try-with-resource

Change-Id: I78adec7baf82d1a0eedc10e90b6d4f20008a046d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAddCommandTest: Open PrintWriter in try-with-resource 56/118656/1
David Pursehouse [Mon, 5 Mar 2018 11:08:34 +0000 (20:08 +0900)]
AddCommandTest: Open PrintWriter in try-with-resource

Change-Id: I8ef769d12239447a20b670398293dbb64b90087d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFileBasedConfigTest: Open FileOutputStream in try-with-resource 34/118634/1
David Pursehouse [Mon, 5 Mar 2018 08:16:14 +0000 (17:16 +0900)]
FileBasedConfigTest: Open FileOutputStream in try-with-resource

Change-Id: Id4c49d4af30bcc5210d35630a8699574694060bb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoWalkRemoteObjectDatabase: Open auto-closeable resources in try-with-resource 33/118633/1
David Pursehouse [Mon, 5 Mar 2018 08:15:04 +0000 (17:15 +0900)]
WalkRemoteObjectDatabase: Open auto-closeable resources in try-with-resource

Change-Id: Ie4f67ca8cab1031089782f202588b08cc157dd79
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTransportSftp: Open BufferedReader in try-with-resource 32/118632/1
David Pursehouse [Mon, 5 Mar 2018 08:13:20 +0000 (17:13 +0900)]
TransportSftp: Open BufferedReader in try-with-resource

Change-Id: Iab94cce80c11a5edeaf8f377001408cc53707c04
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoReflogReaderTest: Open FileOutputStream in try-with-resource 29/118629/1
David Pursehouse [Mon, 5 Mar 2018 07:35:09 +0000 (16:35 +0900)]
ReflogReaderTest: Open FileOutputStream in try-with-resource

Change-Id: I09af22292cc4b615b40a820dbc054282bb0c76b8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoReflogReaderTest: Fix indentation 28/118628/1
David Pursehouse [Mon, 5 Mar 2018 07:33:42 +0000 (16:33 +0900)]
ReflogReaderTest: Fix indentation

Change-Id: I981dc14065ce435034d2072cff77e7efaa2c5573
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoReflogWriterTest: Open FileInputStream in try-with-resource 27/118627/1
David Pursehouse [Mon, 5 Mar 2018 07:30:36 +0000 (16:30 +0900)]
ReflogWriterTest: Open FileInputStream in try-with-resource

Change-Id: Ie111aead49d83d6acfbb89bb475ef6d3159b36c4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTransportHttp: Open auto-closeable resources in try-with-resource 26/118626/1
David Pursehouse [Mon, 5 Mar 2018 07:28:59 +0000 (16:28 +0900)]
TransportHttp: Open auto-closeable resources in try-with-resource

Change-Id: I2f713b79ff07f5759c189f384cd25adb9b9f5761
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRebaseCommandTest: Open BufferedReader in try-with-resource 25/118625/1
David Pursehouse [Mon, 5 Mar 2018 07:23:50 +0000 (16:23 +0900)]
RebaseCommandTest: Open BufferedReader in try-with-resource

Change-Id: If8d77431edfdaec4a49a3c4ffe66a99e6d31c682
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDirCacheCGitCompatabilityTest: Open BufferedReader in try-with-resource 24/118624/1
David Pursehouse [Mon, 5 Mar 2018 07:23:08 +0000 (16:23 +0900)]
DirCacheCGitCompatabilityTest: Open BufferedReader in try-with-resource

Change-Id: I0494eb475954927743174941a7d6c06d8431f57f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoLockFile: Open FileInputStream in try-with-resource 20/118620/1
David Pursehouse [Mon, 5 Mar 2018 02:03:21 +0000 (11:03 +0900)]
LockFile: Open FileInputStream in try-with-resource

Change-Id: I0784266814225428a6a0070d1653c465d268b342
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCheckoutCommandTest: Open FileInputStream in try-with-resource 19/118619/1
David Pursehouse [Mon, 5 Mar 2018 01:59:43 +0000 (10:59 +0900)]
CheckoutCommandTest: Open FileInputStream in try-with-resource

Change-Id: I972958373ceaf4c3ae756559ccbc341506d4e72d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoSmudgeFilter: Fix Integer boxing warning 18/118618/1
David Pursehouse [Mon, 5 Mar 2018 01:57:41 +0000 (10:57 +0900)]
SmudgeFilter: Fix Integer boxing warning

Change-Id: Ic00bcd25b0808a58880a4433d76b3b5a6a4ee5c7
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAdd ConfigConstants.CONFIG_SECTION_LFS 17/118617/1
David Pursehouse [Mon, 5 Mar 2018 01:53:12 +0000 (10:53 +0900)]
Add ConfigConstants.CONFIG_SECTION_LFS

DirCacheCheckout has a warning about non-localised string "lfs". Other
classes use org.eclipse.jgit.lfs.lib.Constants but that is not visible
to DirCacheCheckout.

Add a new constant in ConfigConstants and use that in DirCacheCheckout.

Replace existing uses of org.eclipse.jgit.lfs.lib.Constants.LFS with
the new constant, except where it is referring to the folder name.

Change-Id: I0f21b951babff9a2e579d68c4de0c62ee4bc23d4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoReturn this from InstallLfsCommand.setRepository() to allow chaining 08/118608/2
Matthias Sohn [Sun, 4 Mar 2018 20:26:33 +0000 (21:26 +0100)]
Return this from InstallLfsCommand.setRepository() to allow chaining

Change-Id: I105f1f62f2dcdb20a196361190e9c9fe368e8613
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoUpgrade spotbugs-maven-plugin to 3.1.2 23/118323/3
David Pursehouse [Wed, 28 Feb 2018 02:25:30 +0000 (11:25 +0900)]
Upgrade spotbugs-maven-plugin to 3.1.2

Change-Id: I01d8392ef8d20efd7f03590c82da017e2b53a043
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUpdate orbit to S20180302171354 (photon) and R20180206163158 (oxygen) 90/118590/1
Matthias Sohn [Sat, 3 Mar 2018 23:53:19 +0000 (00:53 +0100)]
Update orbit to S20180302171354 (photon) and R20180206163158 (oxygen)

Change-Id: I5b5e59581bfa00bb16e3b8e0af6e154ad6583bb9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoAdd|RemoveNoteComand: Reduce duplicated code 86/118486/2
David Pursehouse [Fri, 2 Mar 2018 05:14:55 +0000 (14:14 +0900)]
Add|RemoveNoteComand: Reduce duplicated code

The private method commitNoteMap is in both classes with the same
implementation.

Make it static in AddNoteCommand and reuse it from RemoveNoteCommand.

Change-Id: Ia037bf9efdd94ee7b8d33b41321e9cfd6ea4a6a5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoLFSPointerTest: Open ByteArrayOutputStream in try-with-resource 77/118477/2
David Pursehouse [Fri, 2 Mar 2018 02:10:00 +0000 (11:10 +0900)]
LFSPointerTest: Open ByteArrayOutputStream in try-with-resource

Change-Id: Ib15a838e735f8b960e0ed635d6d9b0caf97f4791
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAbbreviationTest: Open FileOutputStream in try-with-resource 76/118476/2
David Pursehouse [Fri, 2 Mar 2018 02:08:05 +0000 (11:08 +0900)]
AbbreviationTest: Open FileOutputStream in try-with-resource

Change-Id: Id1d48da466251f9e4186f4674afba4b5901a4388
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTagBuilder: Open OutputStreamWriter in try-with-resource 75/118475/2
David Pursehouse [Fri, 2 Mar 2018 02:04:27 +0000 (11:04 +0900)]
TagBuilder: Open OutputStreamWriter in try-with-resource

Change-Id: Ic0e23039b0aec6171f192234c6b1474cd32eadff
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDaemonService: Open Repository in try-with-resource 33/118233/3
David Pursehouse [Tue, 27 Feb 2018 05:21:36 +0000 (14:21 +0900)]
DaemonService: Open Repository in try-with-resource

Change-Id: I8deec91d91e82c7cb186cfa9507eb443dd87aad3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRefDirectory: Open BufferedReader in try-with-resource 32/118232/3
David Pursehouse [Tue, 27 Feb 2018 05:16:19 +0000 (14:16 +0900)]
RefDirectory: Open BufferedReader in try-with-resource

Change-Id: I9239df3e381b141b48ad7ea1b706e5b5927946cd
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoObjectDirectory: Open BufferedReader in try-with-resource 31/118231/3
David Pursehouse [Tue, 27 Feb 2018 05:14:03 +0000 (14:14 +0900)]
ObjectDirectory: Open BufferedReader in try-with-resource

Change-Id: I4a44954c61647af1e48eade19112697e79297f2e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPatch: Open TemporaryBuffer in try-with-resource 30/118230/3
David Pursehouse [Tue, 27 Feb 2018 05:12:10 +0000 (14:12 +0900)]
Patch: Open TemporaryBuffer in try-with-resource

Change-Id: I90bff8d49ecc37b8c10ce909cd3ac563205b641c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoEnable warning for resources not managed by try-with-resource 29/118229/3
David Pursehouse [Tue, 27 Feb 2018 05:10:41 +0000 (14:10 +0900)]
Enable warning for resources not managed by try-with-resource

Change-Id: Iefe97de6bdb62af558f1b0e77c9205a9186f9b4c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoLFS: Enable LFS support for the CLI, better error handling 64/112864/34
Markus Duft [Tue, 5 Dec 2017 10:16:30 +0000 (11:16 +0100)]
LFS: Enable LFS support for the CLI, better error handling

Enable LFS support for the CLI by registering the according filters.

Errors during filter creation must be propagated up the call stack, as a
failure to create a filter should be treated as fatal if the filter is
required.

Change-Id: I3833757839bdda97cd01b6c21c1613d199e2692d
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
6 years agoCleanup stream usage WRT filters 02/118502/3
Markus Duft [Fri, 2 Mar 2018 09:13:05 +0000 (10:13 +0100)]
Cleanup stream usage WRT filters

As it is right now some streams leak out of the filter construct. This
change clarifies responsibilities and fixes stream leaks

Change-Id: Ib9717d43a701a06a502434d64214d13a392de5ab
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoLFS: support merge/rebase/cherry-pick/diff/compare with LFS files 76/111376/43
Markus Duft [Fri, 2 Mar 2018 09:11:42 +0000 (10:11 +0100)]
LFS: support merge/rebase/cherry-pick/diff/compare with LFS files

Respect merge=lfs and diff=lfs attributes where required to replace (in
memory) the content of LFS pointers with the actual blob content from
the LFS storage (and vice versa when staging/merging).

Does not implement general support for merge/diff attributes for any
other use case apart from LFS.

Change-Id: Ibad8875de1e0bee8fe3a1dffb1add93111534cae
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge "LFS: Dramatically improve checkout speed with SSH authentication"
Matthias Sohn [Thu, 1 Mar 2018 14:16:55 +0000 (09:16 -0500)]
Merge "LFS: Dramatically improve checkout speed with SSH authentication"

6 years agoLFS: Dramatically improve checkout speed with SSH authentication 63/112863/30
Markus Duft [Tue, 5 Dec 2017 09:46:43 +0000 (10:46 +0100)]
LFS: Dramatically improve checkout speed with SSH authentication

SSH Authentication is quite expensive (~120ms on localhost against
Gerrit with LFS plugin). The SSH authentication typically also sends a
validity time of the returned token, which allows to re-use it for a
certain time, avoiding the expensive authentication on every download
request. This improves checkout times by large factors depending on the
LFS object amount/sizes.

Also make sure that all instances of Gson used by LFS are configured in
the same way.

Change-Id: I422c94c37021b4322789b3829fa0185e25d683f2
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
6 years agoCorrectly exit fetch negotiation for stateless RPC connections 89/118389/3
Terry Parker [Wed, 28 Feb 2018 23:10:23 +0000 (15:10 -0800)]
Correctly exit fetch negotiation for stateless RPC connections

Commit 9530c10192cf033c021802a3b295b06864654464 (2018-02-11)
"Add a minimum negotiation feature for fetch" made fetch
negotiation cheaper for repos with huge numbers of
references (we are seeing a 15x reduction in maximum fetch
times for chromium/chromium/src on trans-Pacific links).
But it inadvertently broke the handling of stateless RPC
connections, so fix that here.

Change-Id: I0090aa76ffecc55801ebb833ac2e0c933a4a7c54
Signed-off-by: Terry Parker <tparker@google.com>
6 years agoLFS: pre-push upload support 64/111364/31
Markus Duft [Fri, 10 Nov 2017 10:10:28 +0000 (11:10 +0100)]
LFS: pre-push upload support

If JGit built in LFS support is enabled for the current repository (or
user/system), any existing pre-push hook will cause an exception for the
time beeing, as only a single pre-push hook is supported.

Thus either native pre-push hooks OR JGit built-in LFS support may be
enabled currently, but not both.

Change-Id: Ie7d2b90e26e948d9cca3d05a7a19489488c75895
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoAmazonS3: Open OutputStream in try-with-resource 44/118144/1
David Pursehouse [Mon, 26 Feb 2018 11:38:12 +0000 (20:38 +0900)]
AmazonS3: Open OutputStream in try-with-resource

Change-Id: I0685a298a0f9fec465973cc718ae3bff373318a4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMergeGitAttributeTest: Open FileInputStream in try-with-resource 43/118143/1
David Pursehouse [Mon, 26 Feb 2018 08:48:42 +0000 (17:48 +0900)]
MergeGitAttributeTest: Open FileInputStream in try-with-resource

Change-Id: Iec85eea044c46a199b5b6f6bdbb3191d817dd441
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPullCommandWithRebaseTest: Open File{Input|Output}Stream in try-with-resource 26/118126/2
David Pursehouse [Mon, 26 Feb 2018 08:42:38 +0000 (17:42 +0900)]
PullCommandWithRebaseTest: Open File{Input|Output}Stream in try-with-resource

Change-Id: I1ff707ab7bab676603907f4c0bb1bc495503055b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRecursiveMergerTest: Open FileOutputStream in try-with-resource 24/118124/1
David Pursehouse [Mon, 26 Feb 2018 08:39:57 +0000 (17:39 +0900)]
RecursiveMergerTest: Open FileOutputStream in try-with-resource

Change-Id: I158333d6393fb807bc21fba23fec7ad474384471
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPullCommandTest: Use try-with-resources for File{Input,Output}Stream 21/118121/1
David Pursehouse [Sun, 25 Feb 2018 23:58:48 +0000 (08:58 +0900)]
PullCommandTest: Use try-with-resources for File{Input,Output}Stream

Change-Id: I09242eb289655c7554aefa9e0817d9b881db656b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAdd ObjectIdSerializer 31/117831/3
David Pursehouse [Wed, 21 Feb 2018 03:40:47 +0000 (12:40 +0900)]
Add ObjectIdSerializer

This is based on the ObjectIdSerialization class written by Shawn Pearce
for the Gerrit Code Review project in 2009 [1]. As mentioned in the
commit message there, it should be part of core JGit.

This implementation is slightly different to Shawn's version. Rather
than having separate methods for null/non-null ids, single methods are
implemented with @Nullable annotations.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/9792

Change-Id: I7599cf8bd1ecd546e2252783d6d672eb76804060
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoCheckoutCommandTest: Fix name of created temp file 05/118105/1
David Pursehouse [Sun, 25 Feb 2018 08:47:31 +0000 (17:47 +0900)]
CheckoutCommandTest: Fix name of created temp file

Change-Id: I29048f83aee3848679bbc6ded09dd3dd4a2ea35b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoIgnoreNodeTest: Suppress deprecation warnings in testEmptyIgnoreNode 04/118104/1
David Pursehouse [Sun, 25 Feb 2018 08:36:27 +0000 (17:36 +0900)]
IgnoreNodeTest: Suppress deprecation warnings in testEmptyIgnoreNode

Change-Id: I930c9408cc702af911419f2a7b3d03f652a2d4e3
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFix warnings about boxing/unboxing Boolean 03/118103/1
David Pursehouse [Sun, 25 Feb 2018 08:35:00 +0000 (17:35 +0900)]
Fix warnings about boxing/unboxing Boolean

Change-Id: I9d81d510282e9181267750fe3f9c571c35b61407
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoWorkingTreeIterator: Fix warnings about variable hiding 02/118102/1
David Pursehouse [Sun, 25 Feb 2018 08:32:21 +0000 (17:32 +0900)]
WorkingTreeIterator: Fix warnings about variable hiding

Change-Id: I78ed3ae7aa30a7e7f146d0bd2e9feff74554da78
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoWorkingTreeIterator: Add NON-NLS suppressions 01/118101/1
David Pursehouse [Sun, 25 Feb 2018 08:30:03 +0000 (17:30 +0900)]
WorkingTreeIterator: Add NON-NLS suppressions

Change-Id: I369b8f68912134fc3880c162e9a2c5a1669bb4ac
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge "Fix processing of gitignore negations"
Matthias Sohn [Sat, 24 Feb 2018 00:42:03 +0000 (19:42 -0500)]
Merge "Fix processing of gitignore negations"

6 years agoFix processing of gitignore negations 86/117186/10
Marc Strapetz [Fri, 23 Feb 2018 12:34:23 +0000 (13:34 +0100)]
Fix processing of gitignore negations

Processing of negated rules, like !bin/ was not working correctly: they
were interpreted too broad, resulting in unexpected untracked files
which should actually be ignored

Bug: 409664
Change-Id: I0a422fd6607941461bf2175c9105a0311612efa0
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
6 years agoUpdate tycho to 1.1.0 03/118003/1
Michael Keppler [Fri, 23 Feb 2018 08:14:05 +0000 (09:14 +0100)]
Update tycho to 1.1.0

The upgrade was already done 3 weeks ago, this version number was
missing, however.

Change-Id: Ibc794ba8035c46ea2160925b344ded5714b7c987
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
6 years agoConfigure Semaphore used in TestRequestLog to be fair 09/117909/2
Matthias Sohn [Wed, 21 Feb 2018 21:50:04 +0000 (22:50 +0100)]
Configure Semaphore used in TestRequestLog to be fair

Bug: 528187
Change-Id: I26c94ad7f802fc1dbe72d63a7ea346dc6e19ff94
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix indentation in TestRequestLog 89/117989/1
Matthias Sohn [Thu, 22 Feb 2018 22:10:14 +0000 (23:10 +0100)]
Fix indentation in TestRequestLog

We use tabs to indent.

Change-Id: I19b00e06becfb92fbabb99b5699385506fd85214
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoDfsReaderIoStats: Clarify that "blocks" are really cache misses 64/115264/2
Dave Borowitz [Thu, 11 Jan 2018 18:14:02 +0000 (13:14 -0500)]
DfsReaderIoStats: Clarify that "blocks" are really cache misses

The previous wording was ambiguous as to whether these were blocks
requested from the cache (hits + misses) or read from underlying storage
(misses only).

They are in fact recording only misses:
Accumulator#{readBlock,readBlockBytes,readBlockMicros} are only
incremented from BlockBasedFile#readOneBlock, which is only called from
the cache miss path in DfsBlockCache#getOrLoad (line 391).

Change-Id: I0135cd1e76d09c1e28e0f1833b34c312511c66ce

6 years agoPathMatcher: fix handling of **/ 77/117477/12
Marc Strapetz [Sat, 17 Feb 2018 12:20:57 +0000 (13:20 +0100)]
PathMatcher: fix handling of **/

**/ should match only directories, but not files

Change-Id: I885c83e5912cac5bff338ba657faf6bb9ec94064
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
6 years agoMerge changes Id616611e,Ib6509e81,I52f5d3f2
David Pursehouse [Thu, 22 Feb 2018 05:37:48 +0000 (00:37 -0500)]
Merge changes Id616611e,Ib6509e81,I52f5d3f2

* changes:
  RepoCommand: generate relative submodule URLs from absolute URLs.
  RepoCommand: don't record new commit if tree did not change
  RepoCommand: persist unreadable submodules in .gitmodules

6 years agoCGitIgnoreTest: also test untracked files 83/117583/3
Marc Strapetz [Sat, 17 Feb 2018 12:20:46 +0000 (13:20 +0100)]
CGitIgnoreTest: also test untracked files

Change-Id: I21a4ebd63eaaa85aa2e68f99ef58c141189bdab4
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
6 years agodfs: Try to avoid searching UNREACHABLE_GARBAGE during packing 70/102770/5
Shawn Pearce [Wed, 9 Aug 2017 12:22:14 +0000 (05:22 -0700)]
dfs: Try to avoid searching UNREACHABLE_GARBAGE during packing

If an object can be found in a non-garbage pack, favor that pack over
paging in the garbage pack's idx and pack content.

Only fall back to garbage packs if an object cannot be found and there
are garbage packs present in the repository.  This fallback is
required to correct race conditions during GC.

Change-Id: Ia7c123975bc069b8e6e713eda2d357303b71e329

6 years agoRepoCommand: generate relative submodule URLs from absolute URLs. 88/117688/3
Han-Wen Nienhuys [Mon, 19 Feb 2018 18:59:35 +0000 (19:59 +0100)]
RepoCommand: generate relative submodule URLs from absolute URLs.

If a manifest file specifies an absolute URL on the same host on which
the superproject resides, rewrite the URLs to be relative.

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

6 years agoRepoCommand: don't record new commit if tree did not change 87/117387/4
Han-Wen Nienhuys [Wed, 14 Feb 2018 19:34:03 +0000 (20:34 +0100)]
RepoCommand: don't record new commit if tree did not change

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

6 years agoRepoCommand: persist unreadable submodules in .gitmodules 86/117386/5
Han-Wen Nienhuys [Wed, 14 Feb 2018 17:23:03 +0000 (18:23 +0100)]
RepoCommand: persist unreadable submodules in .gitmodules

In cases where a manifest file mixes different remotes, a Gerrit
server process may not have access to all remotes, and won't be able
to produce a full submodule tree.

Preserving this information in .gitmodules will let downstream clients
reconstruct the full tree.

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

6 years agoDeclare LFS dependency on GSON for Bazel build 37/117637/2
Han-Wen Nienhuys [Mon, 19 Feb 2018 09:42:14 +0000 (10:42 +0100)]
Declare LFS dependency on GSON for Bazel build

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

6 years agoSilence API error for new constant in ConfigConstants 25/117625/1
Matthias Sohn [Sun, 18 Feb 2018 21:23:00 +0000 (22:23 +0100)]
Silence API error for new constant in ConfigConstants

Change-Id: Ic4bd10b67caf6b2a2cc0c23bb4e7c717e4ccd6d5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoSilence API errors raised for new public fields in PackStatistics 24/117624/1
Matthias Sohn [Sun, 18 Feb 2018 21:08:39 +0000 (22:08 +0100)]
Silence API errors raised for new public fields in PackStatistics

Change-Id: I8e118282a833361b676aa3cc90cbe774ccd42ed0
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoLFS: Add remote download to SmudgeFilter 06/83506/38
Markus Duft [Fri, 7 Oct 2016 10:39:45 +0000 (12:39 +0200)]
LFS: Add remote download to SmudgeFilter

Transfer data in chunks of 8k Transferring data byte per byte is slow,
running checkout with CleanFilter on a 2.9MB file takes 20 seconds.
Using a buffer of 8k shrinks this time to 70ms.

Also register the filter commands in a way that the native GIT LFS can
be used alongside with JGit.

Implements auto-discovery of LFS server URL when cloning from a Gerrit
LFS server.

Change-Id: I452a5aa177dcb346d92af08b27c2e35200f246fd
Also-by: Christian Halstrick <christian.halstrick@sap.com>
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
6 years agoRepoCommand: Don't leave Git open 17/117317/7
David Pursehouse [Wed, 14 Feb 2018 01:30:12 +0000 (10:30 +0900)]
RepoCommand: Don't leave Git open

When the command is run on a non-bare repository, an instance of
Git is created to execute the commit, and is left open when the
command has finished.

Refactor to not use a class scope Git instance, and make sure it
gets closed before returning.

Change-Id: Ic623ae0fd8b9e264b5dfd434da0de6bb4f910984
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge "Merge branch 'stable-4.10'"
Matthias Sohn [Wed, 14 Feb 2018 23:18:43 +0000 (18:18 -0500)]
Merge "Merge branch 'stable-4.10'"

6 years agoMerge "InitCommand: Don't leave Repository open after Git is closed"
David Pursehouse [Wed, 14 Feb 2018 23:18:35 +0000 (18:18 -0500)]
Merge "InitCommand: Don't leave Repository open after Git is closed"

6 years agoMerge branch 'stable-4.10' 03/117403/1
Matthias Sohn [Wed, 14 Feb 2018 22:28:17 +0000 (23:28 +0100)]
Merge branch 'stable-4.10'

* stable-4.10:
  Fix ssh host name handling for Jsch
  Jsch overrides the port in the URI with the one in ~/.ssh/config

Change-Id: I860fc61ceb12ae792b1ee7421046ecd32373b9f8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.9' into stable-4.10 96/117396/1
Matthias Sohn [Wed, 14 Feb 2018 20:24:54 +0000 (21:24 +0100)]
Merge branch 'stable-4.9' into stable-4.10

* stable-4.9:
  Fix ssh host name handling for Jsch
  Jsch overrides the port in the URI with the one in ~/.ssh/config

Change-Id: Iff9076f65e767bbe8df016337b631bdaeb40ad98
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge "TransportLocal should reuse FS from source repo"
Matthias Sohn [Wed, 14 Feb 2018 20:02:22 +0000 (15:02 -0500)]
Merge "TransportLocal should reuse FS from source repo"

6 years agoFix ssh host name handling for Jsch 48/117348/1
Thomas Wolf [Wed, 14 Feb 2018 12:39:28 +0000 (13:39 +0100)]
Fix ssh host name handling for Jsch

If we give Jsch access to the ssh config file, we must _not_ resolve
the host name from the alias. Instead we must give the alias (i.e.,
the host name as is in the URI) to Jsch, so that it finds the same
ssh config entry.

Otherwise if the hostname in the URI, which is taken as an alias in
ssh config ("Host" line), is unequal to the "Hostname" line, and
there happens to be another ssh config entry with that translated
host name as alias, Jsch will pick up that second entry, and we end
up with a strange mixture of both.

Add tests for this case.

Bug: 531118
Change-Id: I249d8c073b0190ed110a69dca5b9be2a749822c3
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoJsch overrides the port in the URI with the one in ~/.ssh/config 47/117347/1
Thomas Wolf [Wed, 14 Feb 2018 12:05:17 +0000 (13:05 +0100)]
Jsch overrides the port in the URI with the one in ~/.ssh/config

Jsch unconditionally overwrites the port from the ssh config
file (if a port is specified there), even if the URI explicitly does
give a different port.

Fix this, and add tests.

Change-Id: I7b014543c7ece26270e366db39d7647f82d64f0d
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoInitCommand: Don't leave Repository open after Git is closed 16/117316/3
David Pursehouse [Wed, 14 Feb 2018 01:13:46 +0000 (10:13 +0900)]
InitCommand: Don't leave Repository open after Git is closed

The InitCommand returns a Git that is instantiated with the newly
created Repository, but the Repository is not closed with the Git
resulting in resource leaks.

Create the Git with `closeRepo` set to true, such that the Repository
is also closed when the Git is closed.

Adjust the tests to use try-with-resource on the Git instance.

Change-Id: Ib26e7428c7d8840956d1edb09e53b93e23e6fe5a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoURIish: add a test for equals and hashcode methods 15/114715/3
Matthias Sohn [Sat, 23 Dec 2017 21:09:43 +0000 (22:09 +0100)]
URIish: add a test for equals and hashcode methods

Change-Id: I5727ac1757dca0d63631401bcb074ee8f58ce082
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoAdd a minimum negotiation feature for fetch 29/117129/4
Terry Parker [Sun, 11 Feb 2018 22:37:22 +0000 (14:37 -0800)]
Add a minimum negotiation feature for fetch

Android an Chrome have several repos with >300k refs. We sometimes see
negotiations of >100k rounds. This change provides a "minimal negotiation"
feature on the client side that limits how many "have" lines the client
sends. The client extracts the current SHA-1 values for the refs in its
wants set, and terminates negotiation early when all of those values have
been sent as haves. If a new branch is being fetched then that set will
be empty and the client will terminate after current default minimum
of two rounds.

This feature is gated behind a "fetch.useminimalnegotiation" configuration
flag, which defaults to false.

Change-Id: Ib12b095cac76a59da6e8f72773c4129e3b32ff2b
Signed-off-by: Terry Parker <tparker@google.com>
6 years agoAdd negotiation statistics to PackStatistics 28/117128/3
Terry Parker [Sun, 11 Feb 2018 21:29:38 +0000 (13:29 -0800)]
Add negotiation statistics to PackStatistics

Add fetch statistics for the counts of advertised refs, wants and haves.
Also add the duration in milliseconds for the negotiation phase. For
non-bidirectional transports like HTTP, this is the time for the final
round that sends the pack back to the user.

Change-Id: I1af7ffd3cb7b62182340682e2a243691ea24ec2e
Signed-off-by: Terry Parker <tparker@google.com>
6 years agoMergedReftable to skip shadowed refs in same reftable 74/117074/1
Minh Thai [Fri, 9 Feb 2018 17:49:24 +0000 (09:49 -0800)]
MergedReftable to skip shadowed refs in same reftable

This would allow compact and GC process to clean up duplicate ref names in the reftables.

Change-Id: I2b9df0bf72dba63cc3525e374982e60559a776c2
Signed-off-by: Minh Thai <mthai@google.com>
6 years agoFix CleanCommand not to throw FileNotFoundExceptions 01/116801/2
Christian Halstrick [Tue, 6 Feb 2018 14:32:14 +0000 (15:32 +0100)]
Fix CleanCommand not to throw FileNotFoundExceptions

When CleanCommand is collecting the files and folders to be deleted
it may happen that the list of directories contains obsolete entries.
E.g. a folder and its parent folder may be in the list. Only the
parent folder would be sufficient.

This was a reason for hitting FileNotFoundExceptions when finally
trying to delete the files and folders. Improve CleanCommand
to ignore files to be deleted which are already gone.

Bug: 514434
Change-Id: I10caa01bfb9cec5967dfdaea50c6e4a713eeeabd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoGC: Remove empty references folders 88/116788/5
Hector Caballero [Mon, 5 Feb 2018 13:58:46 +0000 (08:58 -0500)]
GC: Remove empty references folders

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

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

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

6 years agoBazel: Support building with Java 9 68/113368/6
David Ostrovsky [Wed, 13 Dec 2017 22:41:45 +0000 (23:41 +0100)]
Bazel: Support building with Java 9

Bazel@HEAD supports Java 9.

The current code has one single issue with Java 9 compliance: the usage
of javax.xml.bind.DatatypeConverter class for printHexBinary() method.
This class is not available on Java 9. One alternative is to use guava
library. Something similar was done here: [1]. But unlike the case with
checkstyle library, JGit currently doesn't use guava. Instead, we add
java.xml.bind module with --add-modules compiler option.

To build (or test) with Java 9, build custom bazel version and issue:

  $ bazel --host_javabase=/usr/lib64/jvm/java-9-openjdk build \
    --javacopt='--release 9' \
    --java_toolchain=@bazel_tools//tools/jdk:toolchain_jdk9 :all

The Java 9 support is backwards compatible.

* [1] https://github.com/checkstyle/checkstyle/issues/5027

Change-Id: I2c5203fc4e65885ce7b210f824fda85ba6d6c51d
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
6 years agoGC: Merge if statement with the enclosing one 87/116787/1
Hector Caballero [Tue, 6 Feb 2018 11:20:19 +0000 (06:20 -0500)]
GC: Merge if statement with the enclosing one

Reported by Sonar.

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

6 years agoGC: Replace Files methods with File alternatives 86/116786/1
Hector Caballero [Sun, 4 Feb 2018 19:49:41 +0000 (14:49 -0500)]
GC: Replace Files methods with File alternatives

The Files.exists method has noticeably poor performance in JDK 8 and can
slow an application significantly when used to check files that do not
actually exist. The same goes for Files.notExists, Files.isDirectory and
Files.isRegularFile [1].

Replace them with their File counterpart.

[1] https://rules.sonarsource.com/java/tag/performance/RSPEC-3725

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

6 years agoGC: Replace anonymous classes with lambdas 85/116785/1
Hector Caballero [Tue, 30 Jan 2018 01:57:50 +0000 (20:57 -0500)]
GC: Replace anonymous classes with lambdas

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

6 years agoGC: Simplify lambda 84/116784/1
Hector Caballero [Tue, 30 Jan 2018 01:24:23 +0000 (20:24 -0500)]
GC: Simplify lambda

filter() stream operation also accepts a lambda expression.

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

6 years agoGC: Simplify reference equals() method 83/116783/1
Hector Caballero [Tue, 30 Jan 2018 01:51:14 +0000 (20:51 -0500)]
GC: Simplify reference equals() method

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

6 years agoGC: Simplify boolean expression 82/116782/1
Hector Caballero [Tue, 30 Jan 2018 02:08:52 +0000 (21:08 -0500)]
GC: Simplify boolean expression

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