summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix RebuildRefTree trying to add HEAD twice to RefTreeMatthias Sohn2016-03-051-1/+1
| | | | | | | | | | | | | | | | | | | 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>
* Fix help text for option --enable of command debug-rebuild-ref-treeMatthias Sohn2016-03-011-1/+1
| | | | | | | 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>
* Support Amazon S3 based storage for LFSMatthias Sohn2016-02-172-8/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge branch 'stable-4.2'Matthias Sohn2016-02-152-13/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * Don't use deprecated LockFile constructorDavid Pursehouse2016-02-151-2/+2
| | | | | | | | | | Change-Id: Ibc3e2f3372e1a65732dd6d3c71cec53fb1aa15e2 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
| * DiffAlgorithms: Fix warnings about variable hidingDavid Pursehouse2016-02-151-11/+12
| | | | | | | | | | | | | | | | 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>
* | Merge branch 'stable-4.2'Matthias Sohn2016-02-101-7/+7
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * TextHashFunctions: Fix warnings about variable hidingDavid Pursehouse2016-02-051-7/+7
| | | | | | | | | | | | | | | | The local variables/arguments named 'db' were hiding the member variable of the same name in the superclass TextBuiltin. Change-Id: Ic49dcb7cc2a1b3fb46ad78450042c8c8fb464a80 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | Support LFS protocol and a file system based LFS storageMatthias Sohn2016-02-041-0/+249
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: [lfs] url = http://host:port/lfs batch = true [lfs "http://host:port/lfs"] access = none 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. [1] https://github.com/github/git-lfs/blob/master/docs/api/http-v1-batch.md [2] https://github.com/github/git-lfs/tree/master/docs/api Bug: 472961 Change-Id: I7378da5575159d2195138d799704880c5c82d5f3 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* | Merge branch 'stable-4.2'Matthias Sohn2016-02-031-8/+8
|\| | | | | | | | | | | | | | | | | | | | | | | * 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>
| * Branch: Fix variable hiding warningDavid Pursehouse2016-02-021-8/+8
| | | | | | | | | | | | | | | | The Branch class has a member named 'branch', which was being hidden by the local variable of the same name used in a for-loop. Change-Id: I334092010a9c80686fb79713852d4bfa166ce12f Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | Merge changes from topic 'reftree'Shawn Pearce2016-01-211-4/+27
|\ \ | | | | | | | | | | | | | | | | | | | | | * changes: debug-rebuild-ref-tree: Copy HEAD into RefTree debug-rebuild-ref-tree: Add --enable flag to turn the database on RefTreeDatabase: Allow ORIG_HEAD, etc. on non-bare repositories RefTreeDatabase: Expose bootstrap refs in getAdditionalRefs
| * | debug-rebuild-ref-tree: Copy HEAD into RefTreeShawn Pearce2016-01-151-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HEAD is not part of getRefs(ALL) and must be copied explicitly. This allows `jgit debug-rebuild-ref-tree --enable` to convert an existing repository to use RefTree with a local working tree: mkdir testRepo cd testRepo jgit init jgit debug-rebuild-ref-tree --enable touch a jgit add a jgit commit -m initial Change-Id: I46cbc2611b9ae683ef7319dc46af277925dfaee5
| * | debug-rebuild-ref-tree: Add --enable flag to turn the database onShawn Pearce2016-01-151-0/+14
| | | | | | | | | | | | Change-Id: Iad8ebdb0c4c0ad6dcd2b12dd56ffe1be6a20840f
* | | daemon: Add --ketch=LEADER flagShawn Pearce2016-01-191-1/+46
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Experimental flag to turn on the KetchLeader within this daemon JVM. This is a manually elected leader process, set from the command line. Remote followers for each repository are configured per-repository using remote sections with ketch-type = FULL. For example: Manually elected leader's $GIT_DIR/config: [ketch] name = A [remote "A"] ketch-type = FULL [remote "B"] url = git://127.0.0.1:9421/sample.git ketch-type = FULL [remote "C"] url = git://127.0.0.1:9422/sample.git ketch-type = FULL Replica B and C daemons: git daemon \ --export-all \ --enable=receive-pack \ --listen=127.0.0.1 --port=9421 \ --base-path=$HOME/ketch_test/follower_one \ $HOME/ketch_test/follower_one & git daemon \ --export-all \ --enable=receive-pack \ --listen=127.0.0.1 --port=9422 \ --base-path=$HOME/ketch_test/follower_two \ $HOME/ketch_test/follower_two & Change-Id: I165f85970a77e16b5263115290d685d8a00566f5
* | Merge branch 'stable-4.2'David Pursehouse2016-01-2015-63/+70
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.2: CheckoutCommandTest: Create Git instances in try-with-resource BranchCommandTest: Create Git instances in try-with-resource CheckoutTest: Create Git instances in try-with-resource BranchTest: Create Git instances in try-with-resource URIishTest: Use @Test annotation's `expected` argument Suppress "The allocated object is never used" warning in tests Add $NON-NLS to suppress "Non-externalized string literal" warnings Don't use deprecated constructors of CmdLineException Prepare 4.2.0-SNAPSHOT builds Remove org.eclipse.jgit.updatesite project from tools/version.sh RevParse: Remove superfluous semicolon RefUpdateTest: Use try-with-resource for auto-closable types RefUpdateTest: Add null check to prevent potential NPE CommitCommand: Remove redundant null check JGit v4.2.0.201512141825-rc1 Change-Id: I2179859289b2f2e3d0b7c6d02ef7e7890c467f7b Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
| * Add $NON-NLS to suppress "Non-externalized string literal" warningsDavid Pursehouse2016-01-199-40/+40
| | | | | | | | | | Change-Id: I3e6f83ad2bc7d493e2c1ab5a8c60affa2b49c386 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
| * Don't use deprecated constructors of CmdLineExceptionDavid Pursehouse2016-01-196-22/+29
| | | | | | | | | | Change-Id: If01fa896537209821d6a7a262ee978572195a397 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
| * RevParse: Remove superfluous semicolonDavid Pursehouse2016-01-141-1/+1
| | | | | | | | | | Change-Id: I5975bc58d7933dafb3e7a8d891e9f6878b98a9a1 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | FileRepository: Support extensions.refsBackendType = RefTreeShawn Pearce2016-01-111-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This experimental code can be enabled in $GIT_DIR/config: [core] repositoryformatversion = 1 [extensions] refsBackendType = RefTree When these are set the repository will read references from the RefTree rooted by the $GIT_DIR/refs/txn/committed reference. Update debug-rebuild-ref-tree to rebuild refs/txn/committed only from the bootstrap layer. This avoids misuse by rebuilding using packed-refs and $GIT_DIR/refs tree. Change-Id: Icf600e4a36b2f7867822a7ab1f1617d73c710a4b
* | Merge changes from topic 'reftree'Shawn Pearce2016-01-071-0/+130
|\ \ | | | | | | | | | | | | | | | * changes: debug-rebuild-ref-tree: Simple program to build a RefTree RefTree: Store references in a Git tree
| * | debug-rebuild-ref-tree: Simple program to build a RefTreeShawn Pearce2016-01-071-0/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tool scans all references in the repository and writes out a new reference pointing to a single commit whose root tree is a RefTree containing the current refs of this repository. It alway skips storing the reference it will write to, avoiding the obvious cycle. Change-Id: I20b1eeb81c55dc49dd600eac3bf8f90297394113
* | | Make sure CLIGitCommand and Main produce (almost) same resultsAndrey Loskutov2016-01-061-35/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently execution of tests in pgm uses CLIGitCommand which re-implements few things from Main. Unfortunately this can results in a different test behavior compared to the real CLI runtime. The change let CLIGitCommand extend Main and only slightly modifies the runtime (stream redirection and undesired exit() termination). Change-Id: I87b7b61d1c84a89e5917610d84409f01be90b70b Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | | branch command: print help if requested, even if arguments are wrongAndrey Loskutov2016-01-062-4/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git branch -d -h reports an error (because of missing -d option value) but does not print the help as expected. To fix this, CmdLineParser must catch, print but do not propagate exceptions if help is requested. Bug: 484951 Change-Id: I51265ebe295f22da540792c6a1980b8bdb295a02 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | | Added CLIText.fatalError(String) API for testsAndrey Loskutov2016-01-063-5/+18
|/ / | | | | | | | | | | | | | | | | | | In different places (Main, TextBuiltin, CLIGitCommand) we report fatal errors and at same time want to check for fatal errors in the tests. Using common API simplifies the error testing and helps to navigate to the actual error check implementation. Change-Id: Iecde79beb33ea595171f168f46b0b10ab2f339bb Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | branch command: provide convenient and meaningful options helpAndrey Loskutov2016-01-024-36/+149
| | | | | | | | | | | | | | Added tests for all options, fixed multi-valued options parsing. Bug: 484951 Change-Id: I5558589049544ea6c84932bc01f1f9df09e1f682 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | clone: display progress messagesShawn Pearce2015-12-311-5/+16
| | | | | | | | | | | | Also support -q/--quiet flag to disable progress. Change-Id: I979277502c990f6dec052d095461c996ff8fe577
* | Sort "eager" path-like options to the end of the helpAndrey Loskutov2015-12-291-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "--" path option (and all other similar options consuming all remaining arguments) should be placed at the end of the command line help. Currently jgit reset -h shows this: jgit reset [commit-ish] [path ... ...] [-- path ... ...] [--hard] [--help (-h)] [--mixed] [--soft] After the patch the help shows this: jgit reset [commit-ish] [path ... ...] [--hard] [--help (-h)] [--mixed] [--soft] [-- path ... ...] Bug: 484951 Change-Id: I3db332bf293ca8d6bfaab0d546cd35af689bd46e Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | reset command: provide convenient and meaningful options helpAndrey Loskutov2015-12-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the jgit "reset" command line options help from this: jgit reset name [VAL ...] [-- path ... ...] [--hard] [--help (-h)] [--mixed] [--soft] name : Reset current HEAD to the specified state [...] to this: jgit reset [commit-ish] [path ... ...] [-- path ... ...] [--hard] [--help (-h)] [--mixed] [--soft] commit-ish : Reset to given reference name [...] Bug: 484951 Change-Id: I614e71101b4f9f46ef8f02379d1a9d135f3292d2 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | status command: consume more then one argument after --Andrey Loskutov2015-12-291-2/+4
| | | | | | | | | | | | | | | | | | See bug 484951 comment 4: "jgit status -- a b" doesn't work and complains that "b" is not an allowed argument Bug: 484951 Change-Id: I86b81e7f2bab6e928bb8e973bd50c8f4b9c6fecf Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | repo command: properly name the required 'path' argumentAndrey Loskutov2015-12-291-1/+1
| | | | | | | | | | | | | | | | | | Fixes point 4 in bug 484951, where "jgit repo" or "jgit repo -h" dumps a stack trace. Bug: 484951 Change-Id: Ic8b362e07a40ad923dc9acde0c0983a1e7932a02 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | Don't treat command termination due '-h' option as a fatal errorAndrey Loskutov2015-12-294-18/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signal early command termination due '-h' or '--help' option via TerminatedByHelpException. This allows tests using CLIGitCommand differentiate between unexpected command parsing errors and expected command cancellation "on help" (which also allows validation of expected/unexpected help messages). Additional side-effect: jgit supports now git style of handling help option: any unexpected command line options before help are reported as errors, but after help ignored. Bug: 484951 Change-Id: If45c41c0d32895ab6822a7ff9d851877dcef5771 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | Provide a root cause for aborted commandsAndrey Loskutov2015-12-292-1/+29
| | | | | | | | Change-Id: Iafaa03dbacbe7f1b2b074d3294db988b08fdb0d7 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | Allow checkout paths without specifying branch nameAndrey Loskutov2015-12-281-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit CLI should allow to do this: checkout -- <path> Currently, even if "a" is a valid path in the git repo, jgit CLI can't checkout it: $jgit checkout -- a error: pathspec 'a' did not match any file(s) known to git. The fix also fixes at same time "unnamed" zombie "[VAL ...]" argument shown on the command line. Before fix: $jgit -h jgit checkout name [VAL ...] [-- path ... ...] [--force (-f)] [--help (-h)] [--orphan] [-b] After fix: $jgit -h jgit checkout [name] [-- path ... ...] [--force (-f)] [--help (-h)] [--orphan] [-b] Bug: 475765 Change-Id: I2b0e77959a72e4aac68452dc3846adaa745b0831 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* | Fix push with jgit pgm failing with "unauthorized"Matthias Sohn2015-12-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pushing with JGit commandline to e.g. Github failed with "unauthorized" since HttpUrlConnection calls the configured authenticator implicitly. The problem is that during a push two requests are sent to the server, first a GET and then a POST (containing the pack data). The first GET request sent anonymously is rejected with 401 (unauthorized). When an Authenticator is installed the java.net classes will use the Authenticator to ask the user for credentials and retry the request. But this happens under the hood and JGit level code doesn't see that this happens. The next request is the POST but since JGit thinks the first GET request went through anonymously it doesn't add authentication headers to the POST request. This POST of course also fails with 401 but since this request contains a lot of body-data streamed from JGit (the pack file!) the java.net classes can't simply retry the request with authorization headers. The whole process fails. Fix this by using Apache httpclient which doesn't use Authenticator to retrieve credentials. Instead initialize TransportCommand to use the default credential provider if no other credentials provider was set explicitly. org.eclipse.jgit.pgm.Main sets this default for the JGit command line client. Change-Id: Ic4e0f8b60d4bd6e69d91eae0c7e1b44cdf851b00 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Null-annotated Ref class and fixed related compiler errorsAndrey Loskutov2015-12-152-4/+13
|/ | | | | | | | | This change fixes all compiler errors in JGit and replaces possible NPE's with either appropriate exceptions, avoiding multiple "Nullable return" method calls or early returning from the method. Change-Id: I24c8a600ec962d61d5f40abf73eac4203e115240 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Add remote command to JGit CLIKaloyan Raev2015-12-112-0/+198
| | | | | | | | | | | | | | | | | | Supported subcommands are: - <none> (lists available remotes) - add - remove - set-url - update Supported options are: --verbose --push --prune Bug: 481316 Change-Id: I57c34ed6daabb7d308bc383b17c1ef4af433e714 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Support atomic push in JGit clientShawn Pearce2015-12-021-0/+4
| | | | | | | | | | | | | This should mirror the behavior of `git push --atomic` where the client asks the server to apply all-or-nothing. Some JGit servers already support this based on a custom DFS backend. InMemoryRepository is extended to support atomic push for unit testing purposes. Local disk server side support inside of JGit is a more complex animal due to the excessive amount of file locking required to protect every reference as a loose reference. Change-Id: I15083fbe48447678e034afeffb4639572a32f50c
* Null-annotated Repository class and fixed related compiler errorsAndrey Loskutov2015-11-257-11/+32
| | | | | | | | | | | | | | | | | | | | | | org.eclipse.jgit.lib.Repository class is an example of the API which should be written with Java 8 java.util.Optional<T> type. Unfortunately this API is already released and widely used. The good clients are currently doing their best with checking return values for null and bad clients do not know how bad their code is. I've tried not to change any logic and to be as less intrusive as possible. Most of the JGit code was well prepared to this, only few classes needed some smaller fixes. This change fixes all compiler errors in JGit and replaces possible NPE's with either appropriate exceptions, avoiding multiple "Nullable return" method calls or early returning from the method. Because annotating getDirectory() and getFS() as Nullable would cause lot of additional changes in JGit and EGit they are postponed. Change-Id: Ie8369d2c9c5fac5ce83b3b1b9bc217d7b55502a3 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* git rev-parse: Add --verify optionThomas Meyer2015-11-192-3/+16
| | | | | | | Add the --verify option to be more compatible with git Change-Id: I225a36ecc4711fd2eb9af67ca8fb79681d94c587 Signed-off-by: Thomas Meyer <thomas.mey@web.de>
* reset command should support the -- <paths> parametersKaloyan Raev2015-10-291-11/+24
| | | | | | Bug: 480750 Change-Id: Ia85b1aead03dcf2fcb50ce0391b656f7c60a08d4 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
* Merge "RepoCommand: Add setRecordRemoteBranch option to record upstream branch"Jonathan Nieder2015-10-051-0/+4
|\
| * RepoCommand: Add setRecordRemoteBranch option to record upstream branchStefan Beller2015-10-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On a server also running Gerrit that is using RepoCommand to convert from an XML manifest to a git submodule superproject periodically, it would be handy to be able to use Gerrit's submodule subscription feature[1] to update the superproject automatically between RepoCommand runs as changes are merged in each subprojects. This requires setting the 'branch' field for each submodule so that Gerrit knows what branch to watch. Add an option to do that. Setting the branch field also is useful for plain Git users, since it allows them to use "git submodule update --remote" to manually update all submodules between RepoCommand runs. [1] https://gerrit-review.googlesource.com/Documentation/user-submodules.html Change-Id: I1a10861bcd0df3b3673fc2d481c8129b2bdac5f9 Signed-off-by: Stefan Beller <sbeller@google.com>
* | pgm: Open RevWalk and TreeWalk in try-with-resourceDavid Pursehouse2015-10-018-79/+87
| | | | | | | | | | | | | | To prevent potential resource leaks. Change-Id: I2039af04d9fb75405f8e13abf508623b7d4ef324 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | pgm: Create instances of Git in try-with-resourceDavid Pursehouse2015-10-0114-215/+235
|/ | | | | | | To prevent potential resource leak. Change-Id: I8ac4ae61193324849bafb46501a55f93c5029a4e Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Fix non-externalized string warning in Main.execute()Matthias Sohn2015-07-241-1/+1
| | | | Change-Id: Ib0404daaf485aa6c8dc6ba0b169b46fb800325e4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Honor also https_proxy environment variableChristian Halstrick2015-07-241-25/+31
| | | | | | | | | In addition to honor the http_proxy variable for setting a proxy for http JGit should also honor the https_proxy variable to set a similar proxy for https traffic Bug: 473365 Change-Id: I1002cb575e26cd842bf81ad751ec7c267b585ce2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Delete deprecated TextBuiltin.outMatthias Sohn2015-06-031-10/+0
| | | | Change-Id: I184c2f0e0203fa95e0a117391bae93da0d23a435 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Replace deprecated release() methods by close()Matthias Sohn2015-05-2112-92/+60
| | | | | | | | See the discussion [1] in the Gerrit mailing list. [1] https://groups.google.com/forum/#!topic/repo-discuss/RRQT_xCqz4o Change-Id: I2c67384309c5c2e8511a7d0d4e088b4e95f819ff Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Expose disposeBody() on RevCommit and RevTagShawn Pearce2015-05-101-0/+1
| | | | | | | | | Applications that use a commit message once and do not need it again can free the body to save memory. Expose the disposeBody() methods to support this and use it in pgm.Log which only visits each commit once. Change-Id: I4142a0749c24f15386ee7fb119934a0432234de3