aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/StringUtilsTest.java
Commit message (Collapse)AuthorAgeFilesLines
* Optimize RefDirectory.getRefsByPrefix(String...)Dariusz Luksza2023-11-121-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently for file-based repositories JGit will go over all refs in the repository forach `ref-prefix` listed in the `ls-refs` command in git protocol v2 request. Native git, uses a different approach, where all refs are read once and then for each ref, all `ref-prefix` filter values are checked in one pass. This change implements this approach in JGit only in the `RefDirectory` backend. And makes `ref-prefix` filtering ~40% faster for repositories with packed refs. Different implementations were tested on a synthetic file repository with 10k refs in `refs/heads/` and `290k` in `refs/changes`. Before testing `git pack-refs` command was executed. All results are in seconds. Current Impl: 39.340 37.093 35.996 Nested for loops: 25.077 24.742 24.748 Nested streams: 24.827 24.890 27.525 Parallel stream + stream: 23.357 23.318 23.174 Nested parallel streams: 23.490 23.318 23.317 Stream + for loop: 23.147 23.210 23.126 Parallel stream + for loop: 23.317 23.423 22.847 The elapsed time was measured around `getRefByPrefix` call in `Uploadapack.getFilteredRefs(Collection<String>)` (around lines 952 and 954). For testing a modified version of `UploadPackTest.testV2LsRefsRefPrefix()` was used. The modifications here included: * shadowing protected `repo` variable with `FileRepository` pointing to the synthetic repo with 300k refs described above, * mimicking the git client clone request by adding `ref-prefix HEAD`, `ref-prefix refs/heads/` and `ref-prefix refs/tags/` Based on the above results, the implementation with parallel stream and stream was selected. Bug: 578550 Signed-off-by: Dariusz Luksza <dariusz.luksza@gmail.com> Change-Id: I6416846c074b611ff6ec9d351dbafcfbcaf68e66
* Factor out parsing git-style size numbers to StringUtilsThomas Wolf2021-10-301-0/+83
| | | | | | | | | | | Move the code to parse numbers with an optional 'k', 'm', or 'g' suffix from the config file handling to StringUtils. This enables me to re-use it in EGit, which has duplicate code in StorageSizeFieldEditor. As this is generally useful functionality, providing it in the library makes sense. Change-Id: I86e4f5f62e14f99b35726b198ba3bbf1669418d9 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Update EDL 1.0 license headers to new short SPDX compliant formatMatthias Sohn2020-01-041-38/+5
| | | | | | | | | | This is the format given by the Eclipse legal doc generator [1]. [1] https://www.eclipse.org/projects/tools/documentation.php?id=technology.jgit Bug: 548298 Change-Id: I8d8cabc998ba1b083e3f0906a8d558d391ffb6c4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Recognize CRLF when parsing the short message of a commit or tagRobin Rosenberg2013-06-141-0/+12
| | | | | Bug: 400707 Change-Id: I9b09bb88528af465018fc0278f5441f7e6b75986
* Convert all JGit unit tests to JUnit 4Robin Rosenberg2010-12-311-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Eclipse has some problem re-running single JUnit tests if the tests are in Junit 3 format, but the JUnit 4 launcher is used. This was quite unnecessary and the move was not completed. We still have no JUnit4 test. This completes the extermination of JUnit3. Most of the work was global searce/replace using regular expression, followed by numerous invocarions of quick-fix and organize imports and verification that we had the same number of tests before and after. - Annotations were introduced. - All references to JUnit3 classes removed - Half-good replacement for getting the test name. This was needed to make the TestRngs work. The initialization of TestRngs was also made lazily since we can not longer find out the test name in runtime in the @Before methods. - Renamed test classes to end with Test, with the exception of TestTranslateBundle, which fails from Maven - Moved JGitTestUtil to the junit support bundle Change-Id: Iddcd3da6ca927a7be773a9c63ebf8bb2147e2d13 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Initial JGit contribution to eclipse.orgGit Development Community2009-09-291-0/+84
Per CQ 3448 this is the initial contribution of the JGit project to eclipse.org. It is derived from the historical JGit repository at commit 3a2dd9921c8a08740a9e02c421469e5b1a9e47cb. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>