Commit Graph

1550 Commits

Author SHA1 Message Date
Matthias Sohn f2ee537d55 Prepare 4.3.1-SNAPSHOT versions
Change-Id: I52c98ba8fb3a303269a1f9380af114b6dd8c5009
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-08 00:56:43 +02:00
Matthias Sohn 4f0daa3bb2 JGit v4.3.0.201604071810-r
Change-Id: I902cdf1ff92ce8c6e9d80c4965d8d5bd8b9ac6c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-08 00:10:10 +02:00
Matthias Sohn 57e6274bcf JGit v4.3.0.201604071045-r
Change-Id: Iafab78d6be34d31a13f979b7be67611135c0f8bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-07 16:41:24 +02:00
Matthias Sohn 27d06cb8d5 Merge branch 'master' into stable-4.3
* master:
  Remove repository from cache when it's closed
  Fix RefDirectory not closing resources
  Fix repository cache never closing repository

Change-Id: I9dc9d017806cba25125f69b53812cc3e062ef975
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-07 13:06:23 +02:00
Hugo Arès 7d2b3b9e25 Remove repository from cache when it's closed
RepositoryCache has 2 methods to remove a repository from the cache but
they are never called when a repository is closed. Users of the cache
were expected to call one of those 2 methods but how could they have
called them at proper time without having visibility of the repository
usage count.

Ideally, I would have reworked the RepositoryCache to wrap any
repository it opens in a class that would be responsible to unregister
them from the cache when it's really closed, i.e. when usage counter
reaches 0. The problem preventing the wrapping solution is the
RepositoryCache.register method that allows to register an already
opened repository in the cache. Such repositories cannot be wrapped
because callers are still holding a reference on the unwrapped
repository.

Document that RepositoryCache.close method is removing the repository
from the cache as well as closing it and rework
RepositoryCache.unregister method to only remove the repository from the
cache. Use the latter to unregister repository when Repository.doClose
is getting executed.

Change-Id: Ia364816e4da8d7b6cfa72f10758ca31aa8a1f9db
Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-07 13:00:50 +02:00
Hugo Arès 83235432e7 Fix repository cache never closing repository
Repository has a usage counter that is initialized to 1 at
instantiation and this counter is decremented when Repository.close
method is called. There is also a Repository.incrementOpen method that
RepositoryCache uses to increment the usage count when it's returning a
repository that is already opened.

The problem was that RepositoryCache was incrementing the usage count
for repositories that it just opened or registered. The usage count was
2 when it should have been 1.

Incrementing usage count is now only be done for repository that are
served from the cache.

This bug is causing slow memory increase of our Gerrit server until the
server become slow. Even if the RepositoryCache is using SoftReference,
it seems that the JVM is not garbage collecting the repositories because
it's not yet on the edge of being out of memory.

To test this change, I replicated all repositories(11k) from Gerrit
master to one slave. The Gerrit master used memory after this test was
10GB without this change and 3.5GB with.

Change-Id: I86c7b36174e384f106b51fe92f306018fd1dbdf0
Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
2016-04-07 11:32:57 +02:00
Matthias Sohn f56b9001fc Merge branch 'master' into stable-4.3
* master:
  Add config parameter gc.prunePackExpire for packfile expiration
  In TestRepository, use a consistent clock

Change-Id: I7ac568e650fbd191e48a8f1a4068af72deb242e8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-06 16:05:14 +02:00
Christian Halstrick 47dd98e362 Enable calling of smudge filters when checking out paths
When checking out commits/branches JGit was triggering correctly
configured smudge filters. But when checking out paths (either from
index or from commits) JGit was not triggering smudge filters. Fix
CheckoutCommand to properly call filters.

Bug: 486560
Also-by: Pascal Krause <pascal.krausek@sap.com>
Change-Id: I5ff893054defe57ab12e201d901fe74e1376efea
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-06 00:06:53 +02:00
Matthias Sohn 46bef2bcb6 Prepare 4.3-SNAPSHOT builds
Change-Id: Ib831f8870938113bd5338763f90a07d5c108b1de
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-05 23:10:06 +02:00
Preben Ingvaldsen 403f04d8dd Implement DIR_NO_GITLINKS
Implement the DIR_NO_GITLINKS setting with the same functionality
it provides in cGit.

Bug: 436200
Change-Id: I8304e42df2d7e8d7925f515805e075a92ff6ce28
Signed-off-by: Preben Ingvaldsen <preben@puppetlabs.com>
2016-04-05 10:43:40 +02:00
Christian Halstrick 74743bc547 Add config parameter gc.prunePackExpire for packfile expiration
JGit's Garbage Collector is repacking relevant objects into new
packfiles and is afterwards deleting the now obsolete packfiles. But to
prevent problems caused by race conditions JGit was not deleting
packfiles when they are too young. The same mechanism as for loose
objects and the config parameter gc.pruneExpire was used.
But JGit was reusing the parameter gc.pruneExpire also for packfiles
which may cause a lot of filesystem consumption if gc.pruneExpire was
set to the default of 2 weeks. Only two weeks after packfile creation gc
was allowed to delete this packfile.

This change introduces a new config paramter gc.prunePackExpire with a
default of "1.hour". This parameter is used when packfiles are deleted.
Only packfiles older than the specified time can be deleted.

For loose objects the behaviour is not changed and only the old
parameter gc.pruneExpire is relevant. 

Change-Id: I6209efb05678b15153bd22479dc13486907a44f8
2016-03-31 16:11:02 +02:00
Matthias Sohn bf32c9102f JGit v4.3.0.201603230630-rc1
Change-Id: I10835e5aa3618e5033424595942cc1649152cb24
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-03-23 11:27:04 +01:00
Preben Ingvaldsen cff546b0cb Introduce FileModeStrategy to FileTreeIterator
This commit introduces a FileModeStrategy to
the FileTreeIterator class.  This provides a way to
allow different modes of traversing a file tree;
for example, to control whether or not a nested
.git directory should be treated as a gitlink.

Bug: 436200
Change-Id: Ibf85defee28cdeec1e1463e596d0dcd03090dddd
Signed-off-by: Preben Ingvaldsen <preben@puppetlabs.com>
2016-03-11 08:41:13 +01:00
Ivan Motsch b811e4399e Add EOL stream type detection to TreeWalk
TreeWalk provides the new method getEolStreamType. This new method can
be used with EolStreamTypeUtil in order to create a wrapped InputStream
or OutputStream when reading / writing files. The implementation
implements support for the git configuration options core.crlf, core.eol
and the .gitattributes "text", "eol" and "binary"

CQ: 10896
Bug: 486563
Change-Id: Ie4f6367afc2a6aec1de56faf95120fff0339a358
Signed-off-by: Ivan Motsch <ivan.motsch@bsiag.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-03-07 17:24:32 +01:00
XinTong Wang 770d36c8ba Fix apply patch which did not work with non-ascii characters
Bug: 483943
Change-Id: If28f64053d20ab1bee54245f223e952dc2fe392c
Signed-off-by: XinTong Wang <xintong@ca.ibm.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-03-03 01:43:02 +01:00
Matthias Sohn ff5c756c79 Merge branch 'stable-4.2'
* stable-4.2:
  Revert "Fix warnings about unchecked conversion of MergeResult"

Change-Id: I31c2e0679ad4cff77190858ac9a570d04841c386
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-02-16 01:06:11 +01:00
Shawn Pearce 8c1d44e436 Merge "Revert "Fix warnings about unchecked conversion of MergeResult"" into stable-4.2 2016-02-15 19:00:50 -05:00
Shawn Pearce 591e39bf9d Revert "Fix warnings about unchecked conversion of MergeResult"
This reverts commit 979fa19110.
Breaks API.

Change-Id: I54af657898d49f64d6906fe3edfb6b08e996d901
2016-02-15 18:45:55 -05:00
Matthias Sohn 514b11ddcc Merge branch 'stable-4.2'
* stable-4.2:
  Don't use deprecated LockFile constructor
  Fix warnings about unchecked conversion of MergeResult
  MockServletConfig: Fix warning about unchecked conversion of Enumeration
  HugeFileTest: Make Git a class member and open in try-with-resource
  Suppress "unchecked cast" warnings related to UploadPackFactory.DISABLED
  DiffAlgorithms: Fix warnings about variable hiding
  DirCacheBasicTest: Open ObjectInserter.Formatter in try-with-resource
  DirCacheBuilderIteratorTest: Open TreeWalk in try-with-resource
  DirCacheCGitCompatabilityTest: Open TreeWalk in try-with-resource
  DirCacheCheckoutMaliciousPathTest: Open Git and RevWalk in t-w-r
  DirCacheIteratorTest: Open TreeWalk instances in try-with-resource
  ForPathTest: Open TreeWalk in try-with-resource
  GitConstructionTest: Open Git instance in try-with-resource
  IndexDiffTest: Open Git instances in try-with-resources
  ManifestParserTest: Don't use deprecated StringBufferInputStream
  InMemoryRepository: Remove unused RevWalk from batch method signature
  IndexModificationTimesTest: Open Git instances in try-with-resource
  InterIndexDiffFilterTest: Open TreeWalk in try-with-resource
  LockFileTest: Open Git instance in try-with-resource
  JGit v4.1.2.201602141800-r
  MergeCommandTest: Use JUnit's assume to check preconditions
  MergeCommandTest: Open Git instances in try-with-resource

Change-Id: Ie5dba6b9132a29e86958a04fa2b76465bcd2c6b5
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-02-15 23:28:18 +01:00
Shawn Pearce 621b0740b3 Merge "Allow deletion of HEAD ref if the repository is bare." 2016-02-15 13:02:05 -05:00
Shawn Pearce e9ce3a992c Merge changes I13672371,I95074358 into stable-4.2
* changes:
  MergeCommandTest: Use JUnit's assume to check preconditions
  MergeCommandTest: Open Git instances in try-with-resource
2016-02-15 12:59:33 -05:00
David Pursehouse e96cb22a43 Don't use deprecated LockFile constructor
Change-Id: Ibc3e2f3372e1a65732dd6d3c71cec53fb1aa15e2
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 18:44:24 +09:00
David Pursehouse 979fa19110 Fix warnings about unchecked conversion of MergeResult
Change-Id: I1490b2209fa7b39676849c624adbc262a672f6df
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 18:22:53 +09:00
David Pursehouse 8deff4b969 HugeFileTest: Make Git a class member and open in try-with-resource
There's only one test method in this module and it's quite long, so
rather than using a try-with-resource and having to indent a huge
block of existing code, make the Git a member variable that gets
initialised and closed in @Before and @After annotated methods.

The methods are named 'before' and 'after' rather than the conventional
'setUp' and 'tearDown' so as not to conflict with the names of the
existing methods in LocalDiskRepositoryTestCase.

Change-Id: I5a4a9b59f244c450dbcae9fdde7d9e0f0cd24e6f
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 18:04:07 +09:00
David Pursehouse c9e61c7b39 DirCacheBasicTest: Open ObjectInserter.Formatter in try-with-resource
Change-Id: Ie4b3e5ad9616bc56b6d8d2476d1e6c6319c1a0aa
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:19:17 +09:00
David Pursehouse fc4ac28aa9 DirCacheBuilderIteratorTest: Open TreeWalk in try-with-resource
Change-Id: I94836315918924cba9a2b5be6b9ae417cb2ad215
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:17:17 +09:00
David Pursehouse 0973c9fc48 DirCacheCGitCompatabilityTest: Open TreeWalk in try-with-resource
Change-Id: I81a8bd2aba7eb0a6efaea5d6f7720aa725052157
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:16:00 +09:00
David Pursehouse 259dca06ec DirCacheCheckoutMaliciousPathTest: Open Git and RevWalk in t-w-r
Change-Id: Iacb4e25f0ada74b1a01e448216cb02c7ec18b2d7
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:14:09 +09:00
David Pursehouse 30c9ec88d1 DirCacheIteratorTest: Open TreeWalk instances in try-with-resource
Change-Id: If23597acaebf2295b85411bf87bc0292d5dc789e
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:12:29 +09:00
David Pursehouse 430b777830 ForPathTest: Open TreeWalk in try-with-resource
Change-Id: Ie4d0eb9c0fe1d8b8f41da161e701137cd7dd178f
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:09:09 +09:00
David Pursehouse 130cf0d61a GitConstructionTest: Open Git instance in try-with-resource
Change-Id: Iddf658acd1c78161d6028cfcfb7e5c73534ae40b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:07:22 +09:00
David Pursehouse f23b0fd7e6 IndexDiffTest: Open Git instances in try-with-resources
Change-Id: I7fa2d16561982ddfde053f2fe78135c114b66b1d
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:04:31 +09:00
David Pursehouse 4d3dc41f2f ManifestParserTest: Don't use deprecated StringBufferInputStream
Replace it with ByteArrayInputStream as suggested in [1].

[1] http://stackoverflow.com/a/2219543/381622

Change-Id: I5ca8d721a756a82ea5f5687a20555303eb1dfc18
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 16:54:50 +09:00
David Pursehouse 217760fee5 IndexModificationTimesTest: Open Git instances in try-with-resource
Change-Id: If52c071b71f5df822b1ac276a6f665515f6c9d00
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 14:51:42 +09:00
David Pursehouse de73fbf597 InterIndexDiffFilterTest: Open TreeWalk in try-with-resource
Change-Id: Ie0046771b1ab1c9784d9a3bb597a9d76c6c3017d
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 14:49:58 +09:00
David Pursehouse 6d33322df4 LockFileTest: Open Git instance in try-with-resource
Change-Id: Ie2b0e55e606f50c46e21227f23de74dbea8388e5
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 14:48:02 +09:00
Matthias Sohn 4dcf34eddf Merge branch 'stable-4.2'
* stable-4.2:
  NoteMapTest: Open TreeWalk instances in try-with-resource
  ObjectDirectoryTest: Fix warnings about variable hiding
  PackWriterTest: Open RevWalk in try-with-resource
  PatchIdDiffFormatterTest: Open Git and PatchIdDiffFormatter in try-with-resource
  PathSuffixFilterTest: Open TreeWalk in try-with-resource
  PostOrderTreeWalkTest: Open TreeWalk in try-with-resource
  PullCommandWithRebaseTest: Open RevWalk in try-with-resource
  PushCommandTest: Open Git instances in try-with-resource
  RacyGitTests: Open NameConflictTreeWalk in try-with-resource
  RecursiveMergerTest: Open TreeWalk and BufferedReader in try-with-resource
  ReflogConfigTest: refactor commit method to avoid variable hiding
  Update .mailmap
  RefDirectoryTest: Fix warning about member variable hiding
  ReflogResolveTest: Open Git instances in try-with-resource
  ReflogTest: Open Git instances in try-with-resource
  RepoCommandTest: Open Git instances in try-with-resource

Change-Id: I7964b699396629e31a9cc5600aedcf4be4e659a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-02-12 11:15:33 +01:00
David Pursehouse 61bb701eeb MergeCommandTest: Use JUnit's assume to check preconditions
Using the assume method, instead of just returning, will cause the
test to be marked as skipped rather than passed on systems where
the precondition is not satisfied.

Change-Id: I13672371f6cd3c481a0a6247e0eaed3aac6d766e
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 14:41:44 +09:00
David Pursehouse 03987f980b MergeCommandTest: Open Git instances in try-with-resource
Change-Id: I95074358cec6fef6b5ced7bb7b117c33fee08a7a
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 14:39:08 +09:00
David Pursehouse 50e21322de NoteMapTest: Open TreeWalk instances in try-with-resource
Change-Id: I70da0140fe087e7e69c28e9ddd125495d916ec1b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 14:12:25 +09:00
David Pursehouse 35ba741cd4 ObjectDirectoryTest: Fix warnings about variable hiding
The variable and parameter named 'db' were hiding class members
with the same name.

Change-Id: I27017afdc5f49c38c6f5be494e7a21239ea601a7
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 14:10:12 +09:00
David Pursehouse 101ac16e8d PackWriterTest: Open RevWalk in try-with-resource
Change-Id: Ic8ed941d096718e81c7ffeb166bcf7faaa2ff57d
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 14:09:02 +09:00
David Pursehouse 53b6bb9cca PatchIdDiffFormatterTest: Open Git and PatchIdDiffFormatter in try-with-resource
Change-Id: I39e898e52c3d9dffaba9dabf11c085503fbc1acf
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 14:07:53 +09:00
David Pursehouse f7a3643fb8 PathSuffixFilterTest: Open TreeWalk in try-with-resource
Change-Id: If0ee71f09a5464e27f0496dac364f8f9bb015eb6
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 14:02:49 +09:00
David Pursehouse a3923f6b95 PostOrderTreeWalkTest: Open TreeWalk in try-with-resource
Also remove unnecessary nesting in test methods.

Change-Id: Id59f8403c0a7b38ebb6b3a24814257cd59ea575d
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 14:01:30 +09:00
David Pursehouse ad9b326e3f PullCommandWithRebaseTest: Open RevWalk in try-with-resource
Change-Id: I16f4d219e8b103d30149b2a94d3484424f3de84b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 13:57:34 +09:00
David Pursehouse f3c250bd08 PushCommandTest: Open Git instances in try-with-resource
Change-Id: I3a8e28a4097e868a34ee1b23256c7f28d570cd75
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 13:55:40 +09:00
David Pursehouse 83f1f8fc7c RacyGitTests: Open NameConflictTreeWalk in try-with-resource
Change-Id: Ic17b05fd7d056761b352168de97efb607a289276
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 13:50:54 +09:00
David Pursehouse 3adea9ac7f RecursiveMergerTest: Open TreeWalk and BufferedReader in try-with-resource
Change-Id: I381d535eb4ed7535ba8541c5320f81ce11d5b173
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 13:48:54 +09:00
David Pursehouse 964da41d52 ReflogConfigTest: refactor commit method to avoid variable hiding
The author and committer parameters were hiding class members of
the same name.

Since the passed in PersonIdent instances were being created from
the class members anyway, remove the parameters and instead create
the PersonIdent instances inline in the method.

Change-Id: I66b057df388835d57f332fdcbadb8a9f4e1094a4
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 13:43:56 +09:00