]> source.dussan.org Git - jgit.git/log
jgit.git
6 years agoSubmoduleUpdateCommand: Refactor to open Repository in try-with-resource 66/119466/5
David Pursehouse [Thu, 15 Mar 2018 05:27:01 +0000 (14:27 +0900)]
SubmoduleUpdateCommand: Refactor to open Repository in try-with-resource

Change-Id: I1a303fdfdb6823043fa6751c43eaeaf678f2e64f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTransportGitAnon: Suppress resource warning about Socket 64/119464/5
David Pursehouse [Thu, 15 Mar 2018 05:09:50 +0000 (14:09 +0900)]
TransportGitAnon: Suppress resource warning about Socket

Change-Id: Id1f5c0db4273324748a0ead2e6dac58d9114cf86
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFS#runProcess: Fix OutputStream left unclosed after IOException 63/119463/6
David Pursehouse [Thu, 15 Mar 2018 04:44:00 +0000 (13:44 +0900)]
FS#runProcess: Fix OutputStream left unclosed after IOException

The runProcess method creates an OutputStream that is not managed by
a try-with-resource because it's manually closed and any IOException
raised by the close() method is explicitly ignored.

Suppress the resource warning with an explanatory comment.

Enclose the call to StreamGobbler#copy in an inner try-block, and move
the call to close() inside its finally block. This prevents the stream
from being left unclosed if StreamGobbler#copy raises IOException.

Change-Id: Idca9adfc4d87e0989d787ad8239c055c0c849814
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge changes from topic 'If72b4b422-cleanup'
Jonathan Nieder [Fri, 23 Mar 2018 01:01:31 +0000 (21:01 -0400)]
Merge changes from topic 'If72b4b422-cleanup'

* changes:
  UploadPackTest: Fix name hiding introduced by If72b4b422
  Suppress non-localized string warnings introduced by If72b4b422

6 years agoscanPacks to return reftables even if no packs 28/120028/1
Minh Thai [Fri, 23 Mar 2018 00:11:45 +0000 (17:11 -0700)]
scanPacks to return reftables even if no packs

An empty repository may have a dangling symref HEAD pointing to
refs/heads/master.  In this case, there will be a reftable even though
there are no packs yet.

Change-Id: Ib759ffbbfc490953481853e74263dd46d2592888
Signed-off-by: Minh Thai <mthai@google.com>
6 years agoUploadPackTest: Fix name hiding introduced by If72b4b422 46/119646/2
David Pursehouse [Mon, 19 Mar 2018 08:02:16 +0000 (17:02 +0900)]
UploadPackTest: Fix name hiding introduced by If72b4b422

The local variable 'remote' hides the class scope variable
of the same name.

Change-Id: I7410c33678677ce2a14691772466d91e8139e3fa
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoSuppress non-localized string warnings introduced by If72b4b422 45/119645/2
David Pursehouse [Mon, 19 Mar 2018 07:58:05 +0000 (16:58 +0900)]
Suppress non-localized string warnings introduced by If72b4b422

Change-Id: I2e4544d715b4284f544a26f504d01159c5843160
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPackWriter: Fix Eclipse errors about missing Javadoc 44/119644/2
David Pursehouse [Mon, 19 Mar 2018 07:55:35 +0000 (16:55 +0900)]
PackWriter: Fix Eclipse errors about missing Javadoc

Change If72b4b422 added a new method filterAndAddObject with a
partial Javadoc, which causes errors in Eclipse.

Since it's a private method, Javadoc is not strictly necessary, so
just convert it to a standard comment block.

Bug: 532540
Change-Id: I06aa79211d1223dccf6c931451ca885ca6d39cbc
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoReflogWriter: Refactor to open FileOutputStream in try-with-resource 62/119462/2
David Pursehouse [Thu, 15 Mar 2018 04:32:47 +0000 (13:32 +0900)]
ReflogWriter: Refactor to open FileOutputStream in try-with-resource

Change-Id: I028ced10eecc99214a4c4a8055c379af72193f13
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPushCommand: Suppress resource warning for Transport in for loop 83/119383/5
David Pursehouse [Wed, 14 Mar 2018 04:11:16 +0000 (13:11 +0900)]
PushCommand: Suppress resource warning for Transport in for loop

A list of Transport instances is provided by Transport.openAll, and
then iterated over in a for loop. Eclipse warns that the Transport
in the for-loop should be managed by try-with-resource.

The Transport is explicitly closed in the finally block, so just
suppress the warning.

Change-Id: I92b73cd90902637cf1ac1ab7b02b5ee5ed6bdb1e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMerge branch 'stable-4.11' 61/119461/2
David Pursehouse [Fri, 16 Mar 2018 02:59:41 +0000 (11:59 +0900)]
Merge branch 'stable-4.11'

* stable-4.11:
  ObjectIdSerializer: Support serialization of known non-null ObjectId

Change-Id: Ie430fa2c5d13ae698d884a37d0d03884ebbf25ec
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTeach UploadPack to support filtering by blob size 76/110476/13
Jonathan Tan [Tue, 17 Oct 2017 22:48:53 +0000 (15:48 -0700)]
Teach UploadPack to support filtering by blob size

Teach UploadPack to advertise the filter capability and support a
"filter" line in the request, accepting blob sizes only, if the
configuration variable "uploadpack.allowfilter" is true. This feature is
currently in the "master" branch of Git, and as of the time of writing,
this feature is to be released in Git 2.17.

This is incomplete in that the filter-by-sparse-specification feature
also supported by Git is not included in this patch.

If a JGit server were to be patched with this commit, and a repository
on that server configured with RequestPolicy.ANY or
RequestPolicy.REACHABLE_COMMIT_TIP, a Git client built from the "master"
branch would be able to perform a partial clone.

Change-Id: If72b4b422c06ab432137e9e5272d353b14b73259
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
6 years agoSubmoduleStatusCommand: Open Repository in try-with-resource 87/119387/4
David Pursehouse [Wed, 14 Mar 2018 04:39:23 +0000 (13:39 +0900)]
SubmoduleStatusCommand: Open Repository in try-with-resource

Change-Id: Id65c8a94d43bc01e76733eb2ff87635d0f8a8dc2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRepositoryCache#registerRepository: Refactor to use try-with-resource 86/119386/4
David Pursehouse [Wed, 14 Mar 2018 04:37:44 +0000 (13:37 +0900)]
RepositoryCache#registerRepository: Refactor to use try-with-resource

Change-Id: Iaad45b66cc10ac267f6aed7999cc8dc8c07f92e6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRepoCommandSymlinkTest#testLinkFileBare: Use try-with-resource 85/119385/4
David Pursehouse [Wed, 14 Mar 2018 04:35:50 +0000 (13:35 +0900)]
RepoCommandSymlinkTest#testLinkFileBare: Use try-with-resource

Change-Id: I72756d92dc5ea54ad009dddb9cebbcd6d1a0b4f8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRepoCommandTest: Refactor to use try-with-resource 84/119384/4
David Pursehouse [Wed, 14 Mar 2018 04:34:44 +0000 (13:34 +0900)]
RepoCommandTest: Refactor to use try-with-resource

Change-Id: If37ce4447feb431169a75594194a7ef02e362d4e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoObjectIdSerializer: Support serialization of known non-null ObjectId 56/119456/3
David Pursehouse [Wed, 14 Mar 2018 23:25:43 +0000 (08:25 +0900)]
ObjectIdSerializer: Support serialization of known non-null ObjectId

The implementation of ObjectIdSerializer, added in change I7599cf8bd,
is not equivalent to the original implementation in Gerrit [1].

The Gerrit implementation provides separate methods to (de)serialize
instances of ObjectId that are known to be non-null. In these methods,
no "marker" is written to the stream. Replacing Gerrit's implementation
with ObjectIdSerializer [2] broke persistent caches because it started
writing markers where they were not expected [3].

Since ObjectIdSerializer is included in JGit 4.11 we can't change the
existing #write and #read methods. Keep those as-is, but extend the
Javadoc to clarify that they support possibly null ObjectId instances.

Add new methods #writeWithoutMarker and #readWithoutMarker to support
the cases where the ObjectId is known to be non-null and the marker
should not be written to the serialization stream.

Also:

- Replace the hard-coded `0` and `1` markers with constants that can
  be linked from the Javadocs.

- Include the marker value in the "Invalid flag before ObjectId"
  exception message.

[1] https://gerrit-review.googlesource.com/c/gerrit/+/9792
[2] https://gerrit-review.googlesource.com/c/gerrit/+/165851
[3] https://gerrit-review.googlesource.com/c/gerrit/+/165952

Change-Id: Iaf84c3ec32ecf83efffb306fdb4940cc85740f3f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoReceivePackAdvertiseRefsHookTest#testSuccess: Open TransportLocal in t-w-r 82/119382/2
David Pursehouse [Wed, 14 Mar 2018 04:05:41 +0000 (13:05 +0900)]
ReceivePackAdvertiseRefsHookTest#testSuccess: Open TransportLocal in t-w-r

Change-Id: I198ff2ff36de482445141b5ce489204a9c2f4933
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDfsPackCompactor: Open PackWriter in try-with-resource 81/119381/2
David Pursehouse [Wed, 14 Mar 2018 04:01:59 +0000 (13:01 +0900)]
DfsPackCompactor: Open PackWriter in try-with-resource

Change-Id: I2c7b3fdf6a51471c35434a6176865d622b13653d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDfsPackFile: Refactor getBitmapIndex to open ReadableChannel in try-with-resource 80/119380/2
David Pursehouse [Wed, 14 Mar 2018 03:15:38 +0000 (12:15 +0900)]
DfsPackFile: Refactor getBitmapIndex to open ReadableChannel in try-with-resource

Refactor getBitmapIndex to open ReadableChannel in try-with-resource
instead of closing the channel in the finally block.

The same cannot be done in copyPackThroughCache, so just suppress the
warning with an explanatory comment.

Change-Id: I9b95373d350728e85a159423d5ca80e8b215914d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoIndexDiff: Refactor to open Repository in try-with-resource 79/119379/2
David Pursehouse [Wed, 14 Mar 2018 03:10:50 +0000 (12:10 +0900)]
IndexDiff: Refactor to open Repository in try-with-resource

Change-Id: I667d685ccedc730e786f1e52323fdeba4b91af3e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDirCache: Suppress resource warning related to TemporaryBuffer 77/119377/3
David Pursehouse [Wed, 14 Mar 2018 01:56:18 +0000 (10:56 +0900)]
DirCache: Suppress resource warning related to TemporaryBuffer

In #writeTo, the TemporaryBuffer can't be opened in try-with-resource
because it's referenced in the finally block. Instead it is explicitly
closed within the try block. Suppress the warning with an explanatory
comment.

Change-Id: I02009f77f9630d5d55afc34eb86d304ff103b8b0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAdd SilentFileInputStream to allow ignoring exceptions raised by close() 94/119294/6
David Pursehouse [Tue, 13 Mar 2018 07:11:40 +0000 (16:11 +0900)]
Add SilentFileInputStream to allow ignoring exceptions raised by close()

There are several cases where a FileInputStream is opened outside of
a try-with-resource because we want to explicitly close it and ignore
any IOException that is raised by the close() method.

Introduce a helper class, SilentFileInputStream, that overrides the
close method and ignores the exceptions. This allows to open the stream
in a try-with-resource block and remove the explicit handling of the
close method.

Change-Id: I8612f948a1a5b3d1031344922ad75ce4492cfc61
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoWorkingTreeIterator#idSubmodule: Refactor to open Repository in try-with-resource 76/119376/2
David Pursehouse [Wed, 14 Mar 2018 01:19:06 +0000 (10:19 +0900)]
WorkingTreeIterator#idSubmodule: Refactor to open Repository in try-with-resource

Change-Id: I991f0096c833da721b98c1e0423a8dadc67cd64f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUploadPack: Suppress resource warning about PackWriter 75/119375/2
David Pursehouse [Wed, 14 Mar 2018 00:39:48 +0000 (09:39 +0900)]
UploadPack: Suppress resource warning about PackWriter

PackWriter is auto-closeable and should be opened in try-with-resource,
but this is not possible since the variable is being referenced in the
finally block before being explicitly closed there.

Suppress the warning and add an explanatory comment.

Change-Id: I161923f35142132234fd951c0146d3cb30920b7b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoShowPackDelta: Refactor to use try-with-resource 74/119374/2
David Pursehouse [Wed, 14 Mar 2018 00:35:08 +0000 (09:35 +0900)]
ShowPackDelta: Refactor to use try-with-resource

Remove the resource warning suppression and refactor the code to open
the TemporaryBuffer and InflaterInputStream in a try-with-resource.

Change-Id: I3082e5ac7565c5000d5a4364f750dd0a0952fc6e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoSubmoduleWalk#forIndex: Suppress resource warning and update Javadoc 13/119313/4
David Pursehouse [Tue, 13 Mar 2018 11:31:38 +0000 (20:31 +0900)]
SubmoduleWalk#forIndex: Suppress resource warning and update Javadoc

SubmoduleWalk is auto-closeable, and Eclipse warns that is is not
managed by try-with-resource. However in this case the resource should
not be closed, because the caller needs to use it. Instead, it is the
responsibility of the caller to close it after use.

Update the Javadoc to clarify this, and suppress the warning.

Change-Id: Ib7ba349353bfd3341bdcbe4bb19abaeb9f3aeba5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoSubmoduleWalk: Open Repository in try-with-resource 11/119311/4
David Pursehouse [Tue, 13 Mar 2018 11:24:45 +0000 (20:24 +0900)]
SubmoduleWalk: Open Repository in try-with-resource

Change-Id: Ib29aaf26b49aa94a5a7cc0b0264a0a93ecff0c16
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRepositoryFilter: Refactor doFilter to open Repository in try-with-resource 02/119302/4
David Pursehouse [Tue, 13 Mar 2018 08:55:05 +0000 (17:55 +0900)]
RepositoryFilter: Refactor doFilter to open Repository in try-with-resource

Change-Id: Ic4a056eebe567ff933519d6a805edb7e97c71b22
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoNetRC: Open BufferedReader in try-with-resource 16/119316/3
David Pursehouse [Tue, 13 Mar 2018 11:43:44 +0000 (20:43 +0900)]
NetRC: Open BufferedReader in try-with-resource

Change-Id: Ie0688b0ce19f657834a23438f112569a86491b3b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoPackParser: Refactor to open InputStream in try-with-resource 15/119315/3
David Pursehouse [Tue, 13 Mar 2018 11:41:36 +0000 (20:41 +0900)]
PackParser: Refactor to open InputStream in try-with-resource

Change-Id: I8d002ccc8f168f5891492a4c5742c82f8cb7a0b6
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAutoLFInputStreamTest: Use try-with-resource 10/119310/3
David Pursehouse [Tue, 13 Mar 2018 11:20:09 +0000 (20:20 +0900)]
AutoLFInputStreamTest: Use try-with-resource

Change-Id: I162bfa6b2f87f2ce9154f3ed6bb628c4cda88f50
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoDfsInserter: Refactor writePackIndex to use try-with-resource 01/119301/3
David Pursehouse [Tue, 13 Mar 2018 08:51:10 +0000 (17:51 +0900)]
DfsInserter: Refactor writePackIndex to use try-with-resource

Refactor to allow the temporary buffer to be opened in try-with-resource.

Change-Id: Id913e6c3ed3913fd5d79d66238b779e0c225b47d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoAmazonS3: Refactor error method to avoid 'should be managed by try-with-resource... 92/119292/2
David Pursehouse [Tue, 13 Mar 2018 07:00:41 +0000 (16:00 +0900)]
AmazonS3: Refactor error method to avoid 'should be managed by try-with-resource' warning

Change-Id: I205fc1c77777870b0a036e52fa9954de5d9f60b5
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCommandCatalog: Simplify scan method using try-with-resource 91/119291/2
David Pursehouse [Tue, 13 Mar 2018 06:56:47 +0000 (15:56 +0900)]
CommandCatalog: Simplify scan method using try-with-resource

The IOExceptions caught in the nested try blocks are all ignored,
so we can just wrap them all up into a single try-with-resource
block.

Change-Id: Id85850b3f54c408af73063220e6fead20cb0fd80
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTransport: Simplify scan method using try-with-resource 90/119290/2
David Pursehouse [Tue, 13 Mar 2018 06:50:27 +0000 (15:50 +0900)]
Transport: Simplify scan method using try-with-resource

The IOExceptions caught in the nested try blocks are all ignored,
so we can just wrap them all up into a single try-with-resource
block.

Change-Id: I536d682f1017c5088b94ff9f98ffa2b7c783d8bf
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUse CHARSET in FileOutputStream instead of hard-coded "UTF-8" 87/119287/4
David Pursehouse [Tue, 13 Mar 2018 05:21:29 +0000 (14:21 +0900)]
Use CHARSET in FileOutputStream instead of hard-coded "UTF-8"

Change-Id: I63ad25e1ebd94081c8848f4d21044cf9041f971d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoTemporaryBufferTest: Suppress "should be managed by try-with-resource" 97/119297/2
David Pursehouse [Tue, 13 Mar 2018 08:24:10 +0000 (17:24 +0900)]
TemporaryBufferTest: Suppress "should be managed by try-with-resource"

In most of the tests, the temporary buffer is explicitly destroyed in
a finally block after being closed. This is not possible if using the
try-with-resource construct, because the variable is not accessible in
the finally block scope.

Change-Id: I3bab30695ddd12e1a0ae107989638428fe3ef551
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoOpen auto-closeable resources in try-with-resource 86/119286/4
David Pursehouse [Tue, 13 Mar 2018 02:44:23 +0000 (11:44 +0900)]
Open auto-closeable resources in try-with-resource

When an auto-closeable resources is not opened in try-with-resource,
the warning "should be managed by try-with-resource" is emitted by
Eclipse.

Fix the ones that can be silenced simply by moving the declaration of
the variable into a try-with-resource.

In cases where we explicitly call the close() method, for example in
tests where we are testing specific behavior caused by the close(),
suppress the warning.

Leave the ones that will require more significant refcactoring to fix.
They can be done in separate commits that can be reviewed and tested
in isolation.

Change-Id: I9682cd20fb15167d3c7f9027cecdc82bc50b83c4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoImplement --force option in FetchCommand and CLI fetch command 85/119285/1
Matthias Sohn [Tue, 13 Mar 2018 01:20:29 +0000 (02:20 +0100)]
Implement --force option in FetchCommand and CLI fetch command

Change-Id: I42cdb57b8fb54ce466d1958391f12f911045327f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge "Introduce SshSupport to centralize SSH related utility code"
Matthias Sohn [Mon, 12 Mar 2018 23:52:43 +0000 (19:52 -0400)]
Merge "Introduce SshSupport to centralize SSH related utility code"

6 years agoIntroduce SshSupport to centralize SSH related utility code 51/118951/2
Markus Duft [Thu, 8 Mar 2018 07:29:03 +0000 (08:29 +0100)]
Introduce SshSupport to centralize SSH related utility code

As discussed with Thomas here:
https://git.eclipse.org/r/#/c/83506/31/org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/SmudgeFilter.java@349

Move the code from ConfigureGerritAfterCloneTask to SshSupport and
eliminate the slightly modified copy of the code from
LfsConnectionFactory. Separate EGit commit will eliminate the code from
ConfigureGerritAfterCloneTask.

Change-Id: Ifb5adb1342e0fc1f2a70cddf693408d4e0ef7906
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
6 years agoUploadPack: Remove redundant suppression of deprecation warning 89/119189/1
David Pursehouse [Mon, 12 Mar 2018 01:52:03 +0000 (10:52 +0900)]
UploadPack: Remove redundant suppression of deprecation warning

Change-Id: I9a7f46e1da42fd86adedc18b3394d5f755722624
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoConsistently use Constants.CHARSET rather than StandardCharsets.UTF_8 47/118947/4
David Pursehouse [Thu, 8 Mar 2018 00:44:01 +0000 (09:44 +0900)]
Consistently use Constants.CHARSET rather than StandardCharsets.UTF_8

Change-Id: I6714fc3666e1bced22abba94ceb700477349586e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoConstants: Initialize CHARSET and CHARACTER_ENCODING from StandardCharsets.UTF_8 45/118945/4
David Pursehouse [Thu, 8 Mar 2018 00:42:02 +0000 (09:42 +0900)]
Constants: Initialize CHARSET and CHARACTER_ENCODING from StandardCharsets.UTF_8

Change-Id: Ib4e0a35429892fa1581db09a9b77717120d03275
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRemove deprecated LfsProtocolServlet#getLargeFileRepository 28/119128/2
Matthias Sohn [Fri, 9 Mar 2018 23:57:57 +0000 (00:57 +0100)]
Remove deprecated LfsProtocolServlet#getLargeFileRepository

Use LfsProtocolServlet##getLargeFileRepository(LfsRequest, String,
String) instead.

Change-Id: If68d06f2e6edbf843dc9d3b4e3b99c33b0fab766
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated Lfs#Lfs(Path) 27/119127/2
Matthias Sohn [Fri, 9 Mar 2018 23:56:04 +0000 (00:56 +0100)]
Remove deprecated Lfs#Lfs(Path)

Use Lfs#Lfs(Repository) instead.

Change-Id: I7303987ed047b42fd1bac8e27ed49333080e556b
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated StreamCopyThread#flush 26/119126/2
Matthias Sohn [Fri, 9 Mar 2018 23:54:51 +0000 (00:54 +0100)]
Remove deprecated StreamCopyThread#flush

StreamCopyThread: Do not let flush interrupt a write.
flush calls interrupt() to interrupt a pending read and trigger a
flush.  Unfortunately that interrupt() call can also interrupt a
pending write, putting Jsch in a bad state and triggering "Short read
of block" errors.

Change-Id: I11f8a014fd72df06617cc8731d992eb14cc32a67
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated SafeBufferedOutputStream 25/119125/2
Matthias Sohn [Fri, 9 Mar 2018 23:52:22 +0000 (00:52 +0100)]
Remove deprecated SafeBufferedOutputStream

Use Java 8 BufferedOutputStream instead. Java 8 fixed the silent flush
during close issue by FilterOutputStream (base class of
BufferedOutputStream) using try-with-resources to close the stream,
getting a behavior matching what JGit's SafeBufferedOutputStream
was doing

Change-Id: Ieeab59f49b44519585abda213d287b19c7863b17
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated EolCanonicalizingInputStream 24/119124/2
Matthias Sohn [Fri, 9 Mar 2018 23:50:21 +0000 (00:50 +0100)]
Remove deprecated EolCanonicalizingInputStream

Use AutoLFInputStream instead.

Change-Id: If3765c425eed3a52d0c6aa8c7ea4925bb2e87395
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated FileUtils#relativize(String, String) 23/119123/2
Matthias Sohn [Fri, 9 Mar 2018 23:49:14 +0000 (00:49 +0100)]
Remove deprecated FileUtils#relativize(String, String)

Use the more-clearly-named
FileUtils#relativizeNativePath(String, String)
instead, or directly call
FileUtils#relativizePath(String, String, String, boolean).

Change-Id: I9b56302c94630c75293d8cf5510e1d2f22f2b778
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated FileUtil using Java 7 NIO 22/119122/2
Matthias Sohn [Fri, 9 Mar 2018 23:46:47 +0000 (00:46 +0100)]
Remove deprecated FileUtil using Java 7 NIO

Change-Id: I180a7a0bf9fe36c42edab9fffc6c05d983c229a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated TreeWalk#getEolStreamType 21/119121/2
Matthias Sohn [Fri, 9 Mar 2018 23:45:27 +0000 (00:45 +0100)]
Remove deprecated TreeWalk#getEolStreamType

Use TreeWalk#getEolStreamType(OperationType) instead.

Change-Id: I0f102ddf36102ff55a71448e376ed08743da5d1f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated FileTreeIterator(WorkingTreeIterator, File, FS) 20/119120/2
Matthias Sohn [Fri, 9 Mar 2018 23:44:11 +0000 (00:44 +0100)]
Remove deprecated FileTreeIterator(WorkingTreeIterator, File, FS)

Use FileTreeIterator#FileTreeIterator(FileTreeIterator, File, FS)
instead.

Change-Id: I675e14863a1a387e7da9fc5148feffaf55d4ad39
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated TransportHttp#httpOpen(String, URL) 19/119119/2
Matthias Sohn [Fri, 9 Mar 2018 23:40:52 +0000 (00:40 +0100)]
Remove deprecated TransportHttp#httpOpen(String, URL)

Use TransportHttp#httpOpen(String, URL, AcceptEncoding) instead.

Change-Id: I4ad423175daa5499caad9cccb88076d371331569
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated ResolveMerger#processEntry method 18/119118/2
Matthias Sohn [Fri, 9 Mar 2018 23:39:20 +0000 (00:39 +0100)]
Remove deprecated ResolveMerger#processEntry method

Change-Id: I687965f6e9f3bcafa28afd62621fea240b36939d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated Repository#getRef 17/119117/2
Matthias Sohn [Fri, 9 Mar 2018 23:37:07 +0000 (00:37 +0100)]
Remove deprecated Repository#getRef

Use Repository#exactRef(String) or Repository#findRef(String) instead.

Change-Id: I5c547a26604b4cd792111c699df5f3c9d955d3f2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated BitmapBuilder#add 16/119116/2
Matthias Sohn [Fri, 9 Mar 2018 23:33:26 +0000 (00:33 +0100)]
Remove deprecated BitmapBuilder#add

Use BitmapBuilder#or or BitmapBuilder#addObject instead.

Change-Id: I4bd71a842cf9f6ba2f9a17015e8a36ac380bfd3a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated LockFile(File, FS) constructor 14/119114/2
Matthias Sohn [Fri, 9 Mar 2018 23:02:35 +0000 (00:02 +0100)]
Remove deprecated LockFile(File, FS) constructor

Use org.eclipse.jgit.internal.storage.file.LockFile#LockFile(File)
instead.

Change-Id: I107d9879c02a2006799a238ccaddf87c89f33f77
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated IgnoreNode#isIgnored method 13/119113/2
Matthias Sohn [Fri, 9 Mar 2018 23:00:42 +0000 (00:00 +0100)]
Remove deprecated IgnoreNode#isIgnored method

Parameter negateFirstMatch is not honored anymore

Change-Id: Idff1a92643c1431c7e34a7730f8414135e1ac196
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoFix misspelled class name: EmtpyCommitException -> EmptyCommitException 71/100671/4
David Pursehouse [Tue, 19 Dec 2017 02:13:48 +0000 (11:13 +0900)]
Fix misspelled class name: EmtpyCommitException -> EmptyCommitException

Change-Id: I55196020146f26951988988c14ac9a6f85061ae2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoRemove deprecated Statistics, UploadPackLogger, UploadPackLoggerChain 15/119115/2
Matthias Sohn [Fri, 9 Mar 2018 23:31:07 +0000 (00:31 +0100)]
Remove deprecated Statistics, UploadPackLogger, UploadPackLoggerChain

Use PackStatistics and PostUploadHook and PostUploadHookChain instead.
Also remove
- UploadPack#getPackStatistics replaced by #getStatistics
- UploadPack#getLogger and UploadPack#setLogger

Change-Id: I70881c539af3094d68d594f19983dea0973604e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated StoredObjectRepresentationnotAvailableException ctor 12/119112/1
Matthias Sohn [Fri, 9 Mar 2018 22:57:36 +0000 (23:57 +0100)]
Remove deprecated StoredObjectRepresentationnotAvailableException ctor

Use #StoredObjectRepresentationNotAvailableException(ObjectToPack,
Throwable) instead.

Change-Id: I766e00bc7292c7bd025aa2d7c54f10d278c7fabd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove deprecated ArchiveCommand#putEntry method 11/119111/1
Matthias Sohn [Fri, 9 Mar 2018 22:55:43 +0000 (23:55 +0100)]
Remove deprecated ArchiveCommand#putEntry method

Use #putEntry(Closeable, ObjectId, String, FileMode, ObjectLoader)}
instead.

Change-Id: I2c58c07da00c6033c583eb2dc6c3a0889661f5f5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoPrepare 5.0.0-SNAPSHOT builds 45/119045/1
Matthias Sohn [Thu, 8 Mar 2018 22:09:18 +0000 (23:09 +0100)]
Prepare 5.0.0-SNAPSHOT builds

Change-Id: I2d2f50ed8a12f310e7cac68eed5536bd460c403f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMerge branch 'stable-4.11' 44/119044/1
Matthias Sohn [Thu, 8 Mar 2018 22:08:28 +0000 (23:08 +0100)]
Merge branch 'stable-4.11'

* stable-4.11:
  Prepare 4.11.1-SNAPSHOT builds
  JGit v4.11.0.201803080745-r

Change-Id: I225b9a6a9be6bda1d6fc8f605917645ff1fec852

6 years agoPrepare 4.11.1-SNAPSHOT builds 35/119035/1
Matthias Sohn [Thu, 8 Mar 2018 20:10:08 +0000 (21:10 +0100)]
Prepare 4.11.1-SNAPSHOT builds

Change-Id: Id9aa6b7e8f56de5183b6cd57ef0e790ec9debd4d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoJGit v4.11.0.201803080745-r 96/118996/1 v4.11.0.201803080745-r
Matthias Sohn [Thu, 8 Mar 2018 12:43:46 +0000 (13:43 +0100)]
JGit v4.11.0.201803080745-r

Change-Id: Ie24a33bc8a24c30db06fe7b175f405efb95776ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoRemove useless for(;;) loop 13/118713/2
Thomas Wolf [Mon, 5 Mar 2018 19:49:29 +0000 (20:49 +0100)]
Remove useless for(;;) loop

Change-Id: Ic9a7824cc178e92f44126acc8e77b0304b20ef4f
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoFix DiffFormatter for diffs against working tree with autocrlf=true 97/117697/3
Thomas Wolf [Mon, 19 Feb 2018 22:42:46 +0000 (23:42 +0100)]
Fix DiffFormatter for diffs against working tree with autocrlf=true

The WorkingTreeSource produced an ObjectLoader that returned
inconsistent sizes: the file size in getSize(), but then a
correctly filtered smaller stream in openStream(). This resulted
either in an IOE "short read of block" or in an EOFException
depending on the resulting filtered size.

Fix this by ensuring that getSize() does return the size of the
filtered stream.

Bug: 530106
Change-Id: I7c7c85036047dc10030ed29c1d5a6c7f34f2bdff
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
6 years agoMerge branch 'stable-4.10' 34/118934/1
Matthias Sohn [Wed, 7 Mar 2018 21:37:27 +0000 (22:37 +0100)]
Merge branch 'stable-4.10'

* stable-4.10:
  Don't subclass ThreadLocal to avoid memory leak in NLS
  Set context classloader to null in WorkQueue

Change-Id: Idacf9a15a27f8e1d73357a80ed11a02237eea49e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoLFS: Adjust some API to make integration into tools (EGit,...) easier 48/118648/4
Markus Duft [Mon, 5 Mar 2018 09:34:29 +0000 (10:34 +0100)]
LFS: Adjust some API to make integration into tools (EGit,...) easier

Make the install command accessible without requiring reflection.

Expose the isEnabled(Repository) API to be able to check if calling the
install command is required for a repository.

Change-Id: I17e6eaefb6afda17fea8162cbf0cb86a20506753
Signed-off-by: Markus Duft <markus.duft@ssi-schaefer.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
6 years agoMergeHeadMsgTest: Open FileOutputStream in try-with-resource 55/118855/1
David Pursehouse [Wed, 7 Mar 2018 05:49:21 +0000 (14:49 +0900)]
MergeHeadMsgTest: Open FileOutputStream in try-with-resource

Change-Id: I8efa549b98bf661665dc29d48d0e5661b0e8530c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMergeCommand: Open RevWalk in try-with-resource 54/118854/1
David Pursehouse [Wed, 7 Mar 2018 05:46:08 +0000 (14:46 +0900)]
MergeCommand: Open RevWalk in try-with-resource

Change-Id: I45ce481cc198b8dc78e9c46b433504840597e982
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoMeasurePackSizeTest: Open Transport in try-with-resource 53/118853/1
David Pursehouse [Wed, 7 Mar 2018 05:43:51 +0000 (14:43 +0900)]
MeasurePackSizeTest: Open Transport in try-with-resource

Change-Id: If9a39f8eabe1cd3474bdc025ac92218cd2dd1640
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoLongObjectIdTest: Open OutputStreamWriter in try-with-resource 52/118852/1
David Pursehouse [Wed, 7 Mar 2018 05:42:47 +0000 (14:42 +0900)]
LongObjectIdTest: Open OutputStreamWriter in try-with-resource

Change-Id: Ic7c2109204f94c70b933191b46d4a8f2c16a1533
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoJschConfigSessionFactory: Open FileInputStream in try-with-resource 51/118851/1
David Pursehouse [Wed, 7 Mar 2018 05:39:39 +0000 (14:39 +0900)]
JschConfigSessionFactory: Open FileInputStream in try-with-resource

Change-Id: I0f8f4629c93ed747f2f604538fccc52da3974b2e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoCommandCatalog: Use StandardCharsets.UTF_8 39/118839/2
David Pursehouse [Tue, 6 Mar 2018 23:48:12 +0000 (08:48 +0900)]
CommandCatalog: Use StandardCharsets.UTF_8

Change-Id: I7c3356335cfedd81f663fd528799fc57b95fcf0f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoJGitTestUtil: Open auto-closeable resources in try-with-resource 35/118835/2
David Pursehouse [Tue, 6 Mar 2018 23:30:52 +0000 (08:30 +0900)]
JGitTestUtil: Open auto-closeable resources in try-with-resource

Change-Id: Ibc8dd8509109708628e5189888fa528add486452
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoUse StandardCharsets.UTF_8 in tests 34/118834/2
David Pursehouse [Tue, 6 Mar 2018 23:29:51 +0000 (08:29 +0900)]
Use StandardCharsets.UTF_8 in tests

Replace hard-coded "UTF-8" string with the constant.

Change-Id: Ie812add2df28e984090563ec7c6e2c0366616424
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoInfoRefsServlet: Open OutputStreamWriter in try-with-resource 33/118833/1
David Pursehouse [Tue, 6 Mar 2018 23:27:06 +0000 (08:27 +0900)]
InfoRefsServlet: Open OutputStreamWriter in try-with-resource

Change-Id: Iaf93d5c020ee67e9effbe93334f1ad419ffaee1f
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoIndexDiffWithSymlinkTest: Open InputStream in try-with-resource 32/118832/1
David Pursehouse [Tue, 6 Mar 2018 23:25:15 +0000 (08:25 +0900)]
IndexDiffWithSymlinkTest: Open InputStream in try-with-resource

Change-Id: I5f49f80debb2259f665748408cd3604f869fa3ef
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoHugeFileTest: Open RandomAccessFile in try-with-resource 31/118831/1
David Pursehouse [Tue, 6 Mar 2018 23:14:08 +0000 (08:14 +0900)]
HugeFileTest: Open RandomAccessFile in try-with-resource

Change-Id: Iecb9a7348b40c91fa45c051c2a9c4eb47e4bdeca
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoHookMessageTest: Open Transport in try-with-resource 63/118763/1
David Pursehouse [Tue, 6 Mar 2018 08:42:50 +0000 (17:42 +0900)]
HookMessageTest: Open Transport in try-with-resource

Change-Id: Ie58b01a8a78e4f42a3b913708a545687c5c9f96b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoGitSmartHttpTools: Open OutputStream in try-with-resource 62/118762/1
David Pursehouse [Tue, 6 Mar 2018 08:41:12 +0000 (17:41 +0900)]
GitSmartHttpTools: Open OutputStream in try-with-resource

Change-Id: Ifb50b923f58f73d323cc1492950e58b6dc39f376
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoGitServletResponseTests: Open Transport in try-with-resource 61/118761/1
David Pursehouse [Tue, 6 Mar 2018 08:40:23 +0000 (17:40 +0900)]
GitServletResponseTests: Open Transport in try-with-resource

Change-Id: Ib74752c9185e38d0bfe9b4cef93b2427bf3afbd0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoGetTextTest: Open InputStream in try-with-resource 60/118760/1
David Pursehouse [Tue, 6 Mar 2018 08:37:22 +0000 (17:37 +0900)]
GetTextTest: Open InputStream in try-with-resource

Change-Id: I3b68686de2d852b1f0b19c267a4e527229b40316
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoGC: Open auto-closeable resources in try-with-resource 57/118757/2
David Pursehouse [Tue, 6 Mar 2018 08:23:53 +0000 (17:23 +0900)]
GC: Open auto-closeable resources in try-with-resource

Change-Id: If437e14636de7c5014ee2aa419d6518acd857792
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFileSnapshotTest: Open FileOutputStream in try-with-resource 56/118756/1
David Pursehouse [Tue, 6 Mar 2018 08:19:59 +0000 (17:19 +0900)]
FileSnapshotTest: Open FileOutputStream in try-with-resource

Change-Id: I187dd61e3e7d6f141722bf1af86a7fe04711057d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFileSender: Open OutputStream in try-with-resource 55/118755/1
David Pursehouse [Tue, 6 Mar 2018 08:19:07 +0000 (17:19 +0900)]
FileSender: Open OutputStream in try-with-resource

Change-Id: I2278950998dffc2b5730a91a5bb3bcc38f4d446b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFileRepository: Open FileInputStream in try-with-resource 54/118754/1
David Pursehouse [Tue, 6 Mar 2018 08:18:23 +0000 (17:18 +0900)]
FileRepository: Open FileInputStream in try-with-resource

Change-Id: Ief8aa4834437d76f7e636598bf9861312475e64a
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFileLfsServlet: Open PrintWriter in try-with-resource 53/118753/1
David Pursehouse [Tue, 6 Mar 2018 08:15:04 +0000 (17:15 +0900)]
FileLfsServlet: Open PrintWriter in try-with-resource

Change-Id: I6fa225e541c6d5c3dbf3d852a502f4e9c4f7d77e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFetchProcess: Open OutputStreamWriter in try-with-resource 52/118752/1
David Pursehouse [Tue, 6 Mar 2018 08:14:19 +0000 (17:14 +0900)]
FetchProcess: Open OutputStreamWriter in try-with-resource

Change-Id: Ide7768882a95f9e9706e50ca0774edd428dd07c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoFS: Open TemporaryBuffer in try-with-resource 50/118750/1
David Pursehouse [Tue, 6 Mar 2018 07:58:12 +0000 (16:58 +0900)]
FS: Open TemporaryBuffer in try-with-resource

Change-Id: I52e048e491e838b7f762a5b5f4d148e91049877c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoEditListTest: Open InputStream in try-with-resource 49/118749/2
David Pursehouse [Tue, 6 Mar 2018 07:52:28 +0000 (16:52 +0900)]
EditListTest: Open InputStream in try-with-resource

Change-Id: Ib5b86e332ec674dec5460a9629d94d9f94c31c24
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoEGitPatchHistoryTest: Open BufferedReader in try-with-resource 48/118748/2
David Pursehouse [Tue, 6 Mar 2018 07:49:23 +0000 (16:49 +0900)]
EGitPatchHistoryTest: Open BufferedReader in try-with-resource

Change-Id: I74aede463c7b0a478a1e0e8b680c206d3964061d
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoT0003_BasicTest: Use CommitBuilder.setEncoding(Charset) 47/118747/3
David Pursehouse [Tue, 6 Mar 2018 04:42:45 +0000 (13:42 +0900)]
T0003_BasicTest: Use CommitBuilder.setEncoding(Charset)

Change-Id: I1c4cdd4b856d715a204030d2de25ef91977186c2
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoWalkEncryptionTest: Use StandardCharsets.UTF_8 46/118746/3
David Pursehouse [Tue, 6 Mar 2018 04:39:37 +0000 (13:39 +0900)]
WalkEncryptionTest: Use StandardCharsets.UTF_8

Change-Id: I6eb8a33be62c452c264fb0560b988144d80a41f9
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoGetTextTest: Use StandardCharsets constants instead of CharSet.forName 45/118745/3
David Pursehouse [Tue, 6 Mar 2018 04:37:09 +0000 (13:37 +0900)]
GetTextTest: Use StandardCharsets constants instead of CharSet.forName

Change-Id: I61d626495338a89c014187c38a1f6b49accf7af4
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
6 years agoEGitPatchHistoryTest: Set input stream encoding with constant 44/118744/3
David Pursehouse [Tue, 6 Mar 2018 04:34:31 +0000 (13:34 +0900)]
EGitPatchHistoryTest: Set input stream encoding with constant

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