summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test/tst
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate Constants.CHARSET in favor of StandardCharsets.UTF_8David Pursehouse2018-09-041-3/+3
| | | | | Change-Id: I3b748620f067582afef20f144feebe40d0332be2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Add ls-files CLI commandMatthias Sohn2018-08-281-0/+96
| | | | | | Implement the basic functionality and support the option --help (-h). Change-Id: Ibcdf0c958d0f93b7415d4e591b1455ccba5d95f7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* refactor: simplify collection.toArray()Michael Keppler2018-08-231-6/+6
| | | | | | | | | | | On recent VMs, collection.toArray(new T[0]) is faster than collection.toArray(new T[collection.size()]). Since it is also more readable, it should now be the preferred way of collection to array conversion. https://shipilev.net/blog/2016/arrays-wisdom-ancients/ Change-Id: I80388532fb4b2b0663ee1fe8baa94f5df55c8442 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
* Repository: Deprecate getTags methodDavid Pursehouse2018-05-221-7/+4
| | | | | | | | | | Callers should use getRefDatabase().getRefsByPrefix(R_TAGS) instead. Adjust the tests accordingly. Bug: 534731 Change-Id: Ib28ae365e42720268996ff46e34cae1745ad545c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-151-1/+1
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Use Constants.CHARACTER_ENCODING in testsDavid Pursehouse2018-04-111-1/+2
| | | | | Change-Id: Iba9fc991aee54fcb8b0dc5e5841da24c2d54dfc2 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Implement --force option in FetchCommand and CLI fetch commandMatthias Sohn2018-03-131-0/+13
| | | | Change-Id: I42cdb57b8fb54ce466d1958391f12f911045327f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Consistently use Constants.CHARSET rather than StandardCharsets.UTF_8David Pursehouse2018-03-111-3/+3
| | | | | Change-Id: I6714fc3666e1bced22abba94ceb700477349586e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Use StandardCharsets.UTF_8 in testsDavid Pursehouse2018-03-071-2/+3
| | | | | | | Replace hard-coded "UTF-8" string with the constant. Change-Id: Ie812add2df28e984090563ec7c6e2c0366616424 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* ArchiveTest: Open auto-closeable resources in try-with-resourceDavid Pursehouse2018-03-051-43/+36
| | | | | Change-Id: If11017f21027b46c7a66e52e4bc0cc73f4fbdc07 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix remaining javadoc errors raised by doclintMatthias Sohn2017-12-211-2/+4
| | | | | | | For now ignore doclint "missing" warnings. Change-Id: I0e5af7a757f4d92ffeeb113f30576a35414d6781 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* ArchiveTest: Check result of BufferedInputStream#skipDavid Pursehouse2017-12-071-1/+5
| | | | | Change-Id: I5168c75ca2dda6d1e8c8a6c29043ac781fe9295a Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Checkout now reports failures through exceptions.Ned Twigg2017-10-011-3/+21
| | | | | | | | | | | Checkout sometimes throws an exception, and other times it writes an error message to outw and returns normally, even though the command failed. This commit now reports all failures through a die() exception. Change-Id: I038a5d976d95020fea3faac68e9178f923c25b28 Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
* Added API to TextBuiltin for piped usage.Ned Twigg2017-09-211-0/+110
| | | | | | | | | | Added a public method to TextBuiltin which makes it possible for clients to initialize all of its state, including output and error streams. This gives clients the ability to customize the way in which a command is run. Change-Id: If718236964d2c5cf869e120c74f1a12965f4812e Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
* Update args4j to 2.33Matthias Sohn2017-08-302-2/+2
| | | | | | | CQ: 11068 Change-Id: I7d52cddacff05477f646fda5f7b9f2de844922f6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix compilation errors with args4j 2.0.23 and laterRobin Stocker2017-08-301-0/+80
| | | | | | | | | | The multiValued attribute on @Option was removed. When the field is a List, it's not actually needed (even with earlier versions of args4j), see RmTest. In other cases, we have a custom handler, where it's also not needed. Bug: 413163 Change-Id: I4bb951e9fab5f4ae4271bd7e11be799dc234ab80
* Add missing newlines at ends of Java filesDavid Pursehouse2017-07-251-1/+1
| | | | | Change-Id: Iead36f53d57ead0eb3edd3f9efb63b6630c9c20c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Add --match option for `jgit describe` to CLIOliver Lockwood2017-06-221-3/+49
| | | | | | | | | This adds --match option for glob(7) matchers on git tags to jgit describe in CLI. Bug: 518377 Change-Id: I745988d565dd4391e8b3e5a91bbfbae575333819 Signed-off-by: Oliver Lockwood <oliver.lockwood@cantab.net>
* ArchiveCommand: Create prefix entry with commit timeYasuhiro Takagi2017-06-051-4/+4
| | | | | | | | | | | | | | | The cgit archive command creates a prefix (root) directory entry in the archive file. That entry's time is set to the commit time. This patch makes jgit's behavior consistent with with cgit: prefix: hoge/ -> creates prefix directory "hoge/" entry. prefix: hoge//// -> creates prefix directory "hoge/" entry. prefix: hoge/foo -> does not create prefix directory entry, but for each file/directory entry, prefix is added. Change-Id: I2610e40ce37972c5f7456fdca6337e7fb07176e5 Signed-off-by: Yasuhiro Takagi <ytakagi@bea.hi-ho.ne.jp>
* Run auto GC in the backgroundDavid Turner2017-06-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When running an automatic GC on a FileRepository, when the caller passes a NullProgressMonitor, run the GC in a background thread. Use a thread pool of size 1 to limit the number of background threads spawned for background gc in the same application. In the next minor release we can make the thread pool configurable. In some cases, the auto GC limit is lower than the true number of unreachable loose objects, so auto GC will run after every (e.g) fetch operation. This leads to the appearance of poor fetch performance. Since these GCs will never make progress (until either the objects become referenced, or the two week timeout expires), blocking on them simply reduces throughput. In the event that an auto GC would make progress, it's still OK if it runs in the background. The progress will still happen. This matches the behavior of regular git. Git (and now jgit) uses the lock file for gc.log to prevent simultaneous runs of background gc. Further, it writes errors to gc.log, and won't run background gc if that file is present and recent. If gc.log is too old (according to the config gc.logexpiry), it will be ignored. Change-Id: I3870cadb4a0a6763feff252e6eaef99f4aa8d0df Signed-off-by: David Turner <dturner@twosigma.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-202-7/+7
| | | | | | | | | | Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Enable and fix 'Should be tagged with @Override' warningDavid Pursehouse2017-02-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Set missingOverrideAnnotation=warning in Eclipse compiler preferences which enables the warning: The method <method> of type <type> should be tagged with @Override since it actually overrides a superclass method Justification for this warning is described in: http://stackoverflow.com/a/94411/381622 Enabling this causes in excess of 1000 warnings across the entire code-base. They are very easy to fix automatically with Eclipse's "Quick Fix" tool. Fix all of them except 2 which cause compilation failure when the project is built with mvn; add TODO comments on those for further investigation. Change-Id: I5772061041fd361fe93137fd8b0ad356e748a29c Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Organize importsDavid Pursehouse2016-11-142-5/+9
| | | | | Change-Id: I7c545d06b1bced678c020fab9af1382bc4416b6e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Preserve backslashes within double quotes in CLIGitCommand::split()Rüdiger Herrmann2016-10-231-0/+2
| | | | Change-Id: Ia6a56512baa6a0f27e2eef1b19ebb60291ba377f Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
* Checkout: Add the ability to checkout all paths.Ned Twigg2016-10-221-1/+24
| | | | | | Change-Id: Ie1e59c566b63d0dfac231e44e7ebd7f3f08f3e9f Signed-off-by: Ned Twigg <ned.twigg@diffplug.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* ArchiveTest: Don't use string concatenation in loopDavid Pursehouse2016-10-191-12/+12
| | | | | | | | | | | | | | According to FindBugs: In each iteration, the String is converted to a StringBuffer/ StringBuilder, appended to, and converted back to a String. This can lead to a cost quadratic in the number of iterations, as the growing string is recopied in each iteration. Replace string concatenation with StringBuffer. Change-Id: I60e09f274bed6722f4e0e4d096b0f2b1b31ec1b4 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Fix JGit CLI to follow native git's interpretation of http_proxy...Christian Halstrick2016-10-141-0/+232
| | | | | | | | | | | | | | | | | Native git (as many other tools) interprets the environment variables http_proxy, HTTP_PROXY, ... in a specific way. "http_proxy" has to be lowercase while "https_proxy" can be lowercase or uppercase (means: "HTTPS_PROXY"). Lowercase has precedence. This can be looked up in "ENVIRONMENT" section of [1]. Teach JGit CLI to behave similar. Additionally teach JGit not to interpret the environment variables if the java process was explicitly started with the system properties telling JVM which proxy to use. A call like "http_proxy=proxy1 java -Dhttp.proxyHost=proxy2 ..." should use proxy2 as proxy. [1] https://curl.haxx.se/docs/manpage.html Change-Id: I2ad78f209792bf8f1285cf2f8ada8ae0c28f8e5a
* CLI: implement option -d for deleting tagsNed Twigg2016-08-311-0/+23
| | | | | Change-Id: I438456b76aefd361384729686271288186d3be3b Signed-off-by: Ned Twigg <ned.twigg@diffplug.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Added a clean command.Ned Twigg2016-08-301-0/+136
| | | | | Change-Id: I05d5392789b5b64e6ee44f678556cf25dc30d7ba Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
* Fix DirCacheCheckout to return CheckoutConflictExceptionChristian Halstrick2016-06-231-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem occurs when the checkout wants to create a file 'd/f' but the workingtree contains a dirty file 'd'. In order to create d/f the file 'd' would have to be deleted and since the file is dirty that content would be lost. This should lead to a CheckoutConflictException for d/f when failOnConflict was set to true. This fix also changes jgit checkout semantics to be more like native gits checkout semantics. If during a checkout jgit wants to delete a folder but finds that the working tree contains a dirty file at this path then JGit will now throw an exception instead of silently keeping the dirty file. Like in this example: git init touch b git add b git commit -m addB mkdir a touch a/c git add a/c git commit -m addAC rm -fr a touch a git checkout HEAD~ Change-Id: I9089123179e09dd565285d50b0caa308d290cccd Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de> Also-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
* Add missing @Test annotationsHugo Arès2016-06-011-0/+1
| | | | | Change-Id: Ie5ffcbf18233dc9b3eb232f714b5b58b6b93f4e0 Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
* JGit CLI: allow to call git init with specific directoryRüdiger Herrmann2016-05-221-0/+90
| | | | | | | | With this change it is possible to initialize repositories with 'git init /path/to/new/repo' Change-Id: Ia9b288b4fb34887e8f5e2f3f270e521c44d41b6a Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* ReflogTest: Open Git instances in try-with-resourceDavid Pursehouse2016-02-121-13/+16
| | | | | Change-Id: I950b6f16148cfe11de729b04904f88d6e4c28b9a Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* RepoTest: Open Git in try-with-resourcesDavid Pursehouse2016-02-051-16/+20
| | | | | | | | Allocate a new Git for each part of the test, rather than reassigning to the same variable. Change-Id: Ic83778bbff0b2f57d37b95aef70324859d42cd58 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Merge branch 'master' into stable-4.2Matthias Sohn2016-01-2111-84/+484
|\ | | | | | | Change-Id: Ieec4f51aedadf5734ae0e3f4e8713248a3c4fc52 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge branch 'stable-4.2'David Pursehouse2016-01-202-292/+317
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * | Make sure CLIGitCommand and Main produce (almost) same resultsAndrey Loskutov2016-01-061-41/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-061-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-062-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-021-8/+176
| | | | | | | | | | | | | | | | | | | | | Added tests for all options, fixed multi-valued options parsing. Bug: 484951 Change-Id: I5558589049544ea6c84932bc01f1f9df09e1f682 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | Simplify pgm tests: allow varargs and trim output for toString()Andrey Loskutov2016-01-021-20/+19
| | | | | | | | | | | | | | | Change-Id: Ia5bcd9e560b90cf872fef75c2800c889ef1cc85a Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | Fixed few locale dependent pgm testsAndrey Loskutov2016-01-022-5/+14
| | | | | | | | | | | | | | | | | | See https://dev.eclipse.org/mhonarc/lists/jgit-dev/msg03040.html Change-Id: If51f3c750684d82cb6443f1578636c9f5ca56e2b Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | Make sure tests don't blindly continue if a command is "silently" failedAndrey Loskutov2015-12-319-24/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the default execute() function fail fast on first command printed "fatal: " to output. Introduced executeUnchecked() for few tests which wanted to test fatal output. Change-Id: I5b09aad9443515636811fc4d00bf8b8b9587a626 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | Sort "eager" path-like options to the end of the helpAndrey Loskutov2015-12-292-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | commit command: allow to specify path(s) argument(s)Andrey Loskutov2015-12-291-0/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the command below: jgit commit a -m "added file a" which currently fails with: org.eclipse.jgit.api.errors.JGitInternalException: The combination of arguments --all and --only is not allowed Bug: 484973 Change-Id: I37a4ccd68101a66520ef99110f7aa0cbdcc8beba Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | repo command: properly name the required 'path' argumentAndrey Loskutov2015-12-291-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Un-ignored existing CLI tests which run just fine on Java 7+Andrey Loskutov2015-12-292-13/+2
| | | | | | | | | | | | | | | Change-Id: I5ef334a49fb2d88d5e856b443687f3dcb126a77a Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
| * | Don't treat command termination due '-h' option as a fatal errorAndrey Loskutov2015-12-291-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * | Allow checkout paths without specifying branch nameAndrey Loskutov2015-12-281-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>