summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* Remove empty iterator from TreeWalkShawn O. Pearce2010-12-0710-19/+5
| | | | | | | | | | | | | | | | | Its confusing that a new TreeWalk() needs to have reset() invoked on it before addTree(). This is a historical accident caused by how TreeWalk was abused within ObjectWalk. Drop the initial empty tree from the TreeWalk and thus remove a number of pointless reset() operations from unit tests and some of the internal JGit code. Existing application code which is still calling reset() will simply be incurring a few unnecessary field assignments, but they should consider cleaning up their code in the future. Change-Id: I434e94ffa43491019e7dff52ca420a4d2245f48b Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* [findbugs] Do not ignore exceptional return valueMatthias Sohn2010-12-076-13/+17
| | | | | | | | | | java.io.File.delete() reports failure as an exceptional return value false. Fix the code which silently ignored this exceptional return value. Also remove some duplicate deletion helper methods. Change-Id: I80ed20ca1f07a2bc6e779957a4ad0c713789c5be Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge "Rebase Interoperability second part: fix "pop steps""Chris Aniszczyk2010-12-071-2/+2
|\
| * Rebase Interoperability second part: fix "pop steps"Mathias Kinzler2010-12-011-2/+2
| | | | | | | | | | | | | | | | | | | | If the CLI stops a rebase upon conflict, the current step is already popped from the git-rebase-todo and appended to the "done" file. The current implementation wrongly pops the step only after successful cherry-pick. Change-Id: I8640dda0cbb2a5271ecf75fcbad69410122eeab6 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | Merge "Add InitCommand"Chris Aniszczyk2010-12-061-0/+100
|\ \
| * | Add InitCommandChris Aniszczyk2010-12-051-0/+100
| | | | | | | | | | | | | | | | | | | | | Adds git-init support to the Git API. Change-Id: I1428b861f22cabe4d92cadf3d9114dddeec75b40 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | | Merge "Remove result id from CommitBuilder, TagBuilder"Chris Aniszczyk2010-12-062-34/+35
|\ \ \
| * | | Remove result id from CommitBuilder, TagBuilderShawn O. Pearce2010-12-032-34/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These objects don't need to be updated with the resulting ObjectId of the formatted content, callers can get that from the ObjectInserter on their own. Change-Id: Idc5f097de9f7beafc5e54e597383d82daf9d7db4 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | | | Fix findGitDir() with no ceiling directoriesShawn O. Pearce2010-12-051-0/+59
|/ / / | | | | | | | | | | | | | | | | | | | | | Bug: 322866 Change-Id: I64205bb0315a725dfa523ccff1796de50f465162 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> CC: Ketan Padegaonkar <KetanPadegaonkar@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Correct CommitBuilder, TagBuilder method to be build()Shawn O. Pearce2010-12-032-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The correct names for these is build(), as that is what a Java developer will expect given the "builder" pattern. Bug: 323541 Change-Id: I35042bdc95a955beeaee29e54bde10e4240b2a71 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Reviewed-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | | Merge "Rebase Interoperability first part: write "interactive" file"Chris Aniszczyk2010-12-021-2/+4
|\ \ \ | |/ / |/| / | |/
| * Rebase Interoperability first part: write "interactive" fileMathias Kinzler2010-12-011-2/+4
| | | | | | | | | | | | | | The Repository is then in state "Rebase interactive". Change-Id: I5d2de57f8670e1d4c71ed22509ab17f04e2561b5 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | Fixed Merge Algorithm regarding concurrent file creationsChristian Halstrick2010-12-021-0/+79
|/ | | | | | | | | | | | When in OURS and THEIRS a new file is created we want a conflict when the two contents differ. If on two branches the same file with the same content is created this should not be a conflict. But: the current merge algorithm is throwing NPEs in this case. Fix this by choosing an empty RawText as common base if the base is empty. Change-Id: I21cb23f852965b82fb82ccd66ec961c7edb3ac3d Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Include list of assume unchanged files in IndexDiffStefan Lay2010-11-301-0/+45
| | | | | | | | | | The IndexDiff had not collected the info if the flag "assume-unchanged" is set. This information is useful for clients which may want to decide if specific actions are allowed on a file. Bug: 326213 Change-Id: I14bb7b03247d6c0b429a9d8d3f6b10f21d8ddeb1 Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* Check assume unchanged flag in Add commandStefan Lay2010-11-292-0/+47
| | | | | | | | | | When the assume unchanged flag is set the Add command must not update the index for this file if any changes are present in the working directory. Bug: 331351 Change-Id: I255870f689225a1d88971182e0eb377952641b42 Signed-off-by: Stefan Lay <stefan.lay@sap.com>
* Merge "Change default diff algorithm to histogram and add tests"Chris Aniszczyk2010-11-261-0/+19
|\
| * Change default diff algorithm to histogram and add testsChristian Halstrick2010-11-261-0/+19
| | | | | | | | | | | | | | | | | | | | | | The referenced bug showed that JGit produced different merge results compared to C Git. Unit test was added to reproduce the issue. The problem can be solved by switching to histogram diff algorithm. Bug: 331078 Change-Id: I54f30afb3a9fef1dbca365ca5f98f4cc846092e3 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Philipp Thun <philipp.thun@sap.com>
* | Merge "Do some more tests for rebase --abort"Chris Aniszczyk2010-11-262-9/+114
|\ \ | |/ |/|
| * Do some more tests for rebase --abortStefan Lay2010-11-252-9/+114
| | | | | | | | | | | | | | | | | | Check for deletion of temporary files in .git folder. Check for deletion and creation of files. Change-Id: I60b0b2975724f2e3582e8674d9f876dcbf62b350 Signed-off-by: Stefan Lay <stefan.lay@sap.com> Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | Make diff algorithm configurableChristian Halstrick2010-11-261-1/+1
|/ | | | | | | | | | | | | | | | The diff algorithm which is used by Merge, Cherry-Pick, Rebase should be configurable. A new configuration parameter "diff.algorithm" is introduced which currently accepts the values "myers" or "histogram". Based on this parameter for example the ResolveMerger will choose a diff algorithm. The reason for this is bug 331078. This bug shows that JGit is more compatible with C Git when histogram diff is in place. But since histogram diff is quite new we need an easy way to fall back to Myers diff. Bug: 331078 Change-Id: I2549c992e478d991c61c9508ad826d1a9e539ae3 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Philipp Thun <philipp.thun@sap.com>
* Add more tests for rebase and externalized missing StringsChristian Halstrick2010-11-241-0/+99
| | | | | | | | Coverage tests showed that we are missing to test certain areas in the rebase command. Add the missing tests. Change-Id: Ia4a272d26cde7e1861dac30496e4b6799fc8187a Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Add CheckoutCommandChris Aniszczyk2010-11-221-0/+123
| | | | | | | | Add the ability to checkout a branch to the working tree. Bug: 330860 Change-Id: Ie06b9e799a9e1be384da0b8996efa7209b32eac3 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Merge "Fix bug regarding handling of non-versioned files during merge"Matthias Sohn2010-11-221-0/+50
|\
| * Fix bug regarding handling of non-versioned files during mergeChristian Halstrick2010-11-221-0/+50
| | | | | | | | | | | | | | | | | | | | | | There was a bug introduced by commit 0e815fe. For non-versioned files the merge algorithm detected an incoming deletion from THEIRS. Consequently such files were deleted. That's a severe bug which was fixed by more precisely detecting incoming deletions. Change-Id: I4385d3c990db11d62e371a385dc8ee89841db84a Signed-off-by: Christian Halstrick <christian.halstrick@sap.com> Signed-off-by: Philipp Thun <philipp.thun@sap.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Add RmCommand to Git APIChris Aniszczyk2010-11-221-0/+77
| | | | | | | | | | | | Bug: 330827 Change-Id: I0b74bb92254d0ee988139d25022d06d16ed89d58 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* | Initial implementation of a Rebase commandMathias Kinzler2010-11-221-0/+265
|/ | | | | | | | | | | This is a first iteration to implement Rebase. At the moment, this does not implement --continue and --skip, so if the first conflict is found, the only option is to --abort the command. Bug: 328217 Change-Id: I24d60c0214e71e5572955f8261e10a42e9e95298 Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Fixed checkouts when HEAD is ignoredChristian Halstrick2010-11-131-0/+84
| | | | | | | | | | | | | | In the case where DirCacheCheckout was used to checkout a tree without taking HEAD into account (e.g. during a clone or hard reset) we didn't handle conflicts correctly. E.g. if there are conflicts (entries with stage != 0) in the index and we tried to hard reset we have been processing the conflicting pathes multiple times (once for every stage). With this fix we will update the index with the entry from the "merge" state (the state we want checkout) when we detect existing conflicts. Change-Id: Iffbddccaa588cf0d1460a5e44dabaf540d996e26 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* Merge "Add simple unit tests for Base64"Chris Aniszczyk2010-11-131-0/+96
|\
| * Add simple unit tests for Base64Shawn O. Pearce2010-11-121-0/+96
| | | | | | | | | | Change-Id: I22ef1eb63ae8ddb9884526099013979856ab7bd9 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge "Split note leaf buckets at 256 elements"Chris Aniszczyk2010-11-131-0/+41
|\ \
| * | Split note leaf buckets at 256 elementsShawn O. Pearce2010-11-121-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Leaf level notes trees are split into a new fan-out tree if an insertion occurs and the tree already contains >= 256 notes in it. The splitting may occur multiple times if all of the notes have the same prefix; in the worst case this produces a tree path such as "00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/00/be" if all of the notes begin with zeros. Change-Id: I2d7d98f35108def9ec49936ddbdc34b13822a3c7 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merge "Allow writing a NoteMap back to the repository"Chris Aniszczyk2010-11-131-0/+106
|\| |
| * | Allow writing a NoteMap back to the repositoryShawn O. Pearce2010-11-121-0/+106
| | | | | | | | | | | | | | | | | | | | | | | | This is necessary to allow applications to wrap the note tree in a commit and update the note branch with the new state. Change-Id: Idbd7ead4a1b16ae2b64a30a4a01a29cfed548cdf Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merge "Add in-memory updating support to NoteMap"Chris Aniszczyk2010-11-132-0/+325
|\| |
| * | Add in-memory updating support to NoteMapShawn O. Pearce2010-11-122-0/+325
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NoteMap now supports editing in-memory, allowing applications to modify the NoteMap once it has been loaded from the branch. The ability to write the branch back to tree objects is not yet done, so the edits are strictly transient. Change-Id: I63448954abfca2a8e3e95369cd84c0d1176cdb79 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merge branch 'rename-detection'Shawn O. Pearce2010-11-121-9/+13
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | * rename-detection: RenameDetector: Only scan deletes if adds exist SimilarityRenameDetector: Initialize sizes to 0 SimilarityRenameDetector: Avoid allocating source index SimilarityRenameDetector: Only attempt to index large files once SimilarityIndex: Don't overflow internal counter fields SimilarityIndex: Accept files larger than 8 MB SimilarityIndex: Correct comment explaining the logic
| * | SimilarityIndex: Accept files larger than 8 MBShawn O. Pearce2010-11-121-9/+13
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Files bigger than 8 MB (2^23 bytes) tended to overflow the internal hashtable, as the table was capped in size to 2^17 records. If a file contained 2^17 unique data blocks/lines, the table insertion got stuck in an infinite loop as the able couldn't grow, and there was no open slot for the new item. Remove the artifical 2^17 table limit and instead allow the table to grow to be as big as 2^30. With a 64 byte block size, this permits hashing inputs as large as 64 GB. If the table reaches 2^30 (or cannot be allocated) hashing is aborted. RenameDetector no longer tries to break a modify file pair, and it does not try to match the file for rename or copy detection. Change-Id: Ibb4d756844f4667e181e24a34a468dc3655863ac Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* / Use capital L for long constantsRobin Rosenberg2010-11-121-8/+8
|/ | | | | Change-Id: Ib7b8c5f982dc72c68cf3d81e45a536c464837f7d Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
* Define NoteMap, a simple note tree readerShawn O. Pearce2010-11-112-0/+202
| | | | | | | | | | | | | | | | | | | | | | | | | The NoteMap makes it easy to read a small notes tree as created by the `git notes` command in C Git. To make the initial implementation simple a notes tree is read recursively into a map in memory. This is reasonable if the application will need to access all notes, or if there are less than 256 notes in the tree, but doesn't behave well when the number of notes exceeds 256 and the application doesn't need to access all of them. We can later add support for lazily loading different subpaths, thus fixing the large note tree problem described above. Currently the implementation only supports reading. Writing notes is more complex because trees need to be expanded or collapsed at the exact 256 entry cut-off in order to retain the same tree SHA-1 that C Git would use for the same content. It also needs to retain non-note tree entries such as ".gitignore" or ".gitattribute" files that might randomly appear within a notes tree. We can also add writing support later. Change-Id: I93704bd84ebf650d51de34da3f1577ef0f7a9144 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
* Merge "Add MutableObjectId setByte to modify a mutable id"Chris Aniszczyk2010-11-111-0/+29
|\
| * Add MutableObjectId setByte to modify a mutable idShawn O. Pearce2010-11-041-0/+29
| | | | | | | | | | | | | | | | | | This mirrors the getByte() API in ObjectId and allows the caller to modify a single byte, which is useful when updating it as part of a loop walking through 0x00..0xff inside of a range of objects. Change-Id: I57fa8420011fe5ed5fc6bfeb26f87a02b3197dab Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge "Add ObjectId getByte for random access"Chris Aniszczyk2010-11-101-1/+15
|\|
| * Add ObjectId getByte for random accessShawn O. Pearce2010-11-041-1/+15
| | | | | | | | | | | | | | | | | | | | | | Processing git notes requires random access to part of the raw data of each ObjectId... which isn't easy because ObjectIds are stored with an internal representation of 5 ints. Expose random access to the individual data bytes through new methods, avoiding the need to convert first to a byte[20]. Change-Id: I99e64700b27fc0c95aa14ef8ad46a0e8832d4441 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge "Fix broken MergeCommandTest"Shawn Pearce2010-11-091-2/+2
|\ \
| * | Fix broken MergeCommandTestMatthias Sohn2010-11-101-2/+2
| | | | | | | | | | | | | | | | | | | | | Test was broken by commit b087bba3 changing formatting of merge commit messages. Change-Id: I98b1b936b9b6cbaa50fbc59d243a43e66a6ee9f9 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | Fix URIish parsing of absolute scp-style URIsShawn O. Pearce2010-11-091-1/+13
|/ / | | | | | | | | | | | | | | | | | | We stopped handling URIs such as "example.com:/some/p ath", because this was confused with the Windows absolute path syntax of "c:/path". Support absolute style scp URIs again, but only when the host name is more than 2 characters long. Change-Id: I9ab049bc9aad2d8d42a78c7ab34fa317a28efc1a Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Merge "Format merge commit messages like C Git"Shawn Pearce2010-11-091-0/+155
|\ \
| * | Format merge commit messages like C GitRobin Stocker2010-11-061-0/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The automatically generated commit message of a merge should have the same structure as in C Git for consistency (as per git fmt-merge-msg). Before this change: merging refs/heads/a into refs/heads/master After: Merge branch 'a' Plurals, "into" and joining by "," and "and" also work. Change-Id: I9658ce2817adc90d2df1060e8ac508d7bd0571cb
* | | IndexDiff: support state [removed, untracked]Jens Baumgart2010-11-081-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | IndexDiff was extended to detect files which are both removed from the index and untracked. Before this change these files were only added to the removed collection. Change-Id: I971d8261d2e8932039fce462b59c12e143f79f90 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | | Merge "CommitAndLogCommandTests: add a test for LogCommand.addRange()"Chris Aniszczyk2010-11-081-0/+40
|\ \ \