summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test/src
Commit message (Collapse)AuthorAgeFilesLines
* 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>