Ivan Motsch [Thu, 25 Feb 2016 14:39:41 +0000 (15:39 +0100)]
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>
Matthias Sohn [Thu, 18 Feb 2016 22:34:03 +0000 (23:34 +0100)]
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>
Matthias Sohn [Wed, 3 Feb 2016 10:34:51 +0000 (11:34 +0100)]
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
Change-Id: Ic47f094928a259e5264c92b3aacf6d90210907a8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Shawn Pearce [Wed, 17 Feb 2016 00:41:51 +0000 (16:41 -0800)]
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.
Shawn Pearce [Tue, 16 Feb 2016 23:09:05 +0000 (15:09 -0800)]
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.
Matthias Sohn [Mon, 15 Feb 2016 22:27:28 +0000 (23:27 +0100)]
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>
David Pursehouse [Mon, 15 Feb 2016 08:41:05 +0000 (17:41 +0900)]
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>
David Pursehouse [Mon, 15 Feb 2016 05:57:39 +0000 (14:57 +0900)]
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>
David Ostrovsky [Sun, 14 Feb 2016 10:36:25 +0000 (11:36 +0100)]
Buck: Simplify root build file
Remove all proxy rules, that were introduced to allow to build Gerrit
with hijacked JGit cell. New approach suggested in: [1], that emulates
real JGit project structure in its own cell, makes them unnecessary.
Add :all rule, that build all artifacts and packages them in zip file.
Add shell binary :jgit_bin rule, that allows to execute JGit binary
from with buck run command, e.g.:
$ buck run jgit_bin status
$ buck run jgit_bin -- --version
Matthias Sohn [Fri, 12 Feb 2016 10:15:19 +0000 (11:15 +0100)]
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>
David Pursehouse [Fri, 12 Feb 2016 05:41:44 +0000 (14:41 +0900)]
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>
David Pursehouse [Fri, 12 Feb 2016 04:43:56 +0000 (13:43 +0900)]
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>
Ivan Motsch [Tue, 17 Nov 2015 15:04:01 +0000 (16:04 +0100)]
Add Attribute Macro Expansion
Attributes MacroExpander implements macros used in git attributes. This
is implemented inside the TreeWalk using a lazy created MacroExpander.
In addition, the macro expander caches the global and info attributes
node in order to provide fast merge of attributes.
Change-Id: I2e69c9fc84e9d7fb8df0a05817d688fc456d8f00 Signed-off-by: Ivan Motsch <ivan.motsch@bsiag.com>
Matthias Sohn [Tue, 9 Feb 2016 23:50:41 +0000 (00:50 +0100)]
Merge branch 'stable-4.2'
* stable-4.2:
RepoProject: Fix warnings about variable hiding
RepoTest: Open Git in try-with-resources
RepositoryResolveTest: Open Git in try-with-resource
RepositoryTestCase: Open autocloseable types in try-with-resource
ResetCommandTest: Use Git member in testHardResetAfterSquashMerge
ResolveMergerTest: Open Git in try-with-resource
RevCommitListTest: Open Git and RevWalk in try-with-resource
RevCommitParseTest: Open ObjectInserter.Formatter in try-with-resource
RevObjectTest: Open RevWalk in try-with-resource
RevTagParseTest: Open ObjectInserter.Formatter in try-with-resource
RevertCommandTest: Open Git in try-with-resource
SquashMessageFormatterTest: Open git in try-with-resource
StatusCommandTest: Open Git in try-with-resource
SubmoduleAddTest: Open Git in try-with-resource
SymlinksTest: Open git and TreeWalk in try-with-resource
T0003_BasicTest: Open autocloseable types in try-with-resource
TextHashFunctions: Fix warnings about variable hiding
TreeFilterTest: Open TreeWalk in try-with-resource
TreeWalkJava7Test: Open TreeWalk in try-with-resource
Fix diff for added and removed submodule
Change-Id: If3ecc63f6dfac55474d3c1dd2f4105371f3d24fb Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Matthias Sohn [Tue, 22 Dec 2015 15:11:43 +0000 (16:11 +0100)]
Support LFS protocol and a file system based LFS storage
Implement LfsProtocolServlet handling the "Git LFS v1 Batch API"
protocol [1]. Add a simple file system based LFS content store and the
debug-lfs-store command to simplify testing.
Introduce a LargeFileRepository interface to enable additional storage
implementation while reusing the same protocol implementation.
At the client side we have to configure the lfs.url, specify that
we use the batch API and we don't use authentication:
the git-lfs client appends the "objects/batch" to the lfs.url.
Hard code an Authorization header in the FileLfsRepository.getAction
because then git-lfs client will skip asking for credentials. It will
just forward the Authorization header from the response to the
download/upload request.
The FileLfsServlet supports file content storage for "Large File
Storage" (LFS) server as defined by the Github LFS API [2].
- upload and download of large files is probably network bound hence use
an asynchronous servlet for good scalability
- simple object storage in file system with 2 level fan-out
- use LockFile to protect writing large objects against multiple
concurrent uploads of the same object
- to prevent corrupt uploads the uploaded file is rejected if its hash
doesn't match id given in URL
The debug-lfs-store command is used to run the LfsProtocolServlet and,
optionally, the FileLfsServlet which makes it easier to setup a
local test server.
Matthias Sohn [Fri, 17 Jul 2015 14:22:56 +0000 (16:22 +0200)]
Implement SHA-256 abstraction
The Large File Storage extension specified by GitHub [1] uses SHA-256 to
compute the ID of large files stored by the extension. Hence implement a
SHA-256 abstraction similar to the SHA-1 abstraction used by JGit.
[1] https://git-lfs.github.com/
Bug: 470333
Change-Id: I3a95954543c8570d73929e55f4a884b55dbf1b7a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Hugo Arès [Thu, 4 Feb 2016 13:55:20 +0000 (08:55 -0500)]
Fix diff for added and removed submodule
Since If13f7b406, submodule difference are shown as a hunk. The issue
was that added and removed submodule were considered as Edit.REPLACE
instead of Edit.INSERT and Edit.DELETE in the DiffFormatter result.
Change-Id: I4330c2aa3f10e29d7d6b0b2e5286e59293a06239 Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
Matthias Sohn [Wed, 3 Feb 2016 09:30:38 +0000 (10:30 +0100)]
Merge branch 'stable-4.2'
* stable-4.2:
DirCacheCheckoutTest: Open Git and TreeWalk in try-with-resource
CommitCommand: Remove declaration of unthrown exception
Branch: Fix variable hiding warning
ApplyCommandTest: Open Git in try-with-resource
PackFileTest: Open ObjectInserter.Formatter in try-with-resource
Change-Id: I8484b10fad5a4c35fcfaedc1cdf8ccf97471618e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* stable-4.2:
FileTreeIteratorTest: Open Git and RevWalk in try-with-resource
RebaseCommandTest: Open RevWalk in try-with-resource
PullCommandTest: Open RevWalk in try-with-resource
BlameGeneratorTest: Create Git instances in try-with-resource
Remove unnecessary suppression of deprecation warnings in tests
DiffEntryTest: Open Git and TreeWalk in try-with-resource
DiffCommandTest: Open Git and RevWalk in try-with-resource
CommitCommandTest: Open Git and TreeWalk in try-with-resource
Change-Id: Ic886ec9b1a4b3b46f9fa14188b4df832ce36cfa6 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>