summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test/src
Commit message (Collapse)AuthorAgeFilesLines
* SpotBugs: don't rely on default encodingMatthias Sohn2018-09-101-5/+8
| | | | Change-Id: Ic42f30c564270230fc629a917be85194d27d0338 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* refactor: simplify collection.toArray()Michael Keppler2018-08-231-1/+1
| | | | | | | | | | | 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>
* Remove further unnecessary 'final' keywordsHan-Wen Nienhuys2018-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove it from * package private functions. * try blocks * for loops this was done with the following python script: $ cat f.py import sys import re import os def replaceFinal(m): return m.group(1) + "(" + m.group(2).replace('final ', '') + ")" methodDecl = re.compile(r"^([\t ]*[a-zA-Z_ ]+)\(([^)]*)\)") def subst(fn): input = open(fn) os.rename(fn, fn + "~") dest = open(fn, 'w') for l in input: l = methodDecl.sub(replaceFinal, l) dest.write(l) dest.close() for root, dirs, files in os.walk(".", topdown=False): for f in files: if not f.endswith('.java'): continue full = os.path.join(root, f) print full subst(full) Change-Id: If533a75a417594fc893e7c669d2c1f0f6caeb7ca Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Remove 'final' in parameter listsHan-Wen Nienhuys2018-05-151-3/+3
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-202-3/+3
| | | | | | | | | | 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-192-0/+2
| | | | | | | | | | | | | | | | | | | | | | | 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-141-1/+0
| | | | | 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-1/+1
| | | | Change-Id: Ia6a56512baa6a0f27e2eef1b19ebb60291ba377f Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
* CLIRepositoryTestCase: Remove unused 'trash' memberDavid Pursehouse2016-10-191-4/+0
| | | | | Change-Id: I813f3de5f059e6e5cd34af20fce1e117bfe55b55 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Make sure CLIGitCommand and Main produce (almost) same resultsAndrey Loskutov2016-01-062-65/+113
| | | | | | | | | | | | 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>
* Added CLIText.fatalError(String) API for testsAndrey Loskutov2016-01-061-3/+1
| | | | | | | | | | 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>
* Simplify pgm tests: allow varargs and trim output for toString()Andrey Loskutov2016-01-021-4/+8
| | | | | Change-Id: Ia5bcd9e560b90cf872fef75c2800c889ef1cc85a Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Make sure tests don't blindly continue if a command is "silently" failedAndrey Loskutov2015-12-311-5/+46
| | | | | | | | | | | 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>
* Don't treat command termination due '-h' option as a fatal errorAndrey Loskutov2015-12-291-2/+29
| | | | | | | | | | | | | | | | 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>
* Simplify development of commands: added main() to CLIGitCommandAndrey Loskutov2015-12-282-1/+42
| | | | | | | | | | | | This will execute git commands (with arguments) specified on the command line, handy for developing/debugging a sequence of arbitrary git commands working on same repository. The git working dir path can be specified via Java system property "git_work_tree". If not specified, current directory will be used. Change-Id: I621a9ec198c31e28a383818efeb4b3f835ba1d6f Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Allow checkout paths without specifying branch nameAndrey Loskutov2015-12-281-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* reset command should support the -- <paths> parametersKaloyan Raev2015-10-291-0/+8
| | | | | | Bug: 480750 Change-Id: Ia85b1aead03dcf2fcb50ce0391b656f7c60a08d4 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
* Command line: implement checkout -- <path>Matthias Sohn2014-05-121-0/+4
| | | | Change-Id: I3d261e6541fe0fcaa210587d2aa226e153071351 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Move org.eclipse.jgit.pgm's resource bundle to internal packageMatthias Sohn2013-05-061-0/+1
| | | | | | | | Translatable texts aren't API and shouldn't require maintenance of @since tags to prevent API warnings. Change-Id: I228ff37f17c0e792a6bc188c463a0d19138e88ac Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add the no-commit option to MergeCommandTomasz Zarna2013-04-041-3/+2
| | | | | | | | | | Added also tests and the associated option for the command line Merge command. Bug: 335091 Change-Id: Ie321c572284a6f64765a81674089fc408a10d059 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* New functions to facilitate the writing of CLI test casesFrançois Rey2013-03-271-0/+90
| | | | | | | | | | | | Writing CLI test cases is tedious because of all the formatting and escaping subtleties needed when comparing actual output with what's expected. While creating a test case the two new functions are to be used instead of the existing execute() in order to prepare the correct command and expected output and to generate the corresponding test code that can be pasted into the test case function. Change-Id: Ia66dc449d3f6fb861c300fef8b56fba83a56c94c Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* JGit 3.0: move internal classes into an internal subpackageShawn Pearce2013-03-181-1/+1
| | | | | | | | This breaks all existing callers once. Applications are not supposed to build against the internal storage API unless they can accept API churn and make necessary updates as versions change. Change-Id: I2ab1327c202ef2003565e1b0770a583970e432e9
* Allow commandline tests to use raw outputJonathan Nieder2012-11-161-4/+11
| | | | | | | | | | | | | | | | | | | | | Introduce a new CLIGitCommand.rawExecute() helper that behaves just like execute() except that instead of processing its output it returns it raw. So now you can do final byte[] expect = { 0, 1, 2, 3 }; final byte[] actual = CLIGitCommand.rawExecute( "git show HEAD:goo.raw", db); assertArrayEquals(expect, actual); to test the output from "git show HEAD:goo.raw" without being distracted by encoding issues. Noticed while writing tests for a new "jgit archive" command that writes its output in ZIP format. Change-Id: I2fe6020a537975d0ccf414b7125d85d6cd86898c
* Prefix an abnormal CLI command termination with 'fatal:'Tomasz Zarna2012-11-151-1/+3
| | | | | Change-Id: I3d257666c6fbed7b238c575808f73ec518e811b9 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Check for write errors in standard out and exit with errorRobin Rosenberg2012-09-161-8/+4
| | | | | | | | | | | | | The underlying problem is that System.out is a PrintWriter and as such it does not throw exceptions on error, but rather just sets a flag and continues. This changes replaces the use of System.out with a PrintWriter-like writer that does not catch error, but instead throw them to the caller. Bug: 366243 Change-Id: I44405edc4416e943b87f09a0f6ed041c6c51b046
* Added new Status CLI command 'jgit status'Robin Rosenberg2012-09-091-0/+4
| | | | | | | | | | | | | This is a first basic implementation that displays current branch and list of files of various status, but isn't as refined as its native counterpart (e.g. does not say if we're ahead or behind the remote). It's been helpful in the diagnostic of bug #347885. Bug: 348318 CQ: 6769 Change-Id: Ifc35da608fbba652524c1b5b522e3c0d5369ad5e Signed-off-by: François Rey <eclipse.org@francois.rey.name> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* Output result of switching branch -- o.e.jgit.pgm.CheckoutTomasz Zarna2012-09-051-0/+2
| | | | Change-Id: I9829950b686ce3b8c70b8f7a1774d5e2b55cd00a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Allow to write tests with CLI syntaxTomasz Zarna2012-04-182-0/+241
| | | | | | | CQ: 6385 Bug: 365444 Change-Id: I2d5164cd92429673fe3c37e9f5f9bc565192cc12 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Revert "Allow to write tests with CLI syntax"Matthias Sohn2012-03-232-241/+0
| | | | | | | | | This reverts commit bf845c126d53f07de103e03b68ddb7f24014cee5 since this change needs to go through a formal IP review and Chris missed to file a CQ for that. Change-Id: I303515d78116f0591a2911dbfb9f857738f086a9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Allow to write tests with CLI syntaxTomasz Zarna2012-03-222-0/+241
Bug: 365444 Change-Id: I86f382913bc47665c5b9a2827b878e7dbedce7b1 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>