aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Support core.fsyncObjectFiles optionShawn O. Pearce2010-11-122-7/+89
| | | | | | | | | | | | | | | | | | | | | | | Some repositories may be on really unstable filesystems, but still want to have good reliability when objects are written to disk. If core.fsyncObjectFiles is set to true, request the JVM to ensure the data is written before returning success to the caller of insert. The option defaults to false because it should be useless on any filesystem that orders writes and metadata, such as ext3 mounted with data=ordered (or data=journal). But it may be useful on some systems (especially HFS+) where file content may flush to the disk independently of filesystem structure changes. Because FileChannel.force(boolean) only claims to ensure data is written if it was written using the write(ByteBuffer) method of FileChannel, redirect all writes when using fsyncObjectFiles to go through the FileChannel interface instead of through the older style OutputStream interface. This may not be necessary on all JVMs, but its more portable to follow the definition than the common behavior. Change-Id: I57f6b6bb7e403c07fbae989dbf3758eaf5edbc78 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Simplify LockFile write(ObjectId) caseShawn O. Pearce2010-11-091-21/+4
| | | | | | | | | The ObjectId (for a ref) can be easily reformatted into a temporary byte[] and then passed off to write(byte[]), removing the duplicated code that existed in both write methods. Change-Id: I09740658e070d5f22682333a2e0d325fd1c4a6cb 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>
* | Merge "Revert "[findBugs] Silence DM_STRING_CTOR on PacketLineIn""Matthias Sohn2010-11-092-9/+2
|\ \
| * | Revert "[findBugs] Silence DM_STRING_CTOR on PacketLineIn"Shawn O. Pearce2010-11-082-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1e510ec20e0391010419b17e9a9095ad54941d3c. Instead work around the warning by defining our constant by constructing it through a StringBuilder. Change-Id: If139509e769d649609c62eff359ebaea5dd286b2 Signed-off-by: Shawn O. Pearce <spearce@spearce.org> CC: Matthias Sohn <matthias.sohn@sap.com> CC: Chris Aniszczyk <caniszczyk@gmail.com>
* | | Fix URIish parsing of absolute scp-style URIsShawn O. Pearce2010-11-092-8/+38
| |/ |/| | | | | | | | | | | | | | | | | 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-094-3/+336
|\ \
| * | Format merge commit messages like C GitRobin Stocker2010-11-064-3/+336
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge "IndexDiff: support state [removed, untracked]"Shawn Pearce2010-11-082-0/+34
|\ \ \ | | |/ | |/|
| * | IndexDiff: support state [removed, untracked]Jens Baumgart2010-11-082-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 "Make Repository.shortenRefName static"Shawn Pearce2010-11-083-5/+4
|\ \ \ | |/ / |/| / | |/
| * Make Repository.shortenRefName staticRobin Stocker2010-11-063-5/+4
| | | | | | | | | | | | The method has no reason to be non-static. Change-Id: I1c09e074395d49cee0e6e53679b499d1f0c351ea
* | Fixed help of Diff and ShowCommands commandsChristian Halstrick2010-11-083-3/+5
| | | | | | | | | | | | | | | | | | jgit.sh <command> --help was not working for the commands Diff and ShowCommands because of missing metaVar information. Missing information is added here. Change-Id: I0ab7e35006b6aa7d4326a634309dddfcdb78f2a6 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | Merge "CommitAndLogCommandTests: add a test for LogCommand.addRange()"Chris Aniszczyk2010-11-081-0/+40
|\ \
| * | CommitAndLogCommandTests: add a test for LogCommand.addRange()Mathias Kinzler2010-11-051-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | There were also some compiler warning due to empty catch blocks that were fixed. Change-Id: I165bcddcdfacd34f020d1b938a41954916eb106e Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
* | | Merge "[findBugs] Fix NP_LOAD_OF_KNOWN_NULL_VALUE"Chris Aniszczyk2010-11-071-1/+1
|\ \ \
| * | | [findBugs] Fix NP_LOAD_OF_KNOWN_NULL_VALUEMatthias Sohn2010-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code analyzer can't know that passing a value known to be null is not a problem. Hence better pass null explicitly instead of the parameters being null. Change-Id: I8db6f8014de6c00dd95974d60f61ecc66191e6d4 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Merge "[findBugs] Silence DM_STRING_CTOR on PacketLineIn"Chris Aniszczyk2010-11-071-0/+8
|\ \ \ \
| * | | | [findBugs] Silence DM_STRING_CTOR on PacketLineInMatthias Sohn2010-11-071-0/+8
| |/ / / | | | | | | | | | | | | | | | | | | | | We don't want to pool this String. Change-Id: I68bb1c57fac2e138eece4503ca5bda8f69261083 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | Merge "Implemented the git add commandline command."Chris Aniszczyk2010-11-073-5/+81
|\ \ \ \ | |/ / / |/| | |
| * | | Implemented the git add commandline command.Sasa Zivkov2010-11-073-5/+81
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | Implementation delegates all work to the AddCommand class and, therefore, supports only those options currently supported by the AddCommand which means: --update and the filepattern... arguments. Change-Id: I4827d37e08b4c988c2458d9ba60a61b6ad414d10 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* | / Fixed ResolveMerger regarding handling of deletionsChristian Halstrick2010-11-072-10/+68
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a bug in ResolveMerger which is one reason for bug 328841. If a merge was failing because of conflicts deletions where not handled correctly. Files which have to be deleted (because there was a non-conflicting deletion coming in from THEIRS) are not deleted. In the non-conflicting case we also forgot to delete the file but in this case we explicitly checkout in the end these files get deleted during that checkout. This is fixed by handling incoming deletions explicitly. Bug: 328841 Change-Id: I7f4c94ab54138e1b2f3fcdf34fb803d68e209ad0 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | Merge "Add a test for merging deleted files"Shawn Pearce2010-11-051-0/+52
|\ \
| * | Add a test for merging deleted filesChristian Halstrick2010-11-031-0/+52
| |/ | | | | | | | | | | | | | | | | The JGit merge algorithm or the Merge Command may have problems with handling deletions always correctly. Therefore one additional test is added to check this. Change-Id: Id6aa49136996b29047c340994fe7faba68858e8c Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* | Merge changes I8d77cb59,I2beb4db5Shawn Pearce2010-11-052-71/+63
|\ \ | | | | | | | | | | | | | | | * changes: Fixed merge algorithm regarding adjacent modifications Cleaned up MergeAlgorithmTest
| * | Fixed merge algorithm regarding adjacent modificationsChristian Halstrick2010-11-022-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit merge algorithm behaved differently from C Git when we had adjacent modifications. If line 9 was modified by OURS and line 10 by theirs then C Git will return a conflict while JGit was seeing this as independent modifications. This change is not only there to achieve compatibility, but there where also some really wrong merge results produced by JGit in the area of adjacent modifications. Change-Id: I8d77cb59e82638214e45b3cf9ce3a1f1e9b35c70 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
| * | Cleaned up MergeAlgorithmTestChristian Halstrick2010-11-021-67/+47
| |/ | | | | | | | | | | | | | | Introduced similar helper methods than in AbstractDiffTestCase. Then the test cases are much smaller and better understandable. Change-Id: I2beb4db5a93bd8c0c1238d5d3039cbd6719eee90 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>
* / Fixed the git init to properly set bare=trueSasa Zivkov2010-11-051-0/+3
|/ | | | | | | | | When --git-dir=X is given JGit creates a bare repository in the directory X. However, when the --bare option is not explicitly given, this is not properly reflected in the X/config file i.e. the bare=true is missing. This change fixes this minor issue. Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
* Merge "Exclude FindBugs warning about uninitialized read"Shawn Pearce2010-11-011-0/+7
|\
| * Exclude FindBugs warning about uninitialized readRobin Stocker2010-11-011-0/+7
| | | | | | | | | | | | This gets rid of the "Uninitialized read of blockIndex" warning. Change-Id: Ieb31b5059d7b9a6adff2251baf179bda5f82e7a5
* | Fix ugly diff showing insertion of new methodShawn O. Pearce2010-11-012-1/+25
| | | | | | | | | | | | | | | | | | | | | | When adding a new method near the end of the sequence we want to show the full method inserted, and not tear the prior method due to the common trailing curly brace being consumed as part of the common end region of the sequences. Bug: 328895 Change-Id: I233bc40445fb5452863f5fb082bc3097433a8da6 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Delete DiffPerformanceTestShawn O. Pearce2010-11-014-352/+6
| | | | | | | | | | | | | | | | | | | | | | This test isn't that useful. The better way to evaluate diff algorithm performance is to run `jgit debug-diff-algorithms` over real-world repositories, such as linux-2.6.git. Whenever we modify an algorithm we should manually verify that its runtime performance doesn't get any worse than it already is. Change-Id: I0beed3a5a8a537c958a5a6438a1283f97fa2097a Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | Fix broken HistogramDiffShawn O. Pearce2010-11-012-11/+39
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HistogramDiff failed on cases where the initial element for the LCS was actually very common (e.g. has 20 occurrences), and the first element of the inserted region after the LCS was also common but had fewer occurrences (e.g. 10), while the LCS also contained a unique element (1 occurrence). This happens often in Java source code. The initial element for the LCS might be the empty line ("\n"), and the inserted but common element might be "\t/**\n", with the LCS being a large span of lines that contains unique method declarations. Even though "/**" occurs less often than the empty line its not a better LCS if the LCS we already have contains a unique element. The logic in HistogramDiff would normally have worked fine, except I tried to optimize scanning of B by making tryLongestCommonSequence return the end of the region when there are matching elements found in A. This allows us to skip over the current LCS region, as it has already been examined, but caused us to fail to identify an element that had a lower occurrence count within the region. The solution used here is to trade space-for-time by keeping a table of A positions to their occurrence counts. This allows the matching logic to always use the smallest count for this region, even if the smallest count doesn't appear on the initial element. The new unit test testEdit_LcsContainsUnique() verifies this new behavior works as expected. Bug: 328895 Change-Id: Id170783b891f645b6a8cf6f133c6682b8de40aaf Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Correct typo in HistogramDiffIndex JavadocShawn O. Pearce2010-10-291-1/+1
| | | | | Change-Id: I8bd2e81fcc14aa86919c504f1d0001944dea50b2 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Merge "Exclude FindBugs warnings about Cloneable"Shawn Pearce2010-10-291-0/+7
|\
| * Exclude FindBugs warnings about CloneableRobin Stocker2010-10-291-0/+7
| | | | | | | | | | | | | | This was already disabled in the Eclipse preferences for the project. With this, Hudson should also ignore it. Change-Id: I7a6b9a20451dc5ba9a61553248b5f4b6c6c7a78b
* | Merge "Remove two "Dead store to local variable" warnings"Shawn Pearce2010-10-292-2/+1
|\ \
| * | Remove two "Dead store to local variable" warningsRobin Stocker2010-10-292-2/+1
| |/ | | | | | | Change-Id: I950de82db15c4610dc5a94f304279971daef971e
* | Merge "Use entrySet() instead of keySet()"Shawn Pearce2010-10-291-2/+3
|\ \
| * | Use entrySet() instead of keySet()Robin Stocker2010-10-291-2/+3
| |/ | | | | | | | | | | | | The value was accessed every time in the loop body with get(), so use the more efficient entrySet(). Change-Id: I91d90cbd0b0d03ca4a3db986c58b8d80d80f40a4
* | Merge "Use readFully() instead of read()"Shawn Pearce2010-10-291-1/+1
|\ \
| * | Use readFully() instead of read()Robin Stocker2010-10-291-1/+1
| |/ | | | | | | | | | | | | | | | | | | Fixes the "Method ignores results of InputStream.read()" warning. This is the only place where read() was used instead of readFully() and the return value was not checked. So it was either an oversight or should be documented. This change assumes it was an oversight. Change-Id: I859404a7d80449c538a552427787f3e57d7c92b4
* | Merge "Use Character.valueOf instead of new Character"Shawn Pearce2010-10-291-1/+1
|\ \
| * | Use Character.valueOf instead of new CharacterRobin Stocker2010-10-291-1/+1
| |/ | | | | | | | | | | | | Otherwise a new Character is allocated each time instead of using the cache. Change-Id: I648d0b012f66ba9dc46a37a390986f9c61e5a19c
* | Merge "Remove unnecessary null check"Shawn Pearce2010-10-291-2/+1
|\ \
| * | Remove unnecessary null checkRobin Stocker2010-10-291-2/+1
| |/ | | | | | | | | | | | | The field monitor is never null, it's a NullProgressMonitor when not explicitly set. Change-Id: I8ce703a32c28ce5c3455efeb7ed5f5c9a443cbef
* / Make private final field staticRobin Stocker2010-10-291-1/+1
|/ | | | | | It's used as a constant. Change-Id: Ic267e8cb5b62228de15e134cd80725df592a0171
* Merge "Fix Severe Bug in Merge Algorithm"Shawn Pearce2010-10-282-8/+30
|\
| * Fix Severe Bug in Merge AlgorithmChristian Halstrick2010-10-282-8/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As described in Bug 328551 there was a bug that the merge algorithm was not always reporting conflicts when the same line was deleted and modified. This problem was introduced during commit 0c017188b4d41cc80c297e35097095026734b3d4 when reported conflicts have been checked for common pre- and suffixes. This was fixed here by better determining whether after stripping off common prefixes and suffixes from a conflicting region there is still some conflicting part left. I also added a unit test to test this situation. Bug: 328551 Change-Id: Iec6c9055d00e5049938484a27ab98dda2577afc4 Signed-off-by: Christian Halstrick <christian.halstrick@sap.com>