aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm.test/tst/org
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | | ConfigTest: Create Git instance in try-with-resourceDavid Pursehouse2016-01-211-1/+3
| |/ |/| | | | | | | Change-Id: Ie65c69e0f1aed95bcdf68ebd68d21b3e2590b41c Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | CheckoutTest: Create Git instances in try-with-resourceDavid Pursehouse2016-01-191-285/+306
| | | | | | | | | | Change-Id: I49a03f7bee0b61c062ce160674f9aa0cd1bcc8ba Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* | BranchTest: Create Git instances in try-with-resourceDavid Pursehouse2016-01-191-8/+12
|/ | | | | Change-Id: I8becee479fab91a18e6daffd6f4fd57338c9d120 Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
* Add remote command to JGit CLIKaloyan Raev2015-12-111-0/+159
| | | | | | | | | | | | | | | | | | 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>
* Repository: Introduce exactRef and findRef, deprecate getRefJonathan Nieder2015-11-253-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The Repository class provides only one method to look up a ref by name, getRef. If I request refs/heads/master and that ref does not exist, getRef will look further in the search path: ref/refs/heads/master refs/heads/refs/heads/master refs/remotes/refs/heads/master This behavior is counterintuitive, needlessly inexpensive, and usually not what the caller expects. Allow callers to specify whether to use the search path by providing two separate methods: - exactRef, which looks up a ref when its exact name is known - findRef, which looks for a ref along the search path For backward compatibility, keep getRef as a deprecated synonym for findRef. This change introduces findRef and exactRef but does not update callers outside tests to use them yet. Change-Id: I35375d942baeb3ded15520388f8ebb9c0cc86f8c Signed-off-by: Jonathan Nieder <jrn@google.com>
* reset command should support the -- <paths> parametersKaloyan Raev2015-10-292-9/+133
| | | | | | Bug: 480750 Change-Id: Ia85b1aead03dcf2fcb50ce0391b656f7c60a08d4 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com>
* Fix integer boxing eclipse warningHugo Arès2015-09-161-19/+18
| | | | | | | | There was this warning because private assertEquals(Object, Object) method was shadowing JUnit assertEquals methods. Change-Id: I889bfe1d8c48210d9a42147a523c4829c5b5d1e3 Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
* archive: Drop unnecessary empty comments and 'final' qualifiers on localsJonathan Nieder2015-05-271-75/+75
| | | | | | | | | | | | | | | Early JGit code used comments to inform the Eclipse formatter about where to break lines and used final in the hope of making code faster. The ArchiveCommand command implementation imitated that style. Nowadays the project relies less on the Eclipse formatter and relies more on Java having sane performance with local variables that are not explicitly marked 'final'. Removing the unnecessary empty comments and 'final' qualifiers makes this code more readable and more consistent with recent JGit code. Change-Id: I7a181432eda7e18bd32cf110d89c0efbe490c4f1 Signed-off-by: Jonathan Nieder <jrn@google.com>
* CLI status should support --untracked-filesKaloyan Raev2015-03-121-206/+428
| | | | | | | | | | | | | | | | | | A special options handler is added to properly handle the short -u alias of the option. The "normal" mode is not supported by this patch, because this mode of listing untracked files is not supported by the org.eclipse.jgit.lib.IndexDiff class. This mode is not necessary for my use case. It can be added later if anyone really needs it. The StatusTest is updated to cover all possible combinations of the --porcelain and --untracked-files options. Bug: 459319 Change-Id: I305ac95739cfed0c16735e0987844e57fa27e236 Signed-off-by: Kaloyan Raev <kaloyan.r@zend.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add "--long" option to JGit describeChristian Halstrick2015-03-091-0/+7
| | | | | | | | | | | Native git supports "git describe --long". This will enforce returning a long description of a commit even if a tag is directly pointing to the commit (in contrast to just returning the tag name as it is now). This commit teaches JGits DescribeCommand and the describe command in the pgm package to support "--long". Bug: 460991 Change-Id: I65e179b79e89049c6deced3c71cb3ebb08ed0a8f Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Add option --orphan for checkoutRüdiger Herrmann2015-02-041-0/+12
| | | | | Change-Id: I546a93f3e147d8d6fc70094b22679c0d11cd8921 Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
* [pgm] Add option --bare to clone commandMatthias Sohn2014-12-221-0/+20
| | | | Change-Id: I528491e3e20d3c9ebe37fe3cd2bf85b4644d8698 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* [pgm] Implement clone using CloneCommandMatthias Sohn2014-12-221-0/+136
| | | | Change-Id: I56699b7bf9a71f673cb308d3015f51de5b06c1d9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* [pgm] Add option --tags for ls-remoteMatthias Sohn2014-12-161-0/+31
| | | | | Bug: 444072 Change-Id: I52b470924609fc201e078d9d232aad257506728d Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* [pgm] Add option --heads for ls-remoteMatthias Sohn2014-12-161-0/+11
| | | | | | | | TODO: find a way to use option -h which is already captured by TextBuiltin's option --help which also uses the alias -h. Bug: 444072 Change-Id: Ie66584c2fc7fc224014a43cf928547703dd9d213 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* [pgm] Use LsRemoteCommand to implement ls-remote and add a testMatthias Sohn2014-12-151-0/+96
| | | | Change-Id: Ic266f844c23e2519df5770ca56284b26e4cfe1f4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Handle -m option for Merge commandAxel Richard2014-08-301-1/+24
| | | | | | | | | Set the commit message to be used for the merge commit (in case one is created) Bug: 442886 Change-Id: Ie5ecc13822faa366f00b3daa07f74c8441cae195 Signed-off-by: Axel Richard <axel.richard@obeo.fr> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Strip trailing /s in repo base URI.Yuxuan 'fishy' Wang2014-07-281-1/+1
| | | | | Change-Id: I71040db2cca69638cfad89acdc9179ee80592b27 Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
* Don't prefix output from jgit status with '# 'Robin Rosenberg2014-07-191-75/+75
| | | | | | C Git does not do it anymore Bug: 439937 Change-Id: I20bdb787a00bba3e4adf269fd64ec6296bdc2a66
* Fix a number of failing conflict situationsRobin Rosenberg2014-05-171-0/+360
| | | | | | | | | | | | | Adds further tests where the working tree is dirty (differs from index) and where we have staged but uncommitted changes. Fixed the test case 9 for file/directory conflicts. Bug: 428819 Change-Id: Ie44a288b052abe936ebb74272d0fefef3b218a7a Signed-off-by: Axel Richard <axel.richard@obeo.fr> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Fix failing ConfigTest on WindowsRobin Rosenberg2014-05-171-23/+7
| | | | | | Trust the detection of features and just test CoreConfig. Change-Id: I37f838d270a221a75d0d3842ba2f3f90aa1d6f01
* Command line: implement checkout -- <path>Matthias Sohn2014-05-121-0/+24
| | | | Change-Id: I3d261e6541fe0fcaa210587d2aa226e153071351 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* cleanup: remove some unused importsRobin Rosenberg2014-04-251-4/+0
| | | | Change-Id: I549b934b86753acc362364c8986bfe6457affd12
* Added groups support to repo subcommand.Yuxuan 'fishy' Wang2014-04-231-13/+83
| | | | | Change-Id: Id0e7663b6ac4f6938fdcacaf2158107b6285fc25 Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
* Added the command line of jgit repo.Yuxuan 'fishy' Wang2014-04-231-0/+96
| | | | | Change-Id: Ib809b00c236a9c44422a872ae801b060f5b26808 Signed-off-by: Yuxuan 'fishy' Wang <fishywang@google.com>
* Implement "git branch --contains" in pgmRobin Stocker2014-03-071-1/+24
| | | | | | Bug: 425678 Change-Id: Ib59e05a0bde58562cc61e6e3000df761660b468e Signed-off-by: Robin Stocker <robin@nibor.org>
* Don't raise checkout conflict for file missing in working treeChristian Halstrick2014-02-261-0/+50
| | | | | | | | | | | During a checkout we want to prevent to overwrite unsaved local file content. Jgit was therefore checking whether the file to overwrite is dirty or missing and would raise a conflict if this was the case. That was wrong. It should only check if the file is dirty. It's ok to "overwrite" a missing/non-existing file. Change-Id: I63c3a94f663c87f09170fdf8b1b1bf4ed5246fc5 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Add symlink support to JGitRobin Rosenberg2014-02-101-0/+22
| | | | | | | | | | | | | | | | | | | | The change includes comparing symbolic links between disk and index, adding symbolic links to the index, creating/modifying links on checkout. The behavior is controlled by the core.symlinks setting, just as C Git does. When a new repository is created core.symlinks will be set depending on the capabilities of the operating system and Java runtime. If core.symlinks is set to true, the assumption is that symlinks are supported, which may result in runtime errors if this turns out not to be the case. Measuring the cost of jgit status on a repository with ~70000 files, of which ~30000 are tracked reveals a penalty of about 10% for using the Java7 (really NIO2) support module. Bug: 354367 Change-Id: I12f0fdd9d26212324a586896ef7eb1f6ff89c39c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Remove unused import from ArchiveTestMatthias Sohn2014-01-071-1/+0
| | | | | | This unnecessary import was introduced by 2ecc27d. Change-Id: I5cb415de7e33428d9f95dfbe1e214ef24be9dad9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>