summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/exttst
Commit message (Collapse)AuthorAgeFilesLines
* Remove further unnecessary 'final' keywordsHan-Wen Nienhuys2018-05-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+1
| | | | | Change-Id: Id924f79c8b2c720297ebc49bf9c5d4ddd6d52547 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* Significantly speed up FileTreeIterator on WindowsThomas Wolf2018-03-251-0/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Getting attributes of files on Windows is an expensive operation. Windows stores file attributes in the directory, so they are basically available "for free" when a directory is listed. The implementation of Java's Files.walkFileTree() takes advantage of that (at least in the OpenJDK implementation for Windows) and provides the attributes from the directory to a FileVisitor. Using Files.walkFileTree() with a maximum depth of 1 is thus a good approach on Windows to get both the file names and the attributes in one go. In my tests, this gives a significant speed-up of FileTreeIterator over the "normal" way: using File.listFiles() and then reading the attributes of each file individually. The speed-up is hard to quantify exactly, but in my tests I've observed consistently 30-40% for staging 500 files one after another, each individually, and up to 50% for individual TreeWalks with a FileTreeIterator. On Unix, this technique is detrimental. Unix stores file attributes differently, and getting attributes of individual files is not costly. On Unix, the old way of doing a listFiles() and getting individual attributes (both native operations) is about three times faster than using walkFileTree, which is implemented in Java. Therefore, move the operation to FS/FS_Win32 and call it from FileTreeIterator, so that we can have different implementations depending on the file system. A little performance test program is included as a JUnit test (to be run manually). While this does speed up things on Windows, it doesn't solve the basic problem of bug 532300: the iterator always gets the full directory listing and the attributes of all files, and the more files there are the longer that takes. Bug: 532300 Change-Id: Ic5facb871c725256c2324b0d97b95e6efc33282a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Consistently use Constants.CHARSET rather than StandardCharsets.UTF_8David Pursehouse2018-03-111-3/+3
| | | | | Change-Id: I6714fc3666e1bced22abba94ceb700477349586e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* EGitPatchHistoryTest: Open BufferedReader in try-with-resourceDavid Pursehouse2018-03-061-19/+19
| | | | | Change-Id: I74aede463c7b0a478a1e0e8b680c206d3964061d Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* EGitPatchHistoryTest: Set input stream encoding with constantDavid Pursehouse2018-03-061-1/+1
| | | | | Change-Id: Ieff9b1d07704e37c8d5616b220b015855a7cc624 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* CGitVsJGitRandomIgnorePatternTest: Open OutputStream in try-with-resourceDavid Pursehouse2018-03-051-4/+4
| | | | | Change-Id: I08e27d0ee48dabd94a4eeb608508f815a3000ec9 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* Use constants from StandardCharsets instead of hard-coded stringsDavid Pursehouse2017-12-072-7/+7
| | | | | | | | | | | | | | | | Instead of hard-coding the charset strings "US-ASCII", "UTF-8", and "ISO-8859-1", use the corresponding constants from StandardCharsets. UnsupportedEncodingException is not thrown when the StandardCharset constants are used, so remove the now redundant handling. Because the encoding names are no longer hard-coded strings, also remove redundant $NON-NLS warning suppressions. Also replace existing usages of the constants with static imports. Change-Id: I0a4510d3d992db5e277f009a41434276f95bda4e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
* FileUtils.toPath to convert File to PathMarc Strapetz2017-11-141-1/+2
| | | | | | | | | | | When invoking File.toPath(), an (unchecked) InvalidPathException may be thrown which should be converted to a checked IOException. For now, we will replace File.toPath() by FileUtils.toPath() only for code which can already handle IOExceptions. Change-Id: I0f0c5fd2a11739e7a02071adae9a5550985d4df6 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
* Enable and fix warnings about redundant specification of type argumentsDavid Pursehouse2017-02-201-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>
* Add test case comparing CGit vs JGit ignore behavior for random patternsSébastien Arod2015-09-301-0/+275
| | | | | | | | This test case was developed in the scope of bug 478065. Bug: 478065 Change-Id: Ibcce1ed375d4a6ba05461e6c6b287d16752fa681 Signed-off-by: Sébastien Arod <sebastien.arod@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Deprecate TemporaryBuffer.LocalFile without parent directoryShawn Pearce2014-11-251-1/+1
| | | | | | | | | | | | | Encourage callers to explicitly name a directory to hold any overflow data. Call sites have more information about what is going into the buffer and how it should be protected at the filesystem level than just throwing content to the system wide temporary directory. Callers that still really don't care (or need to care) can pass null for the File argument to have the system directory used. Change-Id: I89009bbee49d3850d42cd82c2c462e51043acda0
* Kill GitIndexRobin Rosenberg2011-11-091-481/+0
| | | | | | | | | | A few places were still using GitIndex. Replacing it was fairly simple, but there is a difference in test outcome in ReadTreeTest.testUntrackedConflicts. I believe the new behavior is good, since we do not update neither the index, not the worktree. Change-Id: I4be5357b7b3139dded17f77e07a140addb213ea7 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* Remove deprecated Repository.mapTreeShawn O. Pearce2011-03-071-8/+10
| | | | | | | | | | | | | | | The mapTree() routines have been deprecated for a long time, and their sibilings for mapCommit() and mapTag() were already removed from the main Repository API. Remove mapTree(). Application callers who only need the tree's name can use resolve("^{tree}") syntax to resolve to the tree ObjectId, or fail if the input is not a tree. Applications that want to read a tree should use DirCache or TreeWalk. Change-Id: I85726413790fc87721271c482f6636f81baf8b82 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Convert all JGit unit tests to JUnit 4Robin Rosenberg2010-12-312-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Rename getOldName,getNewName to getOldPath,getNewPathShawn O. Pearce2010-08-041-2/+2
| | | | | | | | | | TreeWalk calls this value "path", while "name" is the stuff after the last slash. FileHeader should do the same thing to be consistent. Rename getOldName to getOldPath and getNewName to getNewPath. Bug: 318526 Change-Id: Ib2e372ad4426402d37939b48d8f233154cc637da Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Rename Repository getWorkDir to getWorkTreeShawn O. Pearce2010-06-251-1/+1
| | | | | | | | | | | | | | This better matches with the name used in the environment (GIT_WORK_TREE), in the configuration file (core.worktree), and in our builder object. Since we are already breaking a good chunk of other code related to repository access, and this fairly easy to fix in an application's code base, I'm not going to offer the wrapper getWorkDir() method. Change-Id: Ib698ba4bbc213c48114f342378cecfe377e37bb7 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Remove speed tests based on mapCommitShawn O. Pearce2010-06-233-301/+0
| | | | | | | | | | The mapCommit API is being deprecated because it doesn't run very fast. Leaving tests around to test how fast it is relative to C Git isn't instructive. Remove them, which should help aid the transition away from the mapCommit API. Change-Id: I27e1c844610d7da5b2c44b33a00602706973c9cc Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Repository can be configured with FSMarc Strapetz2010-06-041-2/+2
| | | | | | | | | | | | | On Windows, FS_Win32_Cygwin has been used if a Cygwin Git installation is present in the PATH. Assuming that the user works with the Cygwin Git installation may result in unnecessary overhead if he actually does not. Applications built on top of jgit may have more knowledge on the actually used Git client (Cygwin or not) and hence should be able to configure which FS to use accordingly. Change-Id: Ifc4278078b298781d55cf5421e9647a21fa5db24
* Refactor TemporaryBuffer to support reuse in other contextsShawn O. Pearce2010-01-121-2/+2
| | | | | | | | | | | | | | | | Later we are going to add support for smart HTTP, which requires us to buffer at least some of the request created by a client before we ship it to the server. For many requests, we can fit it completely into a 1 MiB buffer, but if it doesn't we can drop back to using the chunked transfer encoding to send an unknown stream length. Rather than recoding the block based memory buffer, we refactor the local file overflow strategy into a subclass, allowing the HTTP client code to replace this portion of the logic with its own approach to start the chunked encoding request. Change-Id: Iac61ea1017b14e0ad3c4425efc3d75718b71bb8e Signed-off-by: Shawn O. Pearce <sop@google.com>
* Move T0007_Index to exttstShawn O. Pearce2009-11-021-0/+460
| | | | | | | | | | This test depends upon the external git binary, and this isn't really a pure Java test like our module tries to claim itself is. So we move it out to exttst with other tests that require additional external resources and/or executable code. Change-Id: Ic9be0280c8bb50a5768336c64de794eb0a492b3d Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Initial JGit contribution to eclipse.orgGit Development Community2009-09-294-0/+528
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>