aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/dircache
Commit message (Collapse)AuthorAgeFilesLines
* Cleanup javadocs so they pass the java8 doclint checksRobin Rosenberg2014-03-292-10/+10
| | | | | | Bug: 431552 Change-Id: I469316f5645205016e1fa6b0fbd2ff3b509b14bc Signed-off-by: Robin Stocker <robin@nibor.org>
* Change DirCacheCheckout to verify path using ObjectCheckerShawn Pearce2014-03-121-123/+28
| | | | | | | | Reuse the generic logic in ObjectChecker to examine paths. This required extracting the scanner loop to check for bad characters within the path name segment. Change-Id: I02e964d114fb544a0c1657790d5367c3a2b09dff
* Add missing breakRobin Rosenberg2014-03-091-0/+1
| | | | | | It does not really matter functionally, but it looked bad, Change-Id: Icb5b73b38fcaa19f7d1c5a0235c3e8dd125b888b
* Add @since tag to new DirCache#findEntryRobin Rosenberg2014-03-081-0/+1
| | | | Change-Id: Ia58efd178a4571c013bf1104d1da956a86fd7029 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix some wrong @since 3.3 tags which should be @since 3.4Matthias Sohn2014-03-071-1/+1
| | | | Change-Id: Idafe6e041cc40a00ac52eb4ba88753c49db86988 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge "DirCache.findEntry(byte[], in) made public"Robin Rosenberg2014-03-031-8/+20
|\
| * DirCache.findEntry(byte[], in) made publicMarc Strapetz2014-02-241-8/+20
| | | | | | | | | | Change-Id: Ice64e3b0e5d67a39690aa24e41c954b8ce312d49 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>‌
* | Merge "Don't raise checkout conflict for file missing in working tree"Christian Halstrick2014-02-271-3/+3
|\ \
| * | Don't raise checkout conflict for file missing in working treeChristian Halstrick2014-02-261-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | 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 a missing @since tagChristian Halstrick2014-02-261-0/+1
| | | | | | | | Change-Id: Ie34a4a9c4c47c2f27579094d74a7849fc26a323b
* | DirCacheEntry: access to raw pathMarc Strapetz2014-02-261-0/+9
|/ | | | | Change-Id: I5d1f6c4b5b3d7a971367cdd0cc9fa4022dff5b85 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>‌
* Add symlink support to JGitRobin Rosenberg2014-02-101-33/+42
| | | | | | | | | | | | | | | | | | | | 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>
* Ban dangerous ref names in WindowsRobin Rosenberg2014-02-051-17/+50
| | | | | | | Bug: 423551 Change-Id: I3e71ef1b4a8181f46d2902c9169859f150cd6ad0 Also-By: Robin Stocker <robin@nibor.org> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix for core.autocrlf=input resulting in modified fileRobin Rosenberg2014-02-021-6/+14
| | | | | | | | | | | This version does not attempt to unsmudge, unlike the first attempt in Idafad150553df14827eccfde2e3b95760e16a8b6. Bug: 372834 Change-Id: I9300e735cb16d6208e1df963abb1ff69f688155d Also-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Robin Stocker <robin@nibor.org>
* More helpful InvalidPathException messages (include reason)Robin Stocker2013-12-032-23/+43
| | | | | | | | | | Instead of just a generic "Invalid path: $path", add a reason for the cases where it's not obvious what the problem is (e.g. "aux" being reserved on Windows). Bug: 413915 Change-Id: Ia6436bd2560e4f049c92d9aac907cb87348605e0 Signed-off-by: Robin Stocker <robin@nibor.org>
* Fix handling of file/folder conflicts during a checkoutChristian Halstrick2013-11-291-1/+7
| | | | | | | | | | | | | | | | | | | | JGit was not handling certain file/folder conflicts during a checkout correctly. This was reported by Axel Richard in http://dev.eclipse.org/mhonarc/lists/jgit-dev/msg02358.html. This commit fixes this problem. Still JGit behaves intentionally different than native git. If HEAD contains a tree, and workingtree, Index and Merge contain a file with same content ... then JGit allows a conflict free checkout of Merge. Native git always complains that it doesn't want to overwrite local changes. But there is no need to update the working tree because Index and Merge are already equal. A shell script which shows how native git behaves can be found here. https://gist.github.com/chalstrick/7694959#file-gistfile1-sh Change-Id: Ifd6a68974d61cd4fa23bc575f3a40773db66cafc Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* testMaliciousPathEmpty fails on WindowsRobin Rosenberg2013-11-011-2/+3
| | | | | | | | Checking of spaces at the end of the file name caused the test to fail for Windows only. Bug: 396662 Change-Id: I47bcccb0fa32ce606276c3f30d454851d115ca11 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* ResetCommand: Allow reset on unborn branch when ref not specifiedRobin Stocker2013-09-131-1/+1
| | | | | | | | | | | | | In C Git 1.8.2, "git reset" now also works on an unborn branch (no HEAD yet) if no explicit ref was specified. In that case, it is treated as a reset to an empty tree. This can be useful for callers because "unborn branch" no longer has to be special-cased to "git rm --cached". Bug: 414870 Change-Id: Ied750116f767518ae4d48823cf00752b049a8477 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Make sure checkout is not deleting folders outside the workingtreeChristian Halstrick2013-07-101-2/+2
| | | | | | | | | | | | | | | There was a chance that jgit deletes symbolic links which point to the folder on top of the working tree. Make sure not to touch these resources. Thanks to Cedric Darloy who reported this bug on http://www.eclipse.org/forums/index.php/m/776910/#msg_776910 and to Ondrej Vrabec who reported bug 412489. Bug: 412489 Change-Id: I81735ba0394ef6794e9b2b8bdd8bd7e8b9c6460f Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Robin Stocker <robin@nibor.org>
* Check parentFile is not nullHiroshi Tomita2013-07-051-1/+1
| | | | | | | | | parentFile becomes null when f is relative path, such as ".". This patch avoids NullPointerException in such case. Change-Id: I4752674b1daab6eedd7c3650c7749462810eaffd Signed-off-by: Hiroshi Tomita <tomykaira@gmail.com>
* File.renameTo behaves differently on Unix and WindowsRobin Rosenberg2013-03-261-10/+6
| | | | | | | | On Windows renameTo will not overwrite a file, so it must be deleted first. The fix for Bug 402834 did not account for that. Bug: 403685 Change-Id: I3453342c17e064dcb50906a540172978941a10a6
* JGit 3.0: move internal classes into an internal subpackageShawn Pearce2013-03-181-2/+2
| | | | | | | | 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
* A folder does not constitute a dirty work treeRobin Rosenberg2013-03-101-1/+2
| | | | | | | | | | | This fixes two cases: - A folder without tracked content exist both in the workdir and merged commit, as long as there names within that folder does not conflict. - An empty folder structure exists with the same name as a file in the merged commit. Bug: 402834 Change-Id: I4c5b9f11313dd1665fcbdae2d0755fdb64deb3ef
* Add better documentation to DirCacheCheckoutChristian Halstrick2013-02-071-1/+139
| | | | | Change-Id: I282b702d9e4cb19063d8e9503604538f80e955b7 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Mark non-externalizable strings as suchRobin Rosenberg2012-12-274-10/+11
| | | | | | | | | | A few classes such as Constanrs are marked with @SuppressWarnings, as are toString() methods with many liternal, but otherwise $NLS-n$ is used for string containing text that should not be translated. A few literals may fall into the gray zone, but mostly I've tried to only tag the obvious ones. Change-Id: I22e50a77e2bf9e0b842a66bdf674e8fa1692f590
* DirCacheIterator: Fix reset() and back()Robin Rosenberg2012-12-152-1/+22
| | | | | | | | | | | | | | reset() was broken and probably only worked when the position was at the beginning. More serious was that back() sometimes descended into the tree rather than skipping backward at the same level. Sometimes this would result in false conflicts, but one could suspect silent errors too. back() is called by the NamingConflictTreeWalk when looking for directory/file conflicts. Also added toString to DirCacheTree to simplify debugging. Bug: 396127 Change-Id: Iaa1b4e20e623d84c2e5ac26748f42e991080dbcd
* DirCacheEditor: Apply PathEdit for each stageRobin Stocker2012-11-161-5/+8
| | | | | | | | | | | | This behavior was defined in the Javadoc of PathEdit, but not actually implemented. It's necessary when one wants to use a PathEdit to check out a specific stage in apply. Bug: 390147 Change-Id: Iaed5cf60c554fc17e6c4d188caf4f0231da920d0 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Add missing @since tags to mark API added in 2.2Matthias Sohn2012-11-161-0/+1
| | | | | | Change-Id: I458167739210214fa54c4b3d62fac5abc82f96f7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Add Javadoc description for packagesRobin Stocker2012-10-311-0/+4
| | | | | | | | | These appear as descriptions in the index, see here (currently empty): http://download.eclipse.org/jgit/docs/latest/apidocs/ Change-Id: If7996deef30ae688bade8b3ad6b19547ca3d8b50 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* StashCreateCommand: Abort in case of unmerged pathsRobin Stocker2012-10-221-0/+9
| | | | | Bug: 391861 Change-Id: I5f8ffe072c08c8ca2ca6be6b6afa67c8e16a63b6
* DirCacheCheckout: Fix handling of files not in indexRobin Stocker2012-09-011-14/+16
| | | | | | | | | | | | | | | | | | | | | | When a file is not in the index and neither contents nor mode differ between "head" and "merge", the index state should be kept. If they differ, a checkout conflict should occur. This is described in Git's git-read-tree.txt. JGit used to replace the index state with "merge" in both of the above cases. A confusing effect of this was that when one removed a file and then did a rebase, the file silently reappeared again. The changes to dir/file conflict handling are a consequence of this change, as the index handling change made tests in DirCacheCheckoutTest break. I compared these cases to C Git and the new behavior there also matches what C Git does. Bug: 387390 Change-Id: I5beb781f12172a68f98c67d4c8029eb51ceae62d Signed-off-by: Robin Stocker <robin@nibor.org>
* Refactor detection of Windows platform to SystemReaderRobin Rosenberg2012-08-222-4/+2
| | | | Change-Id: Id0b8aef92f10572d4f1ec198e0281162fcd7ed4e
* Refactor detection of OS X to SystemReaderRobin Rosenberg2012-08-221-1/+1
| | | | Change-Id: I34e9ba4a26f7af5b88140c070f02a7990f1941af
* Ensure a directory exists before trying to create/merge a file into it.Jevgeni Zelenkov2012-08-061-0/+1
| | | | | | | | | | Since git doesn't keep track of empty directories, they should be created first. Test case included demonstrates that using StashApplyCommand(). Bugfix is applied to the DirCacheCheckout class, because StashApplyCommand() uses it internally to apply a stash. Change-Id: Iac259229ef919f9e92e7e51a671d877172bb88a8 Signed-off-by: Jevgeni Zelenkov <jevgeni.zelenkov@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-2.0'Matthias Sohn2012-07-021-0/+11
|\ | | | | | | | | | | | | | | * stable-2.0: Improve performance of persisting an index by magnitudes Change-Id: I880f4d0be81c263b598ee24e8373c6f8cb781c51 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Improve performance of persisting an index by magnitudesstable-2.0Christian Halstrick2012-06-281-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When updating smudged entries use a pathfilter to iterate only over working tree files which have an associated smudged index entry. Commit dac66672df0535f61a13273524d46e1e0012ca69 introduced that we check and update smudged entries while persisting a dircache. Before that commit adding a file to git caused file i/o for the index file, the object database (to store new content) and all files we wanted to add (to read new content). After that commit we have additionally file i/o for every file in the working tree (even ignored files). Especially on windows iterating over the working tree can be very time consuming. This decreased the performance of persisting a dircache dramatically (I measured factors 4 to 10 while adding a file to linux kernel repo). One could easily see this effect when dragging&dropping modified files in a linux kernel repo in the egit staging view. Change-Id: I568dec77635013cf6bb46f652d3f2b89de041c82 Signed-off-by: Kevin Sawicki <kevin@github.com>
* | Merge branch 'stable-2.0'Shawn O. Pearce2012-06-071-4/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By Robin Rosenberg (6) and others via Gerrit Code Review @ Eclipse.org (2) and Matthias Sohn (1) * stable-2.0: Prepare next 2.0.0-SNAPSHOT builds JGit v2.0.0.201206060730-rc3 Remove Jetty p2 repository from Maven build Get rid of warnings about empty statments Removed unused parameters from private methods cleanup: Remove unused declarations Make FS OS X detection work for OpenJDK Use working tree iterator to compare file modes Further cleanup of exceptions in Git API Update build to use Tycho 0.15.0 Throw formal CheckoutConflictException on hard reset Configure maven-source-plugin execution in parent POM Support gitdir: refs in BaseRepositoryBuilder.findGitDir Relax RevisionSyntaxException to an IllegalArgumentException Change-Id: I05727693e0c9e762d4fc220ceadcd5a5bfb11d0d
| * Make FS OS X detection work for OpenJDKRobin Rosenberg2012-06-061-4/+3
| | | | | | | | | | | | | | OpenJDK sets the os.name system.property to "Darwin", while Apple's version says "Mac OS X". Change-Id: If08f8e7b8ef94ec00023a3f78bbf502ebd9699fb
* | Make DirCacheCheckout update timestamps in the index.Markus Duft2012-06-061-2/+8
|/ | | | | | | | This updates the timestamp of files that are not touched during checkout. Otherwise the timestamp will always be zero, causing the IndexDiffFilter to always calculate the checksum of file contents. Change-Id: I18047f5725f22811bb4194ca1d3a3cac56074183
* Update smudged entries when writing indexKevin Sawicki2012-05-281-1/+100
| | | | | | | | | | | Overload DirCache.lock to take a repository that is used for updating smudged index entries with information from the repository's working tree. New unit tests are also added for updating smudged index entries on reset, checkout, and commit. Change-Id: I88689f26000e4e57e77931e5ace7c804d92af1b6
* Smudge index entries on first write (too), as well when readingRobin Rosenberg2012-05-212-18/+34
| | | | | | | | | | | That happens when the index and a new file is created within the same second and becomes a problem if we then modify the newly created file within the same second after adding it to the index. Without smudging JGit will, on later reads, think the file is unchanged. The accompanying test passed with the smuding on read. Change-Id: I4dfecf5c93993ef690e7f0dddb3f3e6125daae15
* Add missing @since tags to mark API added in 2.0Matthias Sohn2012-05-101-0/+2
| | | | | | Change-Id: I0a86ce0e393dfde9bb27f0b29e036e76c856396e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* Remove 86 boxing warningsKevin Sawicki2012-05-081-5/+9
| | | | | | | | Use Integer, Character, and Long valueOf methods when passing parameters to MessageFormat and other places that expect objects instead of primitives Change-Id: I5942fbdbca6a378136c00d951ce61167f2366ca4
* Remove unnecessary boxing SuppressWarnings annotationKevin Sawicki2012-05-081-1/+0
| | | | Change-Id: Id8a6d9f96860742f9094efdb4f31a952be7d3025
* Validate paths during DirCheckoutRobin Rosenberg2012-04-233-5/+181
| | | | | | | | | | | | | | | | | | | DirCacheCheckout and CanonicalTreeParser cooperate. CanonicalTreeParser can detect malformed, potentially malicious tree entries and sets a flag, while DirCacheCheckout refuses to work with such paths. Malicious tree entries are ".", "..", ".git" (case insensitive), any name containing '/' and (on Windows '\') and also (on Windows) any paths ending in a combination of '.' or space or containing a ':'. We also forbid all special names like "con" etc on Windows. Some of the test can execute on any platform by enabling partial platform emulation. A new runtime exception, InvalidPathException, is introduced. For backwards compatibility it extends InvalidArgumentException. Change-Id: I86199105814b63d4340e5de0e471d0da6b579ead Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Enable large file supportRobin Rosenberg2012-04-181-8/+7
| | | | | | | | Allow adding files with size over 2 GB. The drawback is that the tests for huge file support adds roughly 10 minutes of execution time. For that reason we @Ignore the test in the standard test execution. Change-Id: I5788e8009899203b346f353297166825b3744575
* Enable DirCacheEntry's copyMetaData to not copy stage infoRobin Rosenberg2012-04-172-4/+27
| | | | | | | When there is a conflict sometimes we did not set the stage of the conflict entries properly for the STAGE_1 entry. Change-Id: I1c28ff6251fdbc95f7c40fc3e401f1b41157a9f6
* Hide two warnings about boxingRobin Rosenberg2012-04-161-0/+2
| | | | Change-Id: I1cb7cdb81481019f4a55221d38d771fcc9451529 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Move JGitText to an internal packageRobin Rosenberg2012-03-125-5/+5
| | | | Change-Id: I763590a45d75f00a09097ab6f89581a3bbd3c797
* Merge "Update example code for obtaining a locked DirCache"Christian Halstrick2012-03-051-1/+1
|\