summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
Commit message (Collapse)AuthorAgeFilesLines
* Fix pack files scan when filesnapshot isn't modifiedLuca Milanesio2019-04-091-1/+48
| | | | | | | | | | | | | | | Do not reload packfiles when their associated filesnapshot is not modified on disk compared to the one currently stored in memory. Fix the regression introduced by fef78212 which, in conjunction with core.trustfolderstats = false, caused any lookup of objects inside the packlist to loop forever when the object was not found in the pack list. Bug: 546190 Change-Id: I38d752ebe47cefc3299740aeba319a2641f19391 Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Include size when comparing FileSnapshotLuca Milanesio2019-03-121-1/+35
| | | | | | | | | | | | | Due to finite filesystem timestamp resolution the last modified timestamp of files cannot detect file changes which happened in the immediate past (less than one filesystem timer tick ago). Read and consider file size also, so that differing file size can help to more accurately detect file changes without reading the file content. Use bulk read to avoid multiple stat calls to retrieve file attributes. Change-Id: I974288fff78ac78c52245d9218b5639603f67a46 Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Temporarily @Ignore flaky CommitCommandTest methodsDave Borowitz2018-06-191-0/+3
| | | | | | Change-Id: Ia2c42d014323bd29b85bf76f1a20c83f612406d7 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> (cherry picked from commit e93b0026ced10c956e76daed038f2560a33b5baf)
* Fix exception handling for opening bitmap index filesChristian Halstrick2017-08-141-0/+103
| | | | | | | | | | | | | | | | | | | | When creating a new PackFile instance it is specified whether this pack has an associated bitmap index file or not. This information is cached and the public method getBitmapIndex() will always assume a bitmap index file must exist if the cached data tells so. But it may happen that the packfiles are repacked during a gc in a different process causing the packfile, bitmap-index and index file to be deleted. Since JGit still has an open FileHandle on the packfile this file is not really deleted and can still be accessed. But index and bitmap index file are deleted. Fix getBitmapIndex() to invalidate the cached packfile instance if such a situation occurs. This problem showed up when a gerrit server was serving repositories which where garbage collected with native git regularly. Fetch and clone commands for certain repositories failed permanently after a native git gc had deleted old bitmap index files. Change-Id: I8e620bec74dd3f310ba42024f9a657062f868f0e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix eviction of repositories with negative usage countHugo Arès2016-10-121-0/+21
| | | | | | | | | | If the repository close method was called twice (or more) for one open, the usage count became negative and the repository was never be evicted from the cache because the method checking if repository is expired was not considering negative usage count. Change-Id: I18a80c415c54c37d1b9def2b311ff2d0afa455ca Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
* Fix carrying over flags during a RevWalkChristian Halstrick2016-09-231-0/+146
| | | | | | | | | | | | | | | | | | | | | There was a bug when carrying over flags from a merge commit to its non-first parents. The first parent of a merge commit was handled differently and correct but the non-first parents are handled by a recursive algorithm. Flags should be copied from the root merge commit to parent-2, to grandparent-2, ... up to the limit of STACK_DEPTH==500 parents-levels. But the recursive algorithm was always copying only to the direct parents of the merge commit and not the grand*-parents. This seems to be no problem when commits are handled in a strict date order because then copying only one level is no problem if children are handled before parents. But when commits are not seperated anymore by distinctive correct dates (e.g. because all commits have the same date) then it may happen that a merge-parent is handled before the merge commit and when dealing later with the merge commit one has to copy flags down to more than one level Bug: 501211 Change-Id: I2d79a7cf1e3bce21a490905ccd9d5e502d7b8421
* Handle all values of branch.[name].rebaseThomas Wolf2016-09-152-37/+58
| | | | | | | | | | | | | | | | | BranchConfig treated this config property as a boolean, but git also allows the values "preserve" and "interactive". Config property pull.rebase also allows the same values. Replace private enum PullCommand.PullRebaseMode by new public enum BranchConfig.BranchRebaseMode and adapt all uses. Add a new setter to PullCommand. Note: PullCommand will treat "interactive" like "true", i.e., as a non-interactive rebase. Not sure how "interactive" should be handled. At least it won't balk on it. Bug: 499482 Change-Id: I7309360f5662b2c2efa1bd8ea6f112c63cf064af Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Ignore trailing spaces in directory rule patternsAndrey Loskutov2016-09-143-1/+43
| | | | | | Bug: 500967 Change-Id: I7fabc2654af97011c62f46d5c30ee992341e45e2 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Add support for post-commit hooksMartin Goellnitz2016-09-131-0/+62
| | | | | Change-Id: I6691b454404dd4db3c690ecfc7515de765bc2ef7 Signed-off-by: Martin Goellnitz <m.goellnitz@outlook.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Don't log error if system git config does not existMatthias Sohn2016-09-051-0/+13
| | | | | | | | | | - enhance FS.readPipe to throw an exception if the external command fails to enable the caller to handle the command failure - reduce log level to warning if system git config does not exist - improve log message Bug: 476639 Change-Id: I94ae3caec22150dde81f1ea8e1e665df55290d42 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Rename FSJava7Test to FSTestMatthias Sohn2016-09-031-1/+1
| | | | | | | Since 4.0 JGit does no longer support Java versions older than Java 7 so there is no need anymore to mention Java 7 in the class name. Change-Id: Ic46c9d89a7e919ae4a69487fa06de0478d2b21f0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* ReceivePack: refactor push option parsingShawn Pearce2016-08-261-10/+8
| | | | | | | | | | | | | Refactor all of the push option support code to allocate the list immediately before parsing the options section off the stream. Move option support down to ReceivePack instead of BaseReceivePack. Push options are specific to the ReceivePack protocol and are not likely to appear in the 4 year old subscription proposal. These changes are OK before JGit 4.5 ships as no consumer should be relying on these new APIs. Change-Id: Ib07d18c877628aba07da07cd91875f918d509c49
* Fix push option initalization on HTTPStefan Beller2016-08-261-1/+1
| | | | | | | | | | | Initialize pushOptions when we decide to use them, instead of when we advertise them. In the case of HTTP the advertisement is in a different network request, hence in a different instance of the BaseReceivePack. Change-Id: I094c60942e04de82cb6d8433c9cd43a46ffae332 Signed-off-by: Stefan Beller <sbeller@google.com>
* Clarify the semantics of DfsRefDatabase#compareAndPutMasaya Suzuki2016-08-251-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | DfsRefDatabase#compareAndPut had a vague semantics for reference matching. Because of this, an operation to make a symbolic reference had been broken for some DFS implementations even if they followed the contract of compareAndPut. The clarified semantics requires the implementations to satisfy the followings: * Matching references should be both symbolic references or both object ID references. * If both are symbolic references, both should have the same target name. * If both are object ID references, both should have the same object ID. This semantics is defined based on https://git.eclipse.org/r/#/c/77416/. Before this commit, DfsRefDatabase couldn't see the target of symbolic references. InMemoryRepository is changed to comply with the new semantics. This semantics change can affect the existing DFS implementations that only checks object IDs. This commit adds two tests that the previous InMemoryRepository couldn't pass. Change-Id: I6c6b5d3cc8241a81f4a37782381c88e8a59fdf15 Signed-off-by: Masaya Suzuki <masayasuzuki@google.com>
* NoteMapTest: Add missing @Test annotationsDave Borowitz2016-08-261-1/+7
| | | | | | | | | | The RepositoryTestCase hierarchy no longer comes from TestCase, so all test methods must have @Test. Fix one test that was broken but never run; fortunately this was just a typo in the test code. Change-Id: I3ac8ccdab5e2d5539c63d7b0a88d8bdb0c5ff66e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Use FS#lastModified instead of File#lastModifiedMasaya Suzuki2016-08-243-15/+18
| | | | | | | | | | | | | | | This fixes the tests failed in JDK8. FS uses java.nio API to get file attributes. The timestamps obtained from that API are more precise than the ones from java.io.File#lastModified() since Java8. This difference accidentally makes JGit detect newly added files as smudged. Use the precised timestamp to avoid this false positive. Bug: 500058 Change-Id: I9e587583c85cb6efa7562ad6c5f26577869a2e7c Signed-off-by: Masaya Suzuki <masayasuzuki@google.com> Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
* Enhance ResetCommand to allow disabling reflog updateMatthias Sohn2016-08-171-0/+40
| | | | | | | This will be used by EGit for implementing commit amend in the staging view (see Idcd1efeeee8b3065bae36e285bfc0af24ab1e88f). Change-Id: Ice9ebbb1c0c3314c679f4db40cdd3664f61c27c3 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge "Skip cleaning inner repositories by default in CleanCommand"Christian Halstrick2016-08-071-0/+40
|\
| * Skip cleaning inner repositories by default in CleanCommandMatthaus Owens2016-08-041-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously jgit would attempt to clean git repositories that had not been committed by calling a non-recursive delete on them, which would fail as they are directories. This commit addresses that issue in the following ways. Repositories are skipped in a default clean, similarly to cgit and only cleaned when the force flag is applied. When the force flag is applied repositories are deleted using a recursive delete call. The force flag and setForce method are added here to CleanCommand to support this change. Bug: 498367 Change-Id: Ib6cfff65a033d0d0f76395060bf76719e13fc467 Signed-off-by: Matthaus Owens <matthaus@puppetlabs.com>
* | Merge "Add testCleanDirsWithSubmodule test to CleanCommandTest"Christian Halstrick2016-08-071-0/+28
|\|
| * Add testCleanDirsWithSubmodule test to CleanCommandTestMatthaus Owens2016-08-041-0/+28
| | | | | | | | | | | | | | | | | | This commit adds some test coverage to cleaning a repository with a submodule, which did not previously exist. Bug: 498367 Change-Id: Ia5c4e4cc53488800dd486f8556dc57656783f1c4 Signed-off-by: Matthaus Owens <matthaus@puppetlabs.com>
* | Shallow fetch/clone: Make --depth mean the total history depthTerry Parker2016-08-051-7/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cgit changed the --depth parameter to mean the total depth of history rather than the depth of ancestors to be returned [1]. JGit still uses the latter meaning, so update it to match cgit. depth=0 still means a non-shallow clone. depth=1 now means only the wants rather than the wants and their direct parents. This is accomplished by changing the semantic meaning of "depth" in UploadPack and PackWriter to mean the total depth of history desired, while keeping "depth" in DepthWalk.{RevWalk,ObjectWalk} to mean the depth of traversal. Thus UploadPack and PackWriter always initialize their DepthWalks with "depth-1". [1] upload-pack: fix off-by-one depth calculation in shallow clone https://code.googlesource.com/git/+/682c7d2f1a2d1a5443777237450505738af2ff1a Change-Id: I87ed3c0f56c37e3491e367a41f5e555c4207ff44 Signed-off-by: Terry Parker <tparker@google.com>
* | Shallow fetch: Respect "shallow" linesTerry Parker2016-08-051-22/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When fetching from a shallow clone, the client sends "have" lines to tell the server about objects it already has and "shallow" lines to tell where its local history terminates. In some circumstances, the server fails to honor the shallow lines and fails to return objects that the client needs. UploadPack passes the "have" lines to PackWriter so PackWriter can omit them from the generated pack. UploadPack processes "shallow" lines by calling RevWalk.assumeShallow() with the set of shallow commits. RevWalk creates and caches RevCommits for these shallow commits, clearing out their parents. That way, walks correctly terminate at the shallow commits instead of assuming the client has history going back behind them. UploadPack converts its RevWalk to an ObjectWalk, maintaining the cached RevCommits, and passes it to PackWriter. Unfortunately, to support shallow fetches the PackWriter does the following: if (shallowPack && !(walk instanceof DepthWalk.ObjectWalk)) walk = new DepthWalk.ObjectWalk(reader, depth); That is, when the client sends a "deepen" line (fetch --depth=<n>) and the caller has not passed in a DepthWalk.ObjectWalk, PackWriter throws away the RevWalk that was passed in and makes a new one. The cleared parent lists prepared by RevWalk.assumeShallow() are lost. Fortunately UploadPack intends to pass in a DepthWalk.ObjectWalk. It tries to create it by calling toObjectWalkWithSameObjects() on a DepthWalk.RevWalk. But it doesn't work: because DepthWalk.RevWalk does not override the standard RevWalk#toObjectWalkWithSameObjects implementation, the result is a plain ObjectWalk instead of an instance of DepthWalk.ObjectWalk. The result is that the "shallow" information is thrown away and objects reachable from the shallow commits can be omitted from the pack sent when fetching with --depth from a shallow clone. Multiple factors collude to limit the circumstances under which this bug can be observed: 1. Commits with depth != 0 don't enter DepthGenerator's pending queue. That means a "have" cannot have any effect on DepthGenerator unless it is also a "want". 2. DepthGenerator#next() doesn't call carryFlagsImpl(), so the uninteresting flag is not propagated to ancestors there even if a "have" is also a "want". 3. JGit treats a depth of 1 as "1 past the wants". Because of (2), the only place the UNINTERESTING flag can leak to a shallow commit's parents is in the carryFlags() call from markUninteresting(). carryFlags() only traverses commits that have already been parsed: commits yet to be parsed are supposed to inherit correct flags from their parent in PendingGenerator#next (which doesn't happen here --- that is (2)). So the list of commits that have already been parsed becomes relevant. When we hit the markUninteresting() call, all "want"s, "have"s, and commits to be unshallowed have been parsed. carryFlags() only affects the parsed commits. If the "want" is a direct parent of a "have", then it carryFlags() marks it as uninteresting. If the "have" was also a "shallow", then its parent pointer should have been null and the "want" shouldn't have been marked, so we see the bug. If the "want" is a more distant ancestor then (2) keeps the uninteresting state from propagating to the "want" and we don't see the bug. If the "shallow" is not also a "have" then the shallow commit isn't parsed so (2) keeps the uninteresting state from propagating to the "want so we don't see the bug. Here is a reproduction case (time flowing left to right, arrows pointing to parents). "C" must be a commit that the client reports as a "have" during negotiation. That can only happen if the server reports it as an existing branch or tag in the first round of negotiation: A <-- B <-- C <-- D First do git clone --depth 1 <repo> which yields D as a "have" and C as a "shallow" commit. Then try git fetch --depth 1 <repo> B:refs/heads/B Negotiation sets up: have D, shallow C, have C, want B. But due to this bug B is marked as uninteresting and is not sent. Change-Id: I6e14b57b2f85e52d28cdcf356df647870f475440 Signed-off-by: Terry Parker <tparker@google.com>
* | Shallow fetch: avoid sending unneeded blobsTerry Parker2016-08-041-3/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When doing an incremental fetch from JGit, "have" commits are marked as "uninteresting". In a non-shallow fetch, when the RevWalk hits an "uninteresting" commit it marks the commit's corresponding tree as uninteresting. That has the effect of dropping those trees and all the trees and blobs they reference out of the thin pack returned to the client. However, shallow fetches use a DepthWalk to limit the RevWalk, which nearly always causes the RevWalk to terminate before encountering the "have" commits. As a result the pack created for the incremental fetch never encounters "uninteresting" tree objects and thus includes duplicate objects that it knows the client already has. Change-Id: I7b1f7c3b0d83e04d34cd2fa676f1ad4fec904c05 Signed-off-by: Terry Parker <tparker@google.com>
* | PackWriterTest: Improve readabilityTerry Parker2016-08-041-10/+17
|/ | | | | | | | Add wants() and haves() static utility functions to improve readability. Change-Id: I4d44e17a9af97c0203e2ebe112eabb1f67d272a6 Signed-off-by: Terry Parker <tparker@google.com>
* Merge branch 'stable-4.4'David Pursehouse2016-07-261-0/+14
|\ | | | | | | | | | | | | | | | | * stable-4.4: JGit v4.4.1.201607150455-r RefDirectory: remove ref lock file for following ref dir removal Change-Id: Ifc8a782efd7f2f991e70ad2a3691a8dba66c7554 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
| * Merge "RefDirectory: remove ref lock file for following ref dir removal" ↵Christian Halstrick2016-07-151-0/+14
| |\ | | | | | | | | | into stable-4.4
| | * RefDirectory: remove ref lock file for following ref dir removalMarco Miller2016-06-101-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this fix, ref directory removal did not work. That was because the ref lock file was still in the leaf directory at deletion time. Hence no deep ref directories were ever deleted, which negatively impacted performance under large directory structure circumstances. This fix removes the ref lock file before attempting to delete the ref directory (which includes it). The other deep parent directories are therefore now successfully deleted in turn, since leaf's content (lock file) gets removed first. So, given a structure such as refs/any/directory[/**], this fix now deletes all empty directories up to -and including- 'directory'. The 'any' directory (e.g.) does not get deleted even if empty, as before. The ref lock file is still also removed in the calling block's finally clause, just in case, as before. Such double-unlock brought by this fix is harmless (a no-op). A new (private) RefDirectory#delete method is introduced to support this #pack-specific case; other RefDirectory#delete callers remain untouched. Change-Id: I47ba1eeb9bcf0cb93d2ed105d84fea2dac756a5a Signed-off-by: Marco Miller <marco.miller@ericsson.com>
* | | RefSpecs: allow construction of weird wildcarded RefSpecsStefan Beller2016-07-251-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gerrit's superproject subscription feature uses RefSpecs to formalize the ACLs of when the superproject subscription feature is allowed. As this is a slightly different use case than describing a local/remote pair of refs, we need to be more permissive. Specifically we want to allow: refs/heads/* refs/heads/*:refs/heads/master refs/heads/master:refs/heads/* Introduce a new constructor, that allows constructing these RefSpecs. Change-Id: I46c0bea9d876e61eb2c8d50f404b905792bc72b3 Signed-off-by: Stefan Beller <sbeller@google.com>
* | | RefSpec: reject refs ending in '/'Stefan Beller2016-07-251-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had a case in Gerrits superproject subscriptions where 'refs/heads/' was configured with the intention to mean 'refs/heads/*'. The first expression lacks the '*', which is why it is not considered a wildcard but it was considered valid and so was not found early to be a typo. Refs are not allowed to end with '/' anyway, so add a check for that. Change-Id: I3ffdd9002146382acafb4fbc310a64af4cc1b7a9 Signed-off-by: Stefan Beller <sbeller@google.com>
* | | Push implementation of option stringsDan Wang2016-07-221-0/+363
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example usage: $ ./jgit push \ --push-option "Reviewer=j.doe@example.org" \ --push-option "<arbitrary string>" \ origin HEAD:refs/for/master Stefan Beller has also made an equivalent change to CGit: http://thread.gmane.org/gmane.comp.version-control.git/299872 Change-Id: I6797e50681054dce3bd179e80b731aef5e200d77 Signed-off-by: Dan Wang <dwwang@google.com>
* | | Merge branch 'stable-4.4'Matthias Sohn2016-07-123-7/+198
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.4: Log if Repository.useCnt becomes negative Time based eviction strategy for repository cache Add method to read time unit from config Align include.path max depth with native git Config load should not fail on unsupported or nonexistent include path Allow using JDK 7 bootclasspath when compiling JGit using Java 8 Extract work queue to allow reusing it Change-Id: I6aeedb1cb8b0c3068af344a719c80a03ae68fc23 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Time based eviction strategy for repository cacheChristian Halstrick2016-07-122-4/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Repository.close() decrements the useCount to 0 currently the cache immediately evicts the repository from WindowCache and RepositoryCache. This leads to I/O overhead on busy repositories because pack files and references are inserted and deleted from the cache frequently. This commit defers the eviction of a repository from the caches until last use of the repository is older than time to live. The eviction is handled by a background task running periodically. Add two new configuration parameters: * core.repositoryCacheExpireAfter: cache entries are evicted if the cache entry wasn't accessed longer than this time in milliseconds * core.repositoryCacheCleanupDelay: defines the interval in milliseconds for running a background task evicting expired cache entries. If set to -1 the delay is set to min(repositoryCacheExpireAfter, 10 minutes). If set to 0 the time based eviction is switched off and no background task is started. If time based eviction is switched off the JVM can still evict cache entries if heap memory is running low. Change-Id: I4a0214ad8b4a193985dda6a0ade63b70bdb948d7 Also-by: Matthias Sohn <matthias.sohn@sap.com> Also-by: Hugo Arès <hugo.ares@ericsson.com> Also-by: Sasa Zivkov <sasa.zivkov@sap.com>
| * | Add method to read time unit from configHugo Arès2016-07-121-0/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time units supported: -milliseconds (1 ms, 2 milliseconds) -seconds (1 s, 1 sec, 1 second, 2 seconds) -minutes (1 m, 1 min, 1 minute, 2 minutes) -hours (1 h, 1 hr, 1 hour, 2 hours) -days (1 d, 1 day, 2 days) -weeks (1 w, 1 week, 2 weeks) -months (1 mon, 1 month, 2 months) -years (1 y, 1 year, 2 years) This functionality is implemented in Gerrit ConfigUtil class. Add it to JGit so it can eventually be remove from Gerrit. Change-Id: I2d6564ff656b6ab9424a9360624061c94fd5f413 Signed-off-by: Hugo Arès <hugo.ares@ericsson.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Config load should not fail on unsupported or nonexistent include pathHugo Arès2016-06-271-3/+24
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1f86350 added initial support for include.path. Relative path and path with tilde are not yet supported but config load was failing if one of those 2 unsupported options was encountered. Another problem was that config load was failing if the include.path file did not exist. Change the behavior to be consistent with native git. Ignore unsupported or nonexistent include.path. Bug: 495505 Bug: 496732 Change-Id: I7285d0e7abb6389ba6983e9c46021bea4344af68 Signed-off-by: Hugo Arès <hugo.ares@ericsson.com>
* | Fix unclosed resource warnings in FileTreeIteratorTestMatthias Sohn2016-07-071-29/+30
| | | | | | | | Change-Id: I75ea7deca64a707cd6b5c61c3c83062f20041684 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | ReceivePack: report protocol parsing failures on channel 3Shawn Pearce2016-07-051-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the client sent a well-formed enough request to see it wants to use side-band-64k for status reporting (meaning its a modern client), but any other command record was somehow invalid (e.g. corrupt SHA-1) report the parsing exception using channel 3. This allows clients to see the failure and know the server will not be continuing. git-core and JGit clients send all commands and then start a sideband demux before sending the pack. By consuming all commands first we get the client into a state where it can see and respond to the channel 3 server failure. This behavior is useful on HTTPS connections when the client is buggy and sent a corrupt command, but still managed to request side-band-64k in the first line. Change-Id: If385b91ceb9f024ccae2d1645caf15bc6b206130
* | PushConnectionTest: Use Java 7 try-with-resourcesShawn Pearce2016-07-051-10/+3
| | | | | | | | Change-Id: I429066d2af9c5fb8bf8bc038b99ebe5a7dc09170
* | Enhance test coverage when core.filemode is falseChristian Halstrick2016-07-011-48/+30
| | | | | | | | | | | | | | Some branches in WorkingTreeIterator.getIndexFileMode() have not been covered by tests. Enhance the tests to increase test coverage. Change-Id: I400a221048f0f6cbaa987350eaf998b0ebb50a4e
* | Merge changes from topic 'dfs-gc'Shawn Pearce2016-06-271-0/+239
|\ \ | | | | | | | | | | | | | | | | | | | | | * changes: Prune UNREACHABLE_GARBAGE packs when they expire Use try-with-resources in DfsGarbageCollector.writePack Fix lastModified to be consistent in DfsGarbageCollector Add GC_REST PackSource to better order DFS packs
| * | Prune UNREACHABLE_GARBAGE packs when they expireMike Williams2016-06-271-0/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DfsGarbageCollector will now enforce a maximum time to live (TTL) for UNREACHABLE_GARBAGE packs. The default TTL is 1 day, which should be enough time to avoid races with other processes that are inserting data into the repository. Change-Id: Id719e6e2a03cfc9a0c0aef8ed71d261dda14bd0c Signed-off-by: Mike Williams <miwilliams@google.com>
* | | Fix TreeWalk to reset attributes cache for each entryChristian Halstrick2016-06-231-0/+23
|/ / | | | | | | | | | | | | | | | | | | Treewalk has a member 'attr' which caches the attributes for the current entry. We did not reset the cache always when moving to next entry. The effect was that when there are no attributes for an entry 'a' but 'a' was skipped by a Treewalk filter then Treewalk stopped looking for attributes until TreeWalk.next() was called again. Change-Id: Ied39b7fb5f56afe7a237da17801003d0abe6b1c7
* | Fix DirCacheCheckout to return CheckoutConflictExceptionChristian Halstrick2016-06-231-0/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem occurs when the checkout wants to create a file 'd/f' but the workingtree contains a dirty file 'd'. In order to create d/f the file 'd' would have to be deleted and since the file is dirty that content would be lost. This should lead to a CheckoutConflictException for d/f when failOnConflict was set to true. This fix also changes jgit checkout semantics to be more like native gits checkout semantics. If during a checkout jgit wants to delete a folder but finds that the working tree contains a dirty file at this path then JGit will now throw an exception instead of silently keeping the dirty file. Like in this example: git init touch b git add b git commit -m addB mkdir a touch a/c git add a/c git commit -m addAC rm -fr a touch a git checkout HEAD~ Change-Id: I9089123179e09dd565285d50b0caa308d290cccd Signed-off-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de> Also-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>
* | Optimize RefAdvertiser for wire protocolShawn Pearce2016-06-181-0/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | The native wire protocol sends ref advertisements in the pkt-line format, which requires encoding the ObjectId and ref name onto a byte sequence. Busy servers show this is a very high source of garbage, which pushes the garbage collector harder when there are many refs in the repository (e.g. 70k, in a Gerrit managed repository). Optimize the side band advertiser by retaining the CharsetEncoder, minimizing the amount of temporary garbage built during encoding. Change-Id: I406c654bf82c1eb94b38862da2425e98396134cb
* | Merge branch 'stable-4.4'Matthias Sohn2016-06-141-7/+49
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.4: Prepare 4.4.1-SNAPSHOT builds JGit v4.4.0.201606070830-r Prepare 4.4.0-SNAPSHOT builds JGit v4.4.0.201606011500-rc2 Prepare 4.4.0-SNAPSHOT builds JGit v4.4.0.201605250940-rc1 Update Orbit repository for Neon to R20160520211859 Fix computation of id in WorkingTreeIterator with autocrlf and smudging Prepare 4.3.2-SNAPSHOT builds JGit v4.3.1.201605051710-r Prepare 4.4.0-SNAPSHOT builds JGit v4.4.0.201605041135-m1 Run Maven build in release.sh concurrently to speedup release Change-Id: I25ef0497a4455b8229b453e1023abb4631d4b6d3 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Merge branch 'master' into stable-4.4Matthias Sohn2016-06-012-3/+97
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: Fix javadoc errors and unused imports introduced by ddd0fe25 RepoCommand: record manifest shallow recommendation in .gitmodules RepoCommand: record manifest groups as submodule labels Remove the deprecated TestRepository.getClock() method Replace use of deprecated method Repository.getRef() [findBugs] Prevent potential NPE in FileLfsRepository.getOutputStream() Better report on client side if push failed due to too large object [findBugs] Prevent potential NPE in CloneCommand.init() RepoCommand: remove --record-remote-branches RepoCommandTest: Improve assertion message for remote branch recording Change-Id: I4fbce4f84925a933fcc9a48058ed6793f5821b97 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * \ Merge branch 'master' into stable-4.4Matthias Sohn2016-05-245-1/+260
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: JGit CLI: allow to call git init with specific directory Redirect all Show output to outs Support git config [include] section with absolute path(s) Added filter for merge and non-merges commits. [findBugs] Prevent potential NPE in FS_POSIX.readUmask() [findBugs] Fix calculation of host header in SignerV4 Update Orbit repository to S20160518051658 for Neon RC2 Fix StashApply regarding handling of untracked files GC should not pack objects only referenced by ORIG_HEAD,... Make sure to overwrite files when "reset --hard" detects conflicts Allow setting FileMode to executable when applying patches in ApplyCommand Fix config value get to return last instead of 1st just like git Remove UTF-8 checking duplication in Config lib subclasses Update Maven plugins Fix type parameter in javadoc in TestRepository.delete(String ref) TestRepository: Add delete() method Make BaseReceivePack.setAtomic public ReceivePack: Pass atomic setting from client to BatchRefUpdate Change-Id: I5c9c5b7ccb23fb48b44b3da10b2c5d876d043d24 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * \ \ Merge branch 'stable-4.3' into stable-4.4Matthias Sohn2016-05-243-24/+79
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-4.3: Fix computation of id in WorkingTreeIterator with autocrlf and smudging Prepare 4.3.2-SNAPSHOT builds JGit v4.3.1.201605051710-r Scan loose ref before packed in case gc about to remove the loose Fix possible NPEs when reporting transport errors Fix calling of clean/smudge filters from Checkout,MergeCommands Fix ApplyCommand when result of patch is an empty file Change-Id: I829f06699f6670e519d04c927bdba4b82df29199 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * | | Fix computation of id in WorkingTreeIterator with autocrlf and smudgingChristian Halstrick2016-05-231-7/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JGit failed to do checkouts when the index contained smudged entries and autocrlf was on. In such cases the WorkingTreeIterator calculated the SHA1 sometimes on content which was not correctly filtered. The SHA1 was computed on content which two times went through a lf->crlf conversion. We used to tell the treewalk whether it is a checkin or checkout operation and always use the related filters when reading any content. If on windows and autocrlf is true and we do a checkout operation then we always used a lf->crlf conversion on any text content. That's not correct. Even during a checkout we sometimes need the crlf->lf conversion. E.g. when calculating the content-id for working-tree content we need to use crlf->lf filtering although the overall operation type is checkout. Often this bug does not have effects because we seldom compute the content-id of filesystem content during a checkout. But we do need to know whether a file is dirty or not before we overwrite it during a checkout. And if the index entries are smudged we don't trust the index and compute filesystem-content-sha1's explicitly. This caused EGit not to be able to switch branches anymore on Windows when autocrlf was true. EGit denied the checkout because it thought workingtree files are dirty because content-sha1 are computed on wrongly filtered content. Bug: 493360 Change-Id: I1072a57b4c529ba3aaa50b7b02d2b816bb64a9b8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | | | | Merge "Add method to read time unit from config"Shawn Pearce2016-06-101-0/+95
|\ \ \ \ \