summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
Commit message (Collapse)AuthorAgeFilesLines
* PackFile: Add id + ext based constructorsNasser Grainawi2021-03-074-19/+34
| | | | | | | | | | | Add new constructors to PackFile to improve a common use case where callers know the directory, id, and extension, but previously needed to construct a valid file name (with prefix, '.', etc) to create a PackFile. Most callers can use the variant that has id as an ObjectId, but provide an id as String variant too. Change-Id: I39e4466abe8c9509f5916d5bfe675066570b8585 Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* Restore preserved packs during missing object seeksMartin Fick2021-03-041-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | Provide a recovery path for objects being referenced during the pack pruning race. Due to the pack pruning race, it is possible for objects to become referenced after a pack has been deemed safe to prune, but before it actually gets pruned. If this happened previously, the newly referenced objects would be missing and potentially result in a corrupted ref. Add the ability to recover from this situation when an object is missing but happens to still be available in a pack in the "preserved" directory. This is likely only useful when used in conjunction with the --preserve-old-packs GC option, which prunes packs by hard-linking to the preserved directory. If an object is missing and found in a pack in the preserved directory, immediately recover that pack and its associated files (idx, bitmaps...) by moving them back to the original pack directory, and then retry the operation that would have failed due to the missing object. This retry can now succeed and the repository may avoid corruption. This approach should drastically reduce the chance of a corrupt repository during pack pruning at very little extra cost. This extra cost should only be incurred when objects are missing and a failure would normally occur. Change-Id: I2a704e3276b88cc892159d9bfe2455c6eec64252 Signed-off-by: Martin Fick <quic_mfick@quicinc.com> Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* Pack: Replace extensions bitset with bitmapIdx PackFileNasser Grainawi2021-03-041-1/+1
| | | | | | | | | The only extension that was ever consulted from the bitmap was the bitmap index. We can simplify the Pack code as well as the code of all the callers if we focus on just that usage. Change-Id: I799ddfdee93142af67ce5081d14a430d36aa4c15 Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* Create a PackFile class for Pack filenamesNasser Grainawi2021-03-046-26/+170
| | | | | | | | | | | The PackFile class is intended to be a central place to do all common pack filename manipulation and parsing to help reduce repeated code and bugs. Use the PackFile class in the Pack class and in many tests to ensure it works well in a variety of situations. Later changes will expand use of PackFiles to even more areas. Change-Id: I921b30f865759162bae46ddd2c6d669de06add4a Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* HTTP: cookie file stores expiration in secondsThomas Wolf2021-03-031-57/+52
| | | | | | | | | | | | | A cookie file stores the expiration in seconds since the Linux Epoch, not in milliseconds. Correct reading and writing cookie files; with a backwards-compatibility hack to read files that contain a millisecond timestamp. Add a test, and fix tests not to rely on the actual current time so that they will also run successfully after 2030-01-01 noon. Bug: 571574 Change-Id: If3ba68391e574520701cdee119544eedc42a1ff2 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* init: add config option to set default for the initial branch nameMatthias Sohn2021-02-221-0/+52
| | | | | | | | | | | | | | | | We introduced the option --initial-branch=<branch-name> to allow initializing a new repository with a different initial branch. To allow users to override the initial branch name more permanently (i.e. without having to specify the name manually for each 'git init'), introduce the 'init.defaultBranch' option. This option was added to git in 2.28.0. See https://git-scm.com/docs/git-config#Documentation/git-config.txt-initdefaultBranch Bug: 564794 Change-Id: I679b14057a54cd3d19e44460c4a5bd3a368ec848 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* init: allow specifying the initial branch name for the new repositoryMatthias Sohn2021-02-221-1/+35
| | | | | | | | | | | Add option --initial-branch/-b to InitCommand and the CLI init command. This is the first step to implement support for the new option init.defaultBranch. Both were added to git in release 2.28. See https://git-scm.com/docs/git-init#Documentation/git-init.txt--bltbranch-namegt Bug: 564794 Change-Id: Ia383b3f90b5549db80f99b2310450a7faf6bce4c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge "Rename PackFile to Pack"Jonathan Nieder2021-02-189-86/+86
|\
| * Rename PackFile to PackNasser Grainawi2021-02-109-86/+86
| | | | | | | | | | | | | | | | Pack better represents the purpose of the object and paves the way to add a PackFile object that extends File. Change-Id: I39b4f697902d395e9b6df5e8ce53078ce72fcea3 Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* | Fix boxing warningsMatthias Sohn2021-02-171-1/+1
| | | | | | | | Change-Id: Idf4887a99e87c375ec32e2fd289cfce82d78cbce Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Allow dir/file conflicts in virtual base commit on recursive merge.Marija Savtchouk2021-02-091-0/+264
|/ | | | | | | | | | | | | | | | If RecursiveMerger finds multiple base commits, it tries to compute the virtual ancestor to use as a base for the three way merge. Currently, the content conflicts between ancestors are ignored (file staged with the conflict markers). If the path is a file in one ancestor and a dir in the other, it results in NoMergeBaseException (CONFLICTS_DURING_MERGE_BASE_CALCULATION). Allow these conflicts by ignoring this unmerged path in the virtual base. The merger will compute diff in the children instead and it can be further fixed manually if needed. Change-Id: Id59648ae1d6bdf300b26fff513c3204317b755ab Signed-off-by: Marija Savtchouk <mariasavtchouk@google.com>
* Fix DateRevQueue tie breaks with more than 2 elementsAdithya Chakilam2021-02-072-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DateRevQueue is expected to give out the commits that have higher commit time. But in case of tie(same commit time), it should give the commit that is inserted first. This is inferred from the testInsertTie test case written for DateRevQueue. Also that test case, right now uses just two commits which caused it not to fail with the current implementation, so added another commit to make the test more robust. By fixing the DateRevQueue, we would also match the behaviour of LogCommand.addRange(c1,c2) with git log c1..c2. A test case for the same is added to show that current behaviour is not the expected one. By fixing addRange(), the order in which commits are applied during a rebase is altered. Rebase logic should have never depended upon LogCommand.addRange() since the intended order of addRange() is not the order a rebase should use. So, modify the RebaseCommand to use RevWalk directly with TopoNonIntermixSortGenerator. Add a new LogCommandTest.addRangeWithMerge() test case which creates commits in the following order: A - B - C - M \ / -D- Using git 2.30.0, git log B..M outputs: M C D LogCommand.addRange(B, M) without this fix outputs: M D C LogCommand.addRange(B, M) with this fix outputs: M C D Change-Id: I30cc3ba6c97f0960f64e9e021df96ff276f63db7 Signed-off-by: Adithya Chakilam <achakila@codeaurora.org>
* IO: fix IO.readFully(InputStream, byte[], int)Thomas Wolf2021-01-311-0/+84
| | | | | | | | | This would run into an endless loop if the offset given was not zero. Fix the logic to exit the read loop when the buffer is full. Luckily all existing uses of this method call it only with offset zero. Change-Id: I0ec2a4fb43efe4a605d06ac2e88cf155d50e2f1e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Merge "Move reachability checker generation into the ObjectReader object"Jonathan Nieder2021-01-296-6/+16
|\
| * Move reachability checker generation into the ObjectReader objectTerry Parker2021-01-286-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reachability checkers are retrieved from RevWalk and ObjectWalk objects: * RevWalk.createReachabilityChecker() * ObjectWalk.createObjectReachabilityChecker() Since RevWalks and ObjectWalks are themselves directly instantiated in hundreds of places (e.g. UploadPack...) overriding them in a consistent way requires overloading 100s of methods, which isn't feasible. Moving reachability checker generation to a more central place solves that problem. The ObjectReader object seems a good place from which to get reachability checkers, because reachability checkers return information about relationships between objects. ObjectDatabases delegate many operations to ObjectReaders, and reachability bitmaps are attached to ObjectReaders. The Bitmapped and Pedestrian reachability checker objects were package private in the org.eclipse.jgit.revwalk package. This change makes them public and moves them to the org.eclipse.jgit.internal.revwalk package. Corresponding tests are also moved. Motivation: 1) Reachability checking algorithms need to scale. One of the internal Android repositories has ~2.4 million refs/changes/* references, causing bad long tail performance in reachability checks. 2) Reachability check performance is impacted by repository topography: number of refs, number of objects, amounts of related vs. unrelated history. 3) Reachability check performance is also affected by per-branch access (Gerrit branch permissions) since different users can see different branches. 4) Reachability check performance isn't affected by any state in a RevWalk or ObjectWalk. I don't yet know if a single algorithm will work for all cases in #2 and #3. We may need to evolve the ReachabilityChecker interfaces over time to solve the Gerrit branch permissions case, or use Gerrit-specific identity information to solve that in an efficient way. This change takes the existing public API and moves it to the ObjectReader/whole repository level, which is where we can do consistent customizations for #2 and #3. We intend to upstream the best of whatever works, but anticipate the need for multiple rounds of experimentation. Change-Id: I9185feff43551fb387957c436112d5250486833d Signed-off-by: Terry Parker <tparker@google.com>
* | Add the "compression-level" option to all ArchiveCommand formatsYoussef Elghareeb2021-01-281-78/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | Different archive formats support a compression level in the range [0-9]. The value 0 is for lowest compressions and 9 for highest. Highest levels produce output files of smaller sizes but require more memory to do the compression. This change allows passing a "compression-level" option to the git archive command and implements using it for different file formats. Change-Id: I5758f691c37ba630dbac24db67bb7da827bbc8e1 Signed-off-by: Youssef Elghareeb <ghareeb@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Merge changes I36d9b63e,I8c5db581,I2c02e89cJonathan Tan2021-01-275-0/+421
|\ \ | |/ |/| | | | | | | | | * changes: Compare getting all refs except specific refs with seek and with filter Add getsRefsByPrefixWithSkips (excluding prefixes) to ReftableDatabase Add seekPastPrefix method to RefCursor
| * Add getsRefsByPrefixWithSkips (excluding prefixes) to ReftableDatabaseGal Paikin2021-01-273-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We sometimes want to get all the refs except specific prefixes, similarly to getRefsByPrefix that gets all the refs of a specific prefix. We now create a new method that gets all refs matching a prefix except a set of specific prefixes. One use-case is for Gerrit to be able to get all the refs except refs/changes; in Gerrit we often have lots of refs/changes, but very little other refs. Currently, to get all the refs except refs/changes we need to get all the refs and then filter the refs/changes, which is very inefficient. With this method, we can simply skip the unneeded prefix so that we don't have to go over all the elements. RefDirectory still uses the inefficient implementation, since there isn't a simple way to use Refcursor to achieve the efficient implementation (as done in ReftableDatabase). Signed-off-by: Gal Paikin <paiking@google.com> Change-Id: I8c5db581acdeb6698e3d3a2abde8da32f70c854c
| * Add seekPastPrefix method to RefCursorGal Paikin2021-01-262-0/+270
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method will be used by the follow-up change. This useful if we want to go over all the changes after a specific ref. For example, the new method allows us to create a follow-up that would go over all the refs until we reach a specific ref (e.g refs/changes/), and then we use seekPastPrefix(refs/changes/) to read the rest of the refs, thus basically we return all refs except a specific prefix. When seeking past a prefix, the previous condition that created the RefCursor still applies. E.g, if the cursor was created by seekRefsWithPrefix, we can skip some refs but we will not return refs that are not starting with this prefix. Signed-off-by: Gal Paikin <paiking@google.com> Change-Id: I2c02e89c877fe90da8619cb8a4a9a0c865f238ef
* | TemporaryBuffer: fix toByteArray(limit)Thomas Wolf2021-01-221-0/+65
|/ | | | | | | Heap always copied whole blocks, which leads to AIOOBEs. LocalFile didn't overwrite the method and thus caused NPEs. Change-Id: Ia37d4a875df9f25d4825e6bc95fed7f0dff42afb Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Tag message must not include the signatureThomas Wolf2021-01-101-6/+6
| | | | | | | | | | | | Signatures on tags are just tacked onto the end of the message. Getting the message must not return the signature. Compare [1] and [2] in C git, which both drop a signature at the end of an object body. [1] https://github.com/git/git/blob/21bf933/builtin/tag.c#L173 [2] https://github.com/git/git/blob/21bf933/ref-filter.c#L1276 Change-Id: Ic8a1062b8bc77f2d7c138c3fe8a7fd13b1253f38 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Client-side protocol V2 support for fetchingThomas Wolf2021-01-013-14/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make all transports request protocol V2 when fetching. Depending on the transport, set the GIT_PROTOCOL environment variable (file and ssh), pass the Git-Protocol header (http), or set the hidden "\0version=2\0" (git anon). We'll fall back to V0 if the server doesn't reply with a version 2 answer. A user can control which protocol the client requests via the git config protocol.version; if not set, JGit requests protocol V2 for fetching. Pushing always uses protocol V0 still. In the API, there is only a new Transport.openFetch() version that takes a collection of RefSpecs plus additional patterns to construct the Ref prefixes for the "ls-refs" command in protocol V2. If none are given, the server will still advertise all refs, even in protocol V2. BasePackConnection.readAdvertisedRefs() handles falling back to protocol V0. It newly returns true if V0 was used and the advertised refs were read, and false if V2 is used and an explicit "ls-refs" is needed. (This can't be done transparently inside readAdvertisedRefs() because a "stateless RPC" transport like TransportHttp may need to open a new connection for writing.) BasePackFetchConnection implements the changes needed for the protocol V2 "fetch" command (stateless protocol, simplified ACK handling, delimiters, section headers). In TransportHttp, change readSmartHeaders() to also recognize the "version 2" packet line as a valid smart server indication. Adapt tests, and run all the HTTP tests not only with both HTTP connection factories (JDK and Apache HttpClient) but also with both protocol V0 and V2. The SSH tests are much slower and much more focused on the SSH protocol and SSH key handling. Factor out two very simple cloning and pulling tests and make those run with protocol V2. Bug: 553083 Change-Id: I357c7f5daa7efb2872f1c64ee6f6d54229031ae1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Fix NPE in DirCacheCheckoutThomas Wolf2020-12-302-9/+49
| | | | | | | | | | | If a file exists in head, merge, and the working tree, but not in the index, and we're doing a force checkout, the checkout must be an "update", not a "keep". This is a follow-up on If3a9b9e60064459d187c7db04eb4471a72c6cece. Bug: 569962 Change-Id: I59a7ac41898ddc1dd90e86b09b621a41fdf45667 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Merge "Added check for null on DirCacheEntry in checkoutEntry method"Christian Halstrick2020-12-301-0/+9
|\
| * Added check for null on DirCacheEntry in checkoutEntry methodTudor Matrescu2020-12-031-0/+9
| | | | | | | | | | | | | | | | | | | | Observed the error when trying to force checkout from a branch that had no changes on it. When the 'keep()' method from 'DirCacheCheckout' method was called the 'DirCacheEntry e' was null and was passed like this to the 'checkoutEntry()' method where the 'getObjectId()' is being called on the 'e' object Change-Id: If3a9b9e60064459d187c7db04eb4471a72c6cece
* | [spotbugs] Fix potential NPE in PackFileSnapshotTestMatthias Sohn2020-12-171-2/+6
| | | | | | | | | | | | | | Path#getFileName can return null. Fix the warning by asserting the file name isn't null. Change-Id: I7f2fe75b46113d8be1d14e3f18dd77da27df25ed Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | [spotbugs] Fix potential NPEs in FileReftableStackTestMatthias Sohn2020-12-171-7/+12
| | | | | | | | | | | | | | File#listFiles can return null. Use Files#list instead to fix the problem. Change-Id: I74e0b49aa6dae370219507c64aa43be4d8aa7b82 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | [spotbugs] Fix potential NPE in FileBasedConfigTestMatthias Sohn2020-12-171-3/+10
| | | | | | | | | | | | | | Path#getParent can return null. Fix the warning by implementing a helper method which asserts the parent is not null. Change-Id: Ib4f8dff0674b74bc891f15f08bd9755c5ea728dc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | [spotbugs] Fix potential NPE in GcPruneNonReferencedTestMatthias Sohn2020-12-171-0/+2
| | | | | | | | | | | | | | | | File#listFiles can return null, assert it is not null to fix the warning. Change-Id: I28fc668fee760d39965e6e039003ac9f85fd461b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Remove reftree and ketchHan-Wen Nienhuys2020-12-155-1064/+1
| | | | | | | | | | | | | | This was experimental code and never used in production. Change-Id: Ia3da7f2b82d9e365cec2ccf9397cbc47439cd150 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | TagCommand: propagate NO_CHANGE informationThomas Wolf2020-12-081-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Some clients may wish to allow NO_CHANGE lightweight tag updates without setting the force flag. (For instance EGit does so.) Command-line git does not allow this. Propagate the RefUpdate result via the RefAlreadyExistsException. That way a client has the possibility to catch it and check the failure reason without having to parse the exception message, and take appropriate action, like ignoring the exception on NO_CHANGE. Change-Id: I60e7a15a3c309db4106cab87847a19b6d24866f6 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | TagCommand: make -f work with lightweight tags for NO_CHANGEThomas Wolf2020-12-081-0/+23
| | | | | | | | | | | | | | | | JGit treated a NO_CHANGE RefUpdate as an error in all cases. But when updating a lightweight tag, this is a successful result if -f was specified. Change-Id: Iddfa6d6a6dc8bf8fed81138a008ebc32d5f960bd Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | TagCommand: support signing annotated tagsThomas Wolf2020-12-071-14/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add the two config constants from C git that can switch on signing of annotated tags. Add them to the GpgConfig, and implement actually signing a tag in TagCommand. The interactions between command line options for "git tag" and config options is a bit murky in C git. There are two config settings for it: * tag.gpgSign is the main option, if set to true, it kicks in if neither -s nor -u are given on the command line. * tag.forceSignAnnotated signs only tags created via "git tag -m", but only if command-line option "-a" is not present. It applies even if tag.gpgSign is set explicitly to false. Giving -s or -u on the command line also forces an annotated tag since lightweight tags cannot be signed. Bug: 386908 Change-Id: Ic8a1a44b5f12f47d5cdf3aae2456c1f6ca9ef057 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Enable GpgSigner to also sign tagsThomas Wolf2020-12-073-10/+290
|/ | | | | | | | | | | | | | Factor out a common ObjectBuilder as super class of CommitBuilder and TagBuilder, and make the GpgSigner work on ObjectBuilder. In order not to break API, add the new method for signing an ObjectBuilder in a new interface GpgObjectSigner. The signature for a tag is just tacked onto the end of the tag message. The message of a signed tag must end in LF. Bug: 386908 Change-Id: I5e021e3c927f4051825cd7355b129113b949455e Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Use new protocol version constantsMatthias Sohn2020-11-301-13/+25
| | | | Change-Id: Icd6b876e392c55a7322a990ac7f618250b732b4b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge branch 'stable-5.9'Matthias Sohn2020-11-301-2/+6
|\ | | | | | | | | | | | | * stable-5.9: Add constants for parsing git wire protocol version Change-Id: I1e4174ae8bbefcb71a191dcbf32027d4b35c2b37 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Add constants for parsing git wire protocol versionDavid Ostrovsky2020-11-291-2/+7
| | | | | | | | | | | | | | This would allow other JGit users to access and reuse the constants. Change-Id: I1608802f45586af5f8582afa592e26679e9cebe3 Signed-off-by: David Ostrovsky <david@ostrovsky.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | PacketLineInTest: test for END and DELIM being distinguishableThomas Wolf2020-11-301-3/+8
| | | | | | | | | | | | | | | | Explicitly test that END and DELIM can be distinguished. If not, the wire protocol V2 breaks down. Bug: 568950 Change-Id: I5f3496168244303c68893f1c756831dd27440aeb Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Merge branch 'stable-5.10'Matthias Sohn2020-11-271-0/+20
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.10: Remove unused imports Silence API warnings Remove erraneously merged source features Prepare 5.3.9-SNAPSHOT builds JGit v5.3.8.202011260953-r Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock PacketLineIn: ensure that END != DELIM Update API warning filters Remove unused imports Change-Id: I25f50c3807a4e6b22a264320ea7ed3758e2a75ec Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * | Merge branch 'stable-5.9' into stable-5.10Matthias Sohn2020-11-271-0/+20
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.9: Remove unused imports Silence API warnings Remove erraneously merged source features Prepare 5.3.9-SNAPSHOT builds JGit v5.3.8.202011260953-r Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock PacketLineIn: ensure that END != DELIM Update API warning filters Remove unused imports Change-Id: Icf415ac5bab2f69f71189c942424ee69f8a64d4e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | * Merge branch 'stable-5.8' into stable-5.9Matthias Sohn2020-11-271-0/+20
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.8: Remove unused imports Silence API warnings Remove erraneously merged source features Prepare 5.3.9-SNAPSHOT builds JGit v5.3.8.202011260953-r Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock PacketLineIn: ensure that END != DELIM Update API warning filters Remove unused imports Change-Id: I70b399eb3df02aa2fb112e86e844cf5a0daa5515 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | * Merge branch 'stable-5.7' into stable-5.8Matthias Sohn2020-11-271-0/+20
| | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.7: Remove unused imports Silence API warnings Remove erraneously merged source features Prepare 5.3.9-SNAPSHOT builds JGit v5.3.8.202011260953-r Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock Update API warning filters Remove unused imports Change-Id: I9b94938f5c09bd726e8e368c98c56da8280fd0b2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | * Merge branch 'stable-5.6' into stable-5.7Matthias Sohn2020-11-271-0/+20
| | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.6: Prepare 5.3.9-SNAPSHOT builds JGit v5.3.8.202011260953-r Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock Update API warning filters Remove unused imports Change-Id: Ie24d381f295cccfb99068c7ed5817179da29c1db Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | * Merge branch 'stable-5.5' into stable-5.6Matthias Sohn2020-11-273-2/+20
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.5: Prepare 5.3.9-SNAPSHOT builds JGit v5.3.8.202011260953-r Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock Update API warning filters Remove unused imports Change-Id: I00c8ddad0059a20a978743dfb7ad1b513dc7fef6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | * Merge branch 'stable-5.4' into stable-5.5Matthias Sohn2020-11-273-4/+22
| | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.4: Prepare 5.3.9-SNAPSHOT builds JGit v5.3.8.202011260953-r Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock Update API warning filters Remove unused imports Change-Id: Icc34f809a3bb019d8d640b9bdb71363e617942e2 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | * Merge branch 'stable-5.3' into stable-5.4Matthias Sohn2020-11-273-4/+22
| | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.3: Prepare 5.3.9-SNAPSHOT builds JGit v5.3.8.202011260953-r Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock Update API warning filters Remove unused imports Change-Id: I82576ad0f61cf3ff11b54691b32666c61401ad9b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | | * Merge branch 'stable-5.2' into stable-5.3Matthias Sohn2020-11-263-4/+22
| | | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.2: Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock Update API warning filters Remove unused imports Change-Id: Id9386846a202b5ae98dd602744963f8897ddaa8c
| | | | | | | | | * Merge branch 'stable-5.1' into stable-5.2Matthias Sohn2020-11-263-4/+22
| | | | | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.1: Prepare 5.1.15-SNAPSHOT builds JGit v5.1.14.202011251942-r GC#deleteOrphans: log warning for deleted orphaned files GC#deleteOrphans: handle failure to list files in pack directory Ensure that GC#deleteOrphans respects pack lock Update API warning filters Remove unused imports Change-Id: I91cfe2820c40d2d773cbf018cc2a6c36b062801e Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | | | | * Ensure that GC#deleteOrphans respects pack lockMatthias Sohn2020-11-261-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If pack or index files are guarded by a pack lock (.keep file) deleteOrphans() should not touch the respective files protected by the lock file. Otherwise it may interfere with PackInserter concurrently inserting a new pack file and its index. The problem was caused by the following race. All mentioned files are located in "objects/pack/". File endings relevant in "pack" dir: .pack .keep .idx .bitmap When ReceivePack receives a pack file it executes the following steps: ReceivePack.service(): receivePackAndCheckConnectivity(): receivePack(): receive the pack parse the pack, returns packLock (.keep file) PackInserter.flush(): write tmpPck file: "insert_<random>.pack" write tmpIdx file: "insert_<random>.idx" real pack name: "pack-<SHA1>.pack" real index name: "pack-<SHA1>.idx" atomic rename tmpPack to realPack atomic rename tmpIdx to tmpIdx execute commands unlock pack by removing .keep file trigger auto gc if enabled When PackInserter.flush() renames the temporary pack to the final "pack-xxx.pack" file the temporary pack index file "insert_xxx.idx" has no matching .pack file with the same base name for a short interval. If deleteOrphans() ran during that interval it deduced the pack index file was orphaned. Subsequently the missing pack index caused MissingObjectExceptions since objects contained in the pack couldn't be looked up anymore. Bug: https://bugs.chromium.org/p/gerrit/issues/detail?id=13544 Change-Id: I559c81e4b1d7c487f92a751bd78b987d32c98719 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| | | | | | | | | | * Remove unused importsMatthias Sohn2020-07-192-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change-Id: I7c44e3603df2dd368cb7c0ba0072413b887b6903 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>