summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Refactored method to find branches from which a commit is reachable"Robin Rosenberg2012-08-211-0/+73
|\
| * Refactored method to find branches from which a commit is reachableRobin Rosenberg2012-08-211-0/+73
| | | | | | | | | | | | | | | | | | | | | | The method uses some heuristics to obtain much better performance than isMergeBase. Since I wrote the relevant code in the method I approve the license change from EPL to EDL implied by the move. Change-Id: Ic4a7584811a2b0bf24e4f6b3eab2a7c022eabee8 Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* | Teach BranchTrackingStatus to handle tracking of local branchesMatthias Sohn2012-08-182-6/+39
| | | | | | | | | | | | | | | | | | EGit wasn't able to decorate local branches tracking another local branch with number of commits the checked out local branch differs from the other local branch it's tracking. Bug: 376970 Change-Id: I74e932d5eacd74dbf6b0dffcfc65ba3222a8250e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Improve ours/theirs conflict markers for rebase, cherry-pickRobin Stocker2012-08-183-7/+79
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On conflicts in rebase or cherry-pick, the conflict markers were like this: <<<<<<< OURS a ======= b >>>>>>> THEIRS This is technically correct, but it could be better. It's especially confusing during a rebase, where the meaning of OURS/THEIRS is not obvious. The intuition is that "ours" is the commits that "I" did before the rebase, but it's the other way around because of the way rebase works. See various bug reports and stackoverflow discussions. With this change, in the case of a cherry-pick while on master, the markers will be like this: <<<<<<< master a ======= b >>>>>>> bad1dea Message of the commit I'm cherry-picking In the case of a "git rebase master": <<<<<<< Upstream, based on master a ======= b >>>>>>> b161dea Message of a commit I'm rebasing It's not "master" because that would only be correct for the first cherry-pick during a rebase, after that, it's master + already cherry-picked commits. And in the case of a "git pull --rebase": <<<<<<< Upstream, based on branch 'master' of git@example.org:repo a ======= b >>>>>>> b161dea Message of a commit I'm rebasing Bug: 336819 Change-Id: I1333a8dd170bb0077f491962013485efb6f2a926 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge changes Ie949f321,I403de522Shawn Pearce2012-08-157-5/+69
|\ | | | | | | | | | | * changes: Implement wasDeltaAttempted() in DfsObjectRepresentation. Do not delta compress objects that have already tried to compress.
| * Implement wasDeltaAttempted() in DfsObjectRepresentation.Colby Ranger2012-08-133-1/+34
| | | | | | | | | | | | | | | | | | In DFS, everything is stored in a pack but only objects in a pack with source GC or UNREACHABLE_GARBAGE have had delta compression attempted. Expose the PackSource setter and getter on DfsPackDescription in order to implement wasDeltaAttempted. Change-Id: Ie949f321147ad870f1c3f23b552343bbbda32152
| * Do not delta compress objects that have already tried to compress.Colby Ranger2012-08-134-4/+35
| | | | | | | | | | | | | | | | | | | | If an object is in a pack file already, delta compression will not attempt to re-compress it. This assumes that the previous packing already performed the optimal compression attempt, however, the subclasses of StoredObjectRepresentation may use other heuristics to determine if the stored format is optimal. Change-Id: I403de522f4b0dd2667d54f6faed621f392c07786
* | Fix idOffset when the working tree iterator matches a dircache entryRobin Rosenberg2012-08-151-4/+10
|/ | | | | | idOffset is not zero when idBuffer comes from blob in the dircache Change-Id: Iff768422cba140a5d6a776e2c627b852f079c1da
* Merge "Allow JGit to read C Git rebase state"Christian Halstrick2012-08-131-1/+8
|\
| * Allow JGit to read C Git rebase stateRobin Rosenberg2012-08-071-1/+8
| | | | | | | | | | | | C Git prefixes the time stamp in the author script with a "@" Change-Id: I140b29519acc101da78296eef562368fc6b61135
* | Make CheckoutCommand pass modified files through resultMarkus Duft2012-08-072-12/+61
| | | | | | | | | | | | | | | | | | | | This change makes CheckoutCommand pass the list of modified files through the OK result, enabling outside world to react in a smaller scope (for example refresh only resources containing the modified files). Change-Id: I53c50ee09bc0d3ff501bdc25196e52e739c3f1f9 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* | Allow detection of case insensitive file systemsMatthias Sohn2012-08-063-0/+21
| | | | | | | | | | | | Change-Id: I03f59d07bcc3338ef8d392cbd940799186ca03bd Signed-off-by: Matthias Sohn <matthias.sohn@sap.com> Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | 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 "Fix PlotCommit for commits with duplicate parents"Robin Rosenberg2012-08-051-3/+7
|\ \ | |/ |/|
| * Fix PlotCommit for commits with duplicate parentsRobin Rosenberg2012-08-051-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit allows to create commits which have duplicate parents: e.g. a commit X has first parent Y and second parent Y. Such commits are not handled correctly by PlotCommit leading to wrong display of the history in EGit. In such cases there is a never ending passing line drawn beside all commits younger than the commit with duplicate parents. This commit fixes this by explicitly checking for duplicate parents. In a different commit we should fix JGit not to create commits with duplicate parents. I think native git also doesn't allow such commits, although history display in native git (gitk, git log --graph) is not damaged by such commits. Change-Id: Ie3019ef613a507023958bea27b1badc3b8950279
* | Merge "Fix resolving of relative file URIs in TransportLocal"Robin Rosenberg2012-07-291-2/+2
|\ \
| * | Fix resolving of relative file URIs in TransportLocalRobin Stocker2012-07-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A configured remote url like "../repo" works with C Git. In JGit, it only worked if Java's current working directory happened to be the local repository working directory. Change-Id: I33ba3f81b37d03cf17ca7ae25a90774a27e7e02b Signed-off-by: Robin Stocker <robin@nibor.org>
* | | Merge "Garbage collector for FileRepositories"Robin Rosenberg2012-07-295-0/+908
|\ \ \
| * | | Garbage collector for FileRepositoriesChristian Halstrick2012-07-295-0/+908
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements a garbage collector for FileRepositories. Main ideas are copied from the garbage collector for DFS based repos (DfsGarbageCollector). Added functionalities are - pruning loose objects - handling of the index - packing refs - handling of reflogs (objects referenced from reflog will not be pruned/) These are features of a GC which are not handled in this change and which should come with subsequent changes: - unpacking packed objects into loose objects (to support that pruning packed objects doesn't delete them until they are older than two weeks) - expiration of reflogs - support for configuration parameters (e.g. gc.pruneExpire) Change-Id: I14ea5cb7e0fd1b5c50b994fd77f4e05bfbb9d911 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | | | Expose some DFS APIs as public or protectedShawn O. Pearce2012-07-273-3/+22
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expose class DfsReader and method DfsPackFile.hasObject() as public. Applications may want to be able to inquire about some details of the storage of a repository. Make this possible by exposing some simple accessor methods. Expose method DfsObjDatabase.clearCache() as protected, allowing implementing subclasses to dump the cache if necessary, and force it to reload on a future request. Change-Id: Ic592c82d45ace9f2fa5f8d7e4bacfdce96dea969
* | | Again teach ResolveMerger to create more correct DirCacheEntry'sChristian Halstrick2012-07-261-35/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, after a merge/cherry-pick/rebase, all index entries are smudged as the ResolveMerger never sets entry lengths and/or modification times. This change teaches it to re-set them at least for things it did not touch. The other entries are then repaired when the index is persisted, or entries are checked out. The first attempt to get this in was commit 3ea694c2523d909190b5350e13254a62e94ec5d5 which has been reverted. Since then some fixes to ResolveMerger and a few more tests have been added which check situations where the index is not matching HEAD before we merge. Change-Id: I648fda30846615b3bf688c34274c6cf4bc857832 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Also-by: Markus Duft <markus.duft@salomon.at>
* | | Revert "Teach ResolveMerger to create more correct DirCacheEntry's"Shawn Pearce2012-07-241-74/+26
|/ / | | | | | | | | | | This reverts commit 3ea694c2523d909190b5350e13254a62e94ec5d5 Merges with unmodified subtrees are broken with this commit present. Back it out until a fixed version can be supplied.
* | Teach ResolveMerger to create more correct DirCacheEntry'sMarkus Duft2012-07-191-26/+74
| | | | | | | | | | | | | | | | | | | | | | Currently, after a merge/cherry-pick/rebase, all index entries are smudged as the ResolveMerger never sets entry lengths and/or modification times. This change teaches it to re-set them at least for things it did not touch. The other entries are then repaired when the index is persisted, or entries are checked out. Change-Id: I0944f2017483d32043d0d09409b13055b5609a4b Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | Make ApplyCommand create missing parent directories for new filesMarkus Duft2012-07-161-0/+2
| | | | | | | | | | | | | | | | | | | | Otherwise applying will fail with a FileNotFoundException, because File.createNewFile() fails with missing parents. Contains change & according test. Change-Id: I970522b549b8bb260ca6720da11f12c57ee8a492 Signed-off-by: Chris Aniszczyk <zx@twitter.com>
* | Rename local variables in Repository.resolveRobin Rosenberg2012-07-131-61/+63
| | | | | | | | | | | | | | This is to prepare for extension. The new names better reflect the content of the variables. Change-Id: Ic2b4741ab33223aa7f239915d9138b254890bf7b
* | Get rid of warning about possible NullPointerExceptionRobin Rosenberg2012-07-131-5/+5
| | | | | | | | | | | | | | Do this by using one of the two references that are dependent of checkReferencedIsReachable. Change-Id: I4f16916c62ed8ea434013925f49fb03fe57b7d7e
* | Merge "Work around smart HTTP bugs in C Git"Shawn O. Pearce2012-07-112-3/+32
|\ \
| * | Work around smart HTTP bugs in C GitShawn O. Pearce2012-06-272-3/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have unfortunately introduced a few bugs in the native Git client over the years. 1.7.5 is unable to send chunked requests correctly, resulting in corrupt data at the server. Ban this client whenever it uses chunked encoding with an error message. Prior to some more recent versions, git push over HTTP failed to report status information and error messages due to a race within the client and its helper process. Check for these bad versions and send errors as messages before the status report, enabling users to see the failures on their terminal. Change-Id: Ic62d6591cbd851d21dbb3e9b023d655eaecb0624
* | | Create parent dir if necessary on checkoutRobin Stocker2012-07-081-2/+5
| |/ |/| | | | | | | | | | | | | | | An example where this is necessary is when a whole directory was deleted and checkout is used to restore a file which was in that directory. Bug: 372133 Change-Id: I1d45e0a5d2525fe1fdfbf08c9c5c166dd909e9fd Signed-off-by: Robin Stocker <robin@nibor.org>
* | 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>
* | Make InMemoryRepository pack names globally uniqueDave Borowitz2012-06-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was easy to create multiple packs with exactly the same name and same DfsRepositoryDescription in a test, which can poison the DfsBlockCache. The javadoc for DfsObjDatabase.newPack() explicitly says pack names should be unique within an entire DFS, so do this by making the packId AtomicInteger static. Arguably, test writers shouldn't be doing things like putting 'new DfsRepositoryDescription("test")' in a setUp() method, but that's a natural thing to do, and we don't document this restriction anywhere. Change-Id: I9477413ab3950d83b7d17e173fbc0a3e064896e3
* | Merge "Disable PackParser EOF check if more data expected"Shawn Pearce2012-06-271-1/+2
|\ \
| * | Disable PackParser EOF check if more data expectedIan Wetherbee2012-06-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The PackParser EOF check is incompatible with the expect data after pack footer flag, so turn off the EOF check if the expecting data flag is true. Change-Id: I697ebd9e1d1eed765d00aecaef955cf978cfd0b9
* | | Use the working tree's .gitmodules in SubmoduleWalk.forIndex()Dave Borowitz2012-06-251-19/+9
| | | | | | | | | | | | | | | | | | | | | This was broken in fe1f1b8f8aba60fdd1ad6f0f72e9c9180978cc60, which preferred the index over the working tree when both were present. Change-Id: I97dcf9a088adcbd0187fa7eec9ef34445ce3a981 Signed-off-by: Kevin Sawicki <kevin@github.com>
* | | Merge changes I6b2ce96b,I499f518fChristian Halstrick2012-06-251-10/+17
|\ \ \ | | | | | | | | | | | | | | | | | | | | * changes: Fix order of deletion for files/dirs in ResolveMerger Don't return success on failing paths in ResolveMerger
| * | | Fix order of deletion for files/dirs in ResolveMergerRobin Stocker2012-06-231-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, the paths to delete were stored in a HashMap, which doesn't have a particular order. So when e.g. both the file "a/b" and the directory "a" were to be deleted, it would sometimes try to delete "a" first. This resulted in a failed path because File#delete() fails when a directory isn't empty. With this change, an ArrayList is used for storing the paths to delete. The list contains the paths in a top-down order, as defined by the order of processEntry. When the files are deleted, the list is iterated in reverse, ensuring that all files of a directory are deleted before the directory itself. Bug: 354099 Change-Id: I6b2ce96b3932ca84ecdfbeab457ce823c95433fb Signed-off-by: Robin Stocker <robin@nibor.org>
| * | | Don't return success on failing paths in ResolveMergerRobin Stocker2012-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ResolveMerger#mergeImpl() was only returning false (= failed) when there were unmerged paths. In the case when there were only failing paths, it returned true. Because MergeCommand looks at the return value for determining if the merge failed, it would fall into the successful case there, where it should instead return a MergeResult with MergeStatus.FAILED. This change adds a test case for this and makes the ResolveMerger return false when there are failing paths. This was discovered while working on fixing bug 354099 and is needed for its test case. Bug: 354099 Change-Id: I499f518f6289ef93e017db924b2aa857f2154707 Signed-off-by: Robin Stocker <robin@nibor.org>
* | | | Add toString() to simplify debugging rebase stepsMatthias Sohn2012-06-241-0/+14
| | | | | | | | | | | | | | | | Change-Id: Id1508c5f007a6a6680928992a1c7524c266a9ce4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Ignore empty lines when parsing git-rebase-todoRobin Stocker2012-06-231-3/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When starting a rebase with C Git, there may be empty lines in the git-rebase-todo file. Before this change, JGit would fail to parse the file with e.g. the following exception: JGitInternalException: Unknown or unsupported command " #", only "pick" is allowed. This happened when there was an empty line just before the comments, because the nextSpace would be the one from the comment. Now the empty lines are ignored by checking for nextSpace < ptr outside of the loop. Change-Id: I94ad299f367c846e7729c74f49c6b8f93f75ae81 Signed-off-by: Robin Stocker <robin@nibor.org>
* / / Make clear method on StoredConfig publicRobin Rosenberg2012-06-211-0/+5
|/ / | | | | | | | | | | EGit needs this to be able to revert unsaved changes. Change-Id: I50cc8056aaff47fef6080970866962e3eb634e29 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge "Refactor TransportHttp for long-polling"Shawn Pearce2012-06-161-92/+139
|\ \
| * | Refactor TransportHttp for long-pollingIan Wetherbee2012-06-151-92/+139
| | | | | | | | | | | | | | | | | | | | | Split Service into MultiRequestService (fetch, push) and LongPollService (upcoming publish-subscribe). Change-Id: Ice373d3dee63c395490d2707473ccf20a022e5cf
* | | Merge "ReceivePack supports InputStream data after pack"Shawn Pearce2012-06-164-9/+55
|\ \ \
| * | | ReceivePack supports InputStream data after packIan Wetherbee2012-06-154-9/+55
| |/ / | | | | | | | | | | | | | | | | | | When receiving a pack, data buffered after the pack can restored to the InputStream if the stream supports mark and reset. Change-Id: If04915c32c91be28db8df7e8491ed3e9fe0e1608
* / / Fix resource leaks due to unclosed repositoriesChristian Halstrick2012-06-165-42/+74
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever a call to JGit returns a Repository the caller should make sure to call close() on it if he doesn't need it anymore. Since instances of Repository contain e.g. open FileOutputStreams (for pack files) forgetting to close the repository can lead to resource leaks. This was the reason why dozens of the JUnit tests failed on Windows with "Can't delete file ...." errors. In LocalDiskRepositoryTestCase.tearDown() we tried to delete the repositories we used during tests which failed because we had open FileOutputStreams. Not only the obvious cases during Clone or Init operations returned Repositories, but also the new SubModule API created repository instances. In some places we even forgot to close submodule repositories in our internal coding. To see the effects of this fix run the JGit JUnit tests under Windows. On other platforms it's harder to see because either the leaking resources don't lead to failing JUnit tests (on Unix you can delete files with open FileOutputStreams) or the java gc runs differently and cleans up the resources earlier. Change-Id: I6d4f637b0d4af20ff4d501db091548696373a58a Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Read .gitmodules config from the tree in SubmoduleWalkDave Borowitz2012-06-153-7/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | It is not always appropriate to use the .gitmodules file from the working tree, for example if reading the modules at a specific commit. And sometimes it is impossible, as in a bare repository. When using the static factory methods, automatically set up the appropriate root tree so lazy loading of the config file reads from the appropriate place. Leave the current behavior of looking in the working tree as a fallback for the case where walking the index. Change-Id: I71b7ed3ba16c80b0adb8c5fd85b5c37fd4aef8eb
* | Add a release() method to SubmoduleWalkDave Borowitz2012-06-151-12/+29
| | | | | | | | | | | | | | | | We need a way to release the underlying TreeWalk. Also, use this method to release walks from the static factory methods on error or when submodules are not found. Change-Id: I6bedc2db78bcd577aef2cfe6715bb981a26dcfd7
* | Add "--squash" option to MergeCommandTomasz Zarna2012-06-1511-54/+335
| | | | | | | | | | | | | | CQ: 6570 Bug: 351806 Change-Id: I5e47810376419264ecf4247b5a333af5c8945080 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Remove unused import of ObjectInserter in ResolveMergerTomasz Zarna2012-06-151-2/+1
| | | | | | | | Change-Id: I415894418f6fbe922c61294b21e15eee64e8a806