Commit Graph

197 Commits

Author SHA1 Message Date
Matthias Sohn 5fee071f6a Prepare 4.7.0-SNAPSHOT builds
Change-Id: I20754d13007e6591d36aae5766f3a9a82b24e120
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-12-27 01:45:50 +01:00
Matthias Sohn 3857c3168f Prepare 4.6.1-SNAPSHOT builds
Change-Id: I6b05a6f6c3f92365c272e1bdaf76093ca01f2d58
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-12-24 15:51:54 +01:00
Matthias Sohn 73a4325149 JGit v4.6.0.201612231935-r
Change-Id: Iaa88fe1b195dfe6be99a7b4cb064684e75563715
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-12-24 01:42:38 +01:00
David Pursehouse a45cfee7a3 Organize imports
Change-Id: I7c545d06b1bced678c020fab9af1382bc4416b6e
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2016-11-14 13:25:20 -08:00
Rüdiger Herrmann a5eccf4a4d Preserve backslashes within double quotes in CLIGitCommand::split()
Change-Id: Ia6a56512baa6a0f27e2eef1b19ebb60291ba377f
Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
2016-10-23 15:29:17 +09:00
Ned Twigg e49025386e Checkout: Add the ability to checkout all paths.
Change-Id: Ie1e59c566b63d0dfac231e44e7ebd7f3f08f3e9f
Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2016-10-22 10:08:07 +09:00
David Pursehouse 8f9e157cd5 ArchiveTest: Don't use string concatenation in loop
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>
2016-10-19 15:09:31 +09:00
David Pursehouse 9ed2d949bb CLIRepositoryTestCase: Remove unused 'trash' member
Change-Id: I813f3de5f059e6e5cd34af20fce1e117bfe55b55
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2016-10-19 12:51:14 +09:00
David Pursehouse e0d1cfb5ad Upgrade buck to 7b7817c48f30687781040b2b82ac9218d5c4eaa4
Upgrade to match the version used on Gerrit's master branch.

Requires a couple of modifications to make the tests work:

- Remove source_under_test parameters from java_test calls.

- Add vm_args with explicit setting of tmpdir location for http
  tests. This is needed due to upstream changes in temporary
  directory handling [1].

[1] https://github.com/facebook/buck/issues/946

Change-Id: I5d5dd5edc335d44b118e8587f69ba89b83fc7fbb
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2016-10-18 01:06:28 +02:00
Christian Halstrick 293e8beacc Fix JGit CLI to follow native git's interpretation of http_proxy...
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
2016-10-14 15:14:21 +02:00
Matthias Sohn ab79ce91c1 Change JGit minimum execution environment to JavaSE-1.8
Bug: 500059
Change-Id: I47f3f6749a67da52029f84e002d9b155ed56d2b7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-09-20 11:32:36 +02:00
Matthias Sohn 9d4ffcc1ab Prepare 4.6.0-SNAPSHOT builds
Change-Id: Id2eafc331ee32c332c2a9b867b05c260beb0d10f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-09-19 17:06:42 +02:00
Ned Twigg b67df51203 CLI: implement option -d for deleting tags
Change-Id: I438456b76aefd361384729686271288186d3be3b
Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-08-31 00:16:23 +02:00
Ned Twigg 34673f0536 Added a clean command.
Change-Id: I05d5392789b5b64e6ee44f678556cf25dc30d7ba
Signed-off-by: Ned Twigg <ned.twigg@diffplug.com>
2016-08-30 22:21:05 +02:00
David Pursehouse 4528d5f56d Ignore 'The value of exception parameter is not used' warning
Change-Id: I50407e4a33e35b718ca40503fdd436f1f9f70fba
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
2016-07-26 10:16:49 +09:00
Christian Halstrick 5fe44ed3ee Fix DirCacheCheckout to return CheckoutConflictException
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>
2016-06-23 09:34:22 +02:00
Christian Halstrick df75b9c0c1 Merge "Add missing @Test annotations" 2016-06-02 03:28:02 -04:00
Matthias Sohn 75b3301939 Prepare 4.5.0-SNAPSHOT builds
Change-Id: I572fe9fea0e5ca0bec4648c916ae95a5b1ccf125
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-06-01 23:04:07 +02:00
Hugo Arès f0a485d5a2 Add missing @Test annotations
Change-Id: Ie5ffcbf18233dc9b3eb232f714b5b58b6b93f4e0
Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
2016-06-01 16:06:23 -04:00
Rüdiger Herrmann 8ff08994a4 JGit CLI: allow to call git init with specific directory
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>
2016-05-22 22:11:03 +02:00
Matthias Sohn ccf8363693 Prepare 4.4.0-SNAPSHOT builds
Change-Id: If3162f4cc4ae6319b9f1e3293549485b039cfe7f
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-08 17:59:59 +02:00
Matthias Sohn f2ee537d55 Prepare 4.3.1-SNAPSHOT versions
Change-Id: I52c98ba8fb3a303269a1f9380af114b6dd8c5009
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-08 00:56:43 +02:00
Matthias Sohn 4f0daa3bb2 JGit v4.3.0.201604071810-r
Change-Id: I902cdf1ff92ce8c6e9d80c4965d8d5bd8b9ac6c1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-08 00:10:10 +02:00
Matthias Sohn 57e6274bcf JGit v4.3.0.201604071045-r
Change-Id: Iafab78d6be34d31a13f979b7be67611135c0f8bd
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-07 16:41:24 +02:00
Matthias Sohn 46bef2bcb6 Prepare 4.3-SNAPSHOT builds
Change-Id: Ib831f8870938113bd5338763f90a07d5c108b1de
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-04-05 23:10:06 +02:00
Matthias Sohn bf32c9102f JGit v4.3.0.201603230630-rc1
Change-Id: I10835e5aa3618e5033424595942cc1649152cb24
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-03-23 11:27:04 +01:00
Matthias Sohn 4dcf34eddf Merge branch 'stable-4.2'
* stable-4.2:
  NoteMapTest: Open TreeWalk instances in try-with-resource
  ObjectDirectoryTest: Fix warnings about variable hiding
  PackWriterTest: Open RevWalk in try-with-resource
  PatchIdDiffFormatterTest: Open Git and PatchIdDiffFormatter in try-with-resource
  PathSuffixFilterTest: Open TreeWalk in try-with-resource
  PostOrderTreeWalkTest: Open TreeWalk in try-with-resource
  PullCommandWithRebaseTest: Open RevWalk in try-with-resource
  PushCommandTest: Open Git instances in try-with-resource
  RacyGitTests: Open NameConflictTreeWalk in try-with-resource
  RecursiveMergerTest: Open TreeWalk and BufferedReader in try-with-resource
  ReflogConfigTest: refactor commit method to avoid variable hiding
  Update .mailmap
  RefDirectoryTest: Fix warning about member variable hiding
  ReflogResolveTest: Open Git instances in try-with-resource
  ReflogTest: Open Git instances in try-with-resource
  RepoCommandTest: Open Git instances in try-with-resource

Change-Id: I7964b699396629e31a9cc5600aedcf4be4e659a8
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-02-12 11:15:33 +01:00
David Pursehouse 77887b49f9 ReflogTest: Open Git instances in try-with-resource
Change-Id: I950b6f16148cfe11de729b04904f88d6e4c28b9a
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-02-12 12:26:58 +09:00
Matthias Sohn 28e2fed761 Merge branch 'stable-4.2'
* 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>
2016-02-10 00:51:01 +01:00
David Pursehouse ef471b0861 RepoTest: Open Git in try-with-resources
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>
2016-02-05 18:17:02 +09:00
Matthias Sohn fc4d117511 Prepare 4.2.1-SNAPSHOT builds
Change-Id: Ic9eac53b10ac97b2038b334d388ae3d21393f993
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-22 01:48:52 +01:00
Matthias Sohn 20c2079f70 JGit v4.2.0.201601211800-r
Change-Id: I89f33b0da81ff499315baa5311f95f31724fa510
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-21 23:47:12 +01:00
Matthias Sohn b30917ce21 Prepare 4.3.0-SNAPSHOT builds
Change-Id: Idcf0479529693b023042becd96698f9afd344bd4
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-21 21:49:41 +01:00
Matthias Sohn 4ec84fac86 Merge branch 'master' into stable-4.2
Change-Id: Ieec4f51aedadf5734ae0e3f4e8713248a3c4fc52
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-21 17:07:31 +01:00
Matthias Sohn 34b4a564ea Merge branch 'stable-4.2'
* stable-4.2:
  BundleWriterTest: Open RevWalk in try-with-resource
  DiffFormatterTest: Remove accidentally added trailing whitespace
  CherryPickCommandTest: Create Git instances in try-with-resource
  DiffFormatterTest: Create auto-closeable instances in try-with-resource
  ConfigTest: Create Git instance in try-with-resource
  CommitAndLogCommandTest: Use assumeFalse to skip test on Windows
  CommitAndLogCommandTest: Create Git instances in try-with-resource
  AddCommandTest: Create Git instances in try-with-resource
  ArchiveCommandTest: Create Git instances in try-with-resource
  TagCommandTest: Instantiate Git and RevWalk objects in try-with-resource
  BlameCommandTest: Instantiate Git objects in try-with-resource
  SideBandOutputStreamTest: Use try-with-resource
  FileTreeIteratorJava7Test: Create Git instances in try-with-resource

Change-Id: Ib572e98e6117b70442aee9cd7e7b8c3cf65562a7
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-21 14:04:39 +01:00
David Pursehouse 72c94465bc ConfigTest: Create Git instance in try-with-resource
Change-Id: Ie65c69e0f1aed95bcdf68ebd68d21b3e2590b41c
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-21 15:31:56 +09:00
David Pursehouse aca07fac46 Merge branch 'stable-4.2'
* 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>
2016-01-20 09:45:48 +09:00
David Pursehouse 7f84e40f31 CheckoutTest: Create Git instances in try-with-resource
Change-Id: I49a03f7bee0b61c062ce160674f9aa0cd1bcc8ba
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:46 +01:00
David Pursehouse 9d721de69b BranchTest: Create Git instances in try-with-resource
Change-Id: I8becee479fab91a18e6daffd6f4fd57338c9d120
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
2016-01-19 17:27:46 +01:00
Matthias Sohn 20f272a71c Prepare 4.2.0-SNAPSHOT builds
Change-Id: Ibe38a95bf36db0c0ed948280b28c416943ec0329
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2016-01-19 13:10:20 +01:00
Andrey Loskutov 7780a4ee31 Make sure CLIGitCommand and Main produce (almost) same results
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>
2016-01-06 17:27:31 -05:00
Andrey Loskutov fb5056c2c5 branch command: print help if requested, even if arguments are wrong
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>
2016-01-06 17:27:15 -05:00
Andrey Loskutov 24468f09e3 Added CLIText.fatalError(String) API for tests
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>
2016-01-06 17:26:43 -05:00
Andrey Loskutov 63bb0bcd4a branch command: provide convenient and meaningful options help
Added tests for all options, fixed multi-valued options parsing.

Bug: 484951
Change-Id: I5558589049544ea6c84932bc01f1f9df09e1f682
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2016-01-02 17:41:59 +01:00
Andrey Loskutov d6deb190e6 Simplify pgm tests: allow varargs and trim output for toString()
Change-Id: Ia5bcd9e560b90cf872fef75c2800c889ef1cc85a
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2016-01-02 17:41:58 +01:00
Andrey Loskutov 35db319e8a Fixed few locale dependent pgm tests
See https://dev.eclipse.org/mhonarc/lists/jgit-dev/msg03040.html

Change-Id: If51f3c750684d82cb6443f1578636c9f5ca56e2b
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
2016-01-02 17:41:58 +01:00
Shawn Pearce da3174a812 buck: set vm_args for tests
Maven pom files force the local encoding to UTF-8 to ensure there are
no differences between machines.  They also set the JVM max heap to
256m. Match both in Buck so that results are consistent.

Change-Id: Ice5476dd09352a444a0c97aa0dc28806fddf2ab4
2016-01-01 11:04:11 -08:00
Shawn Pearce 2f8d787b5f buck: run tests
Compile each test in its own java_test() target so they can run in
parallel, reducing total time spent testing on large machines.

$ buck test --all
[-] PROCESSING BUCK FILES...FINISHED 0.3s [100%]
[-] BUILDING...FINISHED 2.9s [100%] (351/383 JOBS, 351 UPDATED, 0.0% CACHE MISS)
[-] TESTING...FINISHED 98.1s (3360 PASS/15 SKIP/0 FAIL)

Change-Id: I8d6541268315089299f933ed23d785b1b3431133
2015-12-31 17:34:03 -08:00
Andrey Loskutov 02ade82b34 Make sure tests don't blindly continue if a command is "silently" failed
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>
2015-12-31 00:48:11 +01:00
Andrey Loskutov aabbc58341 Sort "eager" path-like options to the end of the help
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>
2015-12-29 15:00:31 +01:00