summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
Commit message (Collapse)AuthorAgeFilesLines
* Add a cgit interoperability test for LockFileMatthias Sohn2021-05-091-0/+57
| | | | Change-Id: I30cacd1f50f8f4ff4dd91ad291bf279980e3c4b5 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* LockFile: create OutputStream only when neededThomas Wolf2021-05-071-1/+152
| | | | | | | | | | Don't create the stream eagerly in lock(); that may cause JGit to exceed OS or JVM limits on open file descriptors if many locks need to be created, for instance when creating many refs. Instead create the output stream only when one really needs to write something. Bug: 573328 Change-Id: If9441ed40494d46f594a896d34a5c4f56f91ebf4 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Implement ours/theirs content conflict resolutionThomas Wolf2021-04-194-12/+661
| | | | | | | | | | | | | | | | | | | | | | | | | | | Git has different conflict resolution strategies: * There is a tree merge strategy "ours" which just ignores any changes from theirs ("-s ours"). JGit also has the mirror strategy "theirs" ignoring any changes from "ours". (This doesn't exist in C git.) Adapt StashApplyCommand and CherrypickCommand to be able to use those tree merge strategies. * For the resolve/recursive tree merge strategies, there are content conflict resolution strategies "ours" and "theirs", which resolve any conflict hunks by taking the "ours" or "theirs" hunk. In C git those correspond to "-Xours" or -Xtheirs". Implement that in MergeAlgorithm, and add API to set and pass through such a strategy for resolving content conflicts. * The "ours/theirs" content conflict resolution strategies also apply for binary files. Handle these cases in ResolveMerger. Note that the content conflict resolution strategies ("-X ours/theirs") do _not_ apply to modify/delete or delete/modify conflicts. Such conflicts are always reported as conflicts by C git. They do apply, however, if one side completely clears a file's content. Bug: 501111 Change-Id: I2c9c170c61c440a2ab9c387991e7a0c3ab960e07 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Fix typo in test method nameThomas Wolf2021-04-091-1/+1
| | | | Change-Id: I34718829435daf8ded4ce596c824dd3cfbafbaf6 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Allow file mode conflicts in virtual base commit on recursive merge.Marija Savtchouk2021-04-061-0/+76
| | | | | | | | | Similar to https://git.eclipse.org/r/c/jgit/jgit/+/175166, ignore path that have conflicts on attributes, so that the virtual base could be used by RecursiveMerger. Change-Id: I99c95445a305558d55bbb9c9e97446caaf61c154 Signed-off-by: Marija Savtchouk <mariasavtchouk@google.com>
* Introduce getMergedInto(RevCommit commit, Collection<Ref> refs)Adithya Chakilam2021-03-141-0/+81
| | | | | | | | | | | | | | | In cases where we need to determine if a given commit is merged into many refs, using isMergedInto(base, tip) for each ref would cause multiple unwanted walks. getMergedInto() marks the unreachable commits as uninteresting which would then avoid walking that same path again. Using the same api, also introduce isMergedIntoAny() and isMergedIntoAll() Change-Id: I65de9873dce67af9c415d1d236bf52d31b67e8fe Signed-off-by: Adithya Chakilam <quic_achakila@quicinc.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Skip detecting content renames for large filesYoussef Elghareeb2021-03-141-0/+48
| | | | | | | | | | | | | | | | | | | | | There are two code paths for detecting renames: one on tree diffs (using DiffFormatter#scan) and the other on single file diffs (using DiffFormatter#format). The latter skips binary and large files for rename detection - check [1], but the former doesn't. This change skips content rename detection for the tree diffs case for large files. This is essential to avoid expensive computations while reading the file, especially for callers who don't want to pay that cost. Content renames are those which involve files with slightly modified content. Exact renames will still be identified. The default threshold for file sizes is reused from PackConfig.DEFAULT_BIG_FILE_THRESHOLD: 50 MB. [1] https://git.eclipse.org/r/plugins/gitiles/jgit/jgit/+/232876421d067a1242e8afcaa33b9171342fee3e/org.eclipse.jgit/src/org/eclipse/jgit/diff/RawText.java#386 Change-Id: Idbc2c29bd381c6e387185204638f76fda47df41e Signed-off-by: Youssef Elghareeb <ghareeb@google.com>
* Prepare 5.12.0-SNAPSHOT buildsMatthias Sohn2021-03-102-55/+55
| | | | | Change-Id: I736de7c3deb11da75777d459f47332df0b486443 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Prepare 5.11.1-SNAPSHOT buildsMatthias Sohn2021-03-092-55/+55
| | | | | Change-Id: I94628ccbb5099a65aa4345cfd28a141ff5555b68 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* JGit v5.11.0.202103091610-rv5.11.0.202103091610-rMatthias Sohn2021-03-092-2/+2
| | | | | Change-Id: I8e6855eaf7228459f492036feb4e34ca085698a7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* 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-035-63/+60
| | | | | | | | | | | | | 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>
* Bazel: Remove unused resources variableDavid Ostrovsky2021-02-071-2/+0
| | | | | Change-Id: Iac2e547791929c26027ab4730ceac6177899ccf1 Signed-off-by: David Ostrovsky <david@ostrovsky.org>
* 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>
* Fix bazel tests broken by classes moved in dbd05433Matthias Sohn2021-02-041-2/+2
| | | | | Change-Id: I88a3547c4b52bcf28c0f0f548ba1bb41a7787704 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* 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-297-6/+17
|\
| * Move reachability checker generation into the ObjectReader objectTerry Parker2021-01-287-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Silence CN_IMPLEMENTS_CLONE_BUT_NOT_CLONEABLE in jgit testsMatthias Sohn2020-12-222-0/+154
| | | | | | | | | | | | | | We want complete control over clone behavior and don't want to use Object's clone implementation. Change-Id: I34a4e967f8aa3879c69a4978768bd35712c4105c Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | [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-156-1065/+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>
* Prepare 5.11.0-SNAPSHOT buildsMatthias Sohn2020-12-022-55/+55
| | | | | Change-Id: I91e5532526775191fbd34f81e2ef777cba605e3b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* 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>