Commit Graph

4426 Commits

Author SHA1 Message Date
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
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
Matthias Sohn 09810d013c Merge "Make the FileLfsRepository thread safe" 2016-03-22 19:11:08 -04:00
Saša Živkov b72fc2b494 Make the FileLfsRepository thread safe
The FileLfsRepository.out member could have been accessed from multiple
threads which would corrupt the content.

Don't store the AtomicObjectOutputStream in the FileLfsRepository.out but
move it to the ObjectUploadListener which is instantiated per-request.

Add a parallel upload test.

Change-Id: I62298630e99c46b500d376843ffcde934436215b
Signed-off-by: Saša Živkov <sasa.zivkov@sap.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-03-22 17:26:46 +01:00
Jonathan Nieder b601e88738 Merge "Add missing @Deprecated annotation" 2016-03-11 17:58:13 -05:00
Jonathan Nieder 90cf265dd4 Add missing @Deprecated annotation
Noticed by error-prone (http://errorprone.info/bugpattern/DepAnn).

Change-Id: If8dcc2dd6d7cabffc95e10f8357ce31c12cf6b1c
2016-03-11 14:55:18 -08:00
Yuxuan 'fishy' Wang 7507d9e2a9 Fix wrong whitespaces.
This change replaced some tabs with spaces introduced in
change I8b3765713599e34f1411f9bbc7f575ec7c2384e0.

Change-Id: Ia5c23b38c9fbbb46f150e527347b61c64c8d9e87
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2016-03-11 14:37:16 -08:00
Yuxuan 'fishy' Wang 0ecb016d7d Add ignoreRemoteFailures option to RepoCommand
With ignoreRemoteFailures set to true, we can ignore remote failures
(e.g. the branch of a project described in the manifest file does not
exist), skip that project and continue to the next one, instead of fail
the whole operation.

Change-Id: I8b3765713599e34f1411f9bbc7f575ec7c2384e0
Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
2016-03-11 14:20:24 -08: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
Matthias Sohn 6bcd8c6e90 Merge "Change visibility of DirCacheTree#getObjectId to public" 2016-03-07 20:12:00 -05:00
Philipp Marx 011e5da3e0 Change visibility of DirCacheTree#getObjectId to public
Allow access to the ObjectId of a DirCacheTree if known for low level
integration code.

Change-Id: I6f05b10c9ac781f5e8b38af4a19e653313c91fa8
Signed-off-by: Philipp Marx <smigfu@googlemail.com>
2016-03-07 22:55:46 +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
Matthias Sohn 846ef78a02 Fix RebuildRefTree trying to add HEAD twice to RefTree
14dfa70520 fixed the problem that HEAD wasn't added to the reftree when
rebuilding the reftree in an empty repository where HEAD isn't yet
resolvable. Since non-resolvable refs are filtered out by
RefDatabase.getRefs(ALL) we have to add HEAD to the reftree explicitly
in this special case.

This fix resulted in another bug: rebuilding the reftree in a repository
which has a resolvable HEAD failed with a DirCacheNameConflictException
in RefTree.apply(). If HEAD is resolvable RefDatabase.getRefs(ALL) does
not filter out HEAD. This results in two identical CREATE commands for
HEAD which RefTree.apply() refuses to execute.

Fix this by no longer creating a duplicate CREATE command for HEAD.

See: I46cbc2611b9ae683ef7319dc46af277925dfaee5
Change-Id: I58dd6bcdef88820aa7de29761d43e2edfa18fcbe
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-03-05 01:03:34 +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 be8c525fa0 Fix help text for option --enable of command debug-rebuild-ref-tree
This fixes a MissingResourceException thrown when executing
jgit debug-rebuild-ref-tree --help

Change-Id: I637ea55084a913f5105ebf4cf2baef8b81877938
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-03-01 23:18:34 +01:00
Matthias Sohn e1b7e4eec7 Update Mars orbit repository to R20160221192158
This version fixes signing of Apache httplclient.

Change-Id: I81d7a643233386442bd31ee602669d2c88b68576
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-02-26 22:58:06 +01:00
Ivan Motsch 2baa5f1d6d Tests on Windows with URIish fail
The reason is that URIish(URL) and URIish(String) make different parsing
of path / rawPath with regard to drive letters. /C:/... for URL and
C:/... for String. This patch fixes the issue.

Change-Id: I8e2013fff30b7bb198ff733c038e21366667b8a0
Signed-off-by: Ivan Motsch <ivan.motsch@bsiag.com>
2016-02-25 15:39:41 +01:00
Matthias Sohn f6a425cc97 Remove the profiles for selecting the target platform
Target platform can be configured directly, e.g.:
  $ mvn clean install -Dtarget-platform=jgit-4.6

Set the default to use the Mars target platform.

Change-Id: Ib6075af19be88fa418ecbe4dd7a217d9879e178a
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-02-19 00:25:16 +01:00
Matthias Sohn 8bb1b5a7ba Add Neon target platform
Change-Id: I24cceef84a9351b84ca46635a3898de113f1046c
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-02-18 23:43:20 +01:00
Matthias Sohn e74385b0dd Remove unused package export from bundle org.eclipse.jgit.lfs.test
This may have caused the spurious compile errors sometimes observed in
Eclipse since org.eclipse.jgit.lfs.lib is a split package to enable
testing package private code in bundle org.eclipse.jgit.lfs.

Change-Id: I0294448965de8ad8c254b26382386ef2b9f6e863
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-02-18 23:34:03 +01:00
Sasa Zivkov 8efdaaf991 Merge "Support Amazon S3 based storage for LFS" 2016-02-17 11:54:16 -05:00
Matthias Sohn f496177a37 Support Amazon S3 based storage for LFS
Add a storage implementation storing large objects in Amazon S3.
The AmazonS3Repository pre-signs download and upload requests.

AWS access and secret key are expected to be in the
$HOME/.aws/credentials file in the following format:

[default]
  accessKey = ...
  secretKey = ...

Use AWS version 4 request signing [1] because it is more secure and
supported by all regions. The version 3 signing is not supported in
newer regions.

In follow up changes we should:

- implement getVerifyAction() and do actual verification. Subclasses of
S3Repository can implement caching for object meta data (size) in order
to avoid extra roundtrips to S3. Verification should ensure that meta
data store and content of S3 storage are in sync

- HEAD request used in S3Repository.getSize() seems to always return
Content-length 0 in contrast to the documentation [2]. So getSize() does
detect if the object exists in S3 or not but in case the object exists
it always returns size 0

[1] http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
[2] https://forums.aws.amazon.com/thread.jspa?threadID=223616

Change-Id: Ic47f094928a259e5264c92b3aacf6d90210907a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
2016-02-17 11:36:58 -05:00
Shawn Pearce 68d8a51d08 Introduce specific WantNotValidException for servers
Capture the internal "want X not valid" state as a specific subclass
of PackProtocolException, allowing this to be more easily identified
in server stack traces and wrapper application code.

Change-Id: I4b1adb7497f396432da420b0f600ad25a261f912
2016-02-16 16:41:51 -08:00
Shawn Pearce e7a6e85b95 smart HTTP server: Pass along "want X not valid" to client
If the client sends a SHA-1 that the server does not recognize echo
this back to the client with an explicit error message instead of
the generic "internal server error".

This was always the intent of the implementation but it was being
dropped on smart HTTP due to the UploadPackServlet catching the
PackProtocolException, discarding the buffered message UploadPack
meant to send, and sending along a generic message instead.

Change-Id: I8d96b064ec655aef64ac2ef3e01853625af32cd1
2016-02-16 15:09:05 -08: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 cf8e0f34d9 MockServletConfig: Fix warning about unchecked conversion of Enumeration
Change-Id: Ic5ce6d220e3b644032819ce4b2f31c669be1cdb9
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 18:21:49 +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 f595089be0 Suppress "unchecked cast" warnings related to UploadPackFactory.DISABLED
Change-Id: Id74694e18fec326df2b04eb796b46ccc6484b23f
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:36:00 +09:00
David Pursehouse 3a437dd655 DiffAlgorithms: Fix warnings about variable hiding
Local variables/parameters named 'db' and 'cmp' were hiding class
member variables of the same name.

Change-Id: I98b770587aaf73744a93e6a3ee33d131a9fa91e9
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 17:29:20 +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 f04bd20fc6 InMemoryRepository: Remove unused RevWalk from batch method signature
The RevWalk given in the arguments is not used. According to the
comment at the top of the method, a new RevWalk is intentionally
used in the implementation.

Remove the unused argument.

Change-Id: Iec81a1341d5bf377801475845b96a465753096ef
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-15 14:57:39 +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