summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
Commit message (Collapse)AuthorAgeFilesLines
* Implement ours/theirs content conflict resolutionThomas Wolf2021-04-198-100/+400
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Allow file mode conflicts in virtual base commit on recursive merge.Marija Savtchouk2021-04-061-9/+12
| | | | | | | | | 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>
* Allow info messages in UsernamePasswordCredentialsProviderThomas Wolf2021-04-011-7/+17
| | | | | | | | | o.e.j.ssh.apache produces passphrase prompts containing InformationalMessage items to show the fingerprint of the key the passphrase is being asked for. Allow this so that the credentials provider can be used with o.e.j.ssh.apache. Change-Id: Ibc2ffd3a987d3118952726091b9b80442972dfd8 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* ssh config: do environment variable replacementThomas Wolf2021-04-011-29/+56
| | | | | | | | | OpenSSH 8.4 has introduced simple environment variable substitution for some keys. Implement that feature in our ssh config file parser, too. Bug: 572103 Change-Id: I360f2c5510eea4ec3329aeedf3d29dfefc9163f0 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Merge branch 'stable-5.11'Matthias Sohn2021-03-264-101/+166
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | * stable-5.11: Refactor CommitCommand to improve readability CommitCommand: fix formatting CommitCommand: remove unncessary comment Ensure post-commit hook is called after index lock was released sshd: try all configured signature algorithms for a key sshd: modernize ssh config file parsing sshd: implement ssh config PubkeyAcceptedAlgorithms Change-Id: Ic3235ffd84c9d7537a1fe5ff4f216578e6e26724 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Refactor CommitCommand to improve readabilityMatthias Sohn2021-03-231-72/+90
| | | | | | | | Change-Id: Id3cac81cd32c07f677b7f669d58e32b5290e1790 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * CommitCommand: fix formattingMatthias Sohn2021-03-231-2/+1
| | | | | | | | Change-Id: I5efd1ffee4ebb08b3b5c27e29162493615727840 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * CommitCommand: remove unncessary commentMatthias Sohn2021-03-231-1/+0
| | | | | | | | | | | | Let the code speak for itself. Change-Id: I6a6d6c327ffac23fc607295a7f4fd3131b3d1e58 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * Ensure post-commit hook is called after index lock was releasedMatthias Sohn2021-03-232-6/+18
| | | | | | | | | | | | | | Otherwise a post-commit hook cannot modify the index. Bug: 566934 Change-Id: I0093dccd93b2064f243544b516bdce198afdb18b Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
| * sshd: modernize ssh config file parsingThomas Wolf2021-03-191-22/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | OpenSSH has changed some things in ssh config files. Update our parser to implement some of these changes: * ignore trailing comments on a line * rename PubkeyAcceptedKeyTypes to PubkeyAcceptedAlgorithms Note that for the rename, openSSH still accepts both names. We do the same, translating names whenever we get or set values. Change-Id: Icccca060e6a4350a7acf05ff9e260f2c8c60ee1a Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
| * sshd: implement ssh config PubkeyAcceptedAlgorithmsThomas Wolf2021-03-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apache MINA sshd 2.6.0 appears to use only the first appropriate public key signature algorithm for a particular key. See [1]. For RSA keys, that is rsa-sha2-512. This breaks authentication at servers that only know the older (and deprecated) ssh-rsa algorithm. With PubkeyAcceptedAlgorithms, users can re-order algorithms in the ssh config file per host, if needed. Setting PubkeyAcceptedAlgorithms ^ssh-rsa will put "ssh-rsa" at the front of the list of algorithms, and then authentication at such servers with RSA keys works again. [1] https://issues.apache.org/jira/browse/SSHD-1105 Bug: 572056 Change-Id: I86c3b93f05960c68936e80642965815926bb2532 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Optimize RevWalkUtils.findBranchesReachableFrom()Adithya Chakilam2021-03-142-10/+41
| | | | | | | | | | | | | | | | | | | | | | In [1], improved RevWalk.getMergedInto() is introduced to avoid repeated work while performing RevWalk.isMergedInto() on many refs. Modify findBranchesReachableFrom() to use it. [1] I65de9873dce67af9c415d1d236bf52d31b67e8fe Change-Id: I81d615241638d4093df64b449637af601843a5ed Signed-off-by: Adithya Chakilam <quic_achakila@quicinc.com>
* | Introduce getMergedInto(RevCommit commit, Collection<Ref> refs)Adithya Chakilam2021-03-141-0/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-142-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | HTTP cookies: do tilde expansion on http.cookieFileThomas Wolf2021-03-122-8/+20
|/ | | | | | | | | | | | | | | | | | | | Git config http.cookieFile must have ~ expansion, compare [1]. It also should be an absolute path. While a relative path is allowed, C git just passes the value on to libcurl, so it'll be relative to the current working directory and thus not work in all directories. Log a warning if the path is relative. (Alternatives would be to throw an exception, or to resolve the path relative to the .git directory, or relative to the working tree root, or relative to the config file it occurs in. But C git does not seem to do either.) [1] https://github.com/git/git/commit/e5a39ad8e Bug: 571798 Change-Id: I5cdab6061d0613ac7d8cb7977e5b97f5b88f562d Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* PackFile: Add id + ext based constructorsNasser Grainawi2021-03-076-34/+70
| | | | | | | | | | | 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>
* GC: deleteOrphans: Use PackFileNasser Grainawi2021-03-041-13/+16
| | | | | | | | It's easier to follow the logic here when we can use our own objects instead of Strings. Change-Id: I6a166edcc67903fc1ca3544f458634c4cef8fde7 Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* PackExt: Convert to EnumNasser Grainawi2021-03-042-56/+19
| | | | | | | | | | This class already looked very much like an Enum, but wasn't one. As an Enum, we can use PackExt in EnumMaps and EnumSets. Convert the Map key usage in PackDirectory to an EnumMap. Change-Id: Ice097fd468a05805f914e6862fbd1d96ec8c45d1 Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* Restore preserved packs during missing object seeksMartin Fick2021-03-042-12/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-043-47/+39
| | | | | | | | | 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>
* PackDirectory: Use PackFile to ensure we find preserved packsNasser Grainawi2021-03-041-31/+43
| | | | | | | | | | | | | | | | Update scanPacksImpl and listPackDirectory (renamed to getPackFilesByExtById) to use the new PackFile functionality to validate file names and complete pack file sets (.pack, .idx, etc). Most importantly, this allows a later change to rely on scanPacks() to complete a packList that contains packs with the 'old-' prefix in their extension. This also eliminates duplication of logic for how to identify and construct pack files. Change-Id: I7175e5fefb187a29e0a7cf53c392aee922314f31 Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* GC: Use PackFile to de-dup logicNasser Grainawi2021-03-041-25/+16
| | | | | | | | GC has several places where it tries to build files names for packs that we can use the PackFile class for instead. Change-Id: I99e5ceff9050f8583368fca35279251955e4644d Signed-off-by: Nasser Grainawi <quic_nasserg@quicinc.com>
* Create a PackFile class for Pack filenamesNasser Grainawi2021-03-043-30/+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-24/+30
| | | | | | | | | | | | | 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>
* IgnoreNode: include path to file for invalid .gitignore patternsThomas Wolf2021-02-234-26/+79
| | | | | | | | | | | | | Include the full file path of the .gitignore file and the line number of the invalid pattern. Also include the pattern itself. .gitignore files inside the repository are reported with their repository-relative path; files outside (from git config core.excludesFile or .git/info/exclude) are reported with their full absolute path. Bug: 571143 Change-Id: Ibe5969679bc22cff923c62e3ab9801d90d6d06d1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* FastIgnoreRule: include bad pattern in log messageThomas Wolf2021-02-232-1/+7
| | | | | | | | | | | | | When a .gitignore pattern cannot be parsed include the pattern in the log message. Just reporting "not closed bracket" isn't helpful if the user doesn't know in which pattern the problem occurred. Even better would be to include the full path of the .gitignore file that contained the offending pattern. This is not implemented in this change; it may need new API and needs more thought. Bug: 571143 Change-Id: Id5b16d9cf550544ba3ad409a02041946fa8516ab Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* init: add config option to set default for the initial branch nameMatthias Sohn2021-02-222-3/+23
| | | | | | | | | | | | | | | | 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-224-1/+79
| | | | | | | | | | | 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>
* Fail clone if initial branch doesn't exist in remote repositoryMatthias Sohn2021-02-225-8/+93
| | | | | | | | | | jgit clone --branch foo <url> did not fail if the remote branch "foo" didn't exist in the remote repository being cloned. Bug: 546580 Change-Id: I55648ad3a39da4a5711dfa8e6d6682bb8190a6d6 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* dfs: handle short copieswh2021-02-191-2/+9
| | | | | | | | | | `copy` is documented as possibly returning a smaller number of bytes than requested. In practice, this can occur if a block is cached and the reader never pulls in the file to check its size. Bug: 565874 Change-Id: I1e53b3d2f4ab09334178934dc0ef74ea99045cd3 Signed-off-by: wh <wh9692@protonmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge "Rename PackFile to Pack"Jonathan Nieder2021-02-1826-173/+176
|\
| * Rename PackFile to PackNasser Grainawi2021-02-1026-173/+176
| | | | | | | | | | | | | | | | 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>
* | GPG signature verification via BouncyCastleThomas Wolf2021-02-169-4/+772
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a GpgSignatureVerifier interface, plus a factory to create instances thereof that is provided via the ServiceLoader mechanism. Implement the new interface for BouncyCastle. A verifier maintains an internal LRU cache of previously found public keys to speed up verifying multiple objects (tag or commits). Mergetags are not handled. Provide a new VerifySignatureCommand in org.eclipse.jgit.api together with a factory method Git.verifySignature(). The command can verify signatures on tags or commits, and can be limited to accept only tags or commits. Provide a new public WrongObjectTypeException thrown when the command is limited to either tags or commits and a name resolves to some other object kind. In jgit.pgm, implement "git tag -v", "git log --show-signature", and "git show --show-signature". The output is similar to command-line gpg invoked via git, but not identical. In particular, lines are not prefixed by "gpg:" but by "bc:". Trust levels for public keys are read from the keys' trust packets, not from GPG's internal trust database. A trust packet may or may not be set. Command-line GPG produces more warning lines depending on the trust level, warning about keys with a trust level below "full". There are no unit tests because JGit still doesn't have any setup to do signing unit tests; this would require at least a faked .gpg directory with pre-created key rings and keys, and a way to make the BouncyCastle classes use that directory instead of the default. See bug 547538 and also bug 544847. Tested manually with a small test repository containing signed and unsigned commits and tags, with signatures made with different keys and made by command-line git using GPG 2.2.25 and by JGit using BouncyCastle 1.65. Bug: 547751 Change-Id: If7e34aeed6ca6636a92bf774d893d98f6d459181 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* | Post commit hook failure should not cause commit failureTim Neumann2021-02-152-4/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As the post commit hook is run after a commit is finished, it can not abort the commit and the exit code of this hook should not have any effect. This can be achieved by not throwing a AbortedByHookException exception. The stderr output is not lost thanks to contributions for bug 553471. Bug: 553428 Change-Id: I451a76e04103e632ff44e045561c5a41f7b7d558 Signed-off-by: Tim Neumann <Tim.Neumann@advantest.com> Signed-off-by: Fabian Pfaff <fabian.pfaff@vogella.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Allow to define additional Hook classes outside JGitMatthias Sohn2021-02-151-2/+2
| | | | | | | | | | | | | | | | EGit wants to add gitflow specific hooks in org.eclipse.egit.gitflow. Make GitHook public to allow sub-classing outside of the org.eclipse.jgit.hooks package. Change-Id: I439575ec901e3610b5cf9d66f7641c8324faa865 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | GitHook: use default charset for output and error streamsMatthias Sohn2021-02-151-4/+6
| | | | | | | | | | | | External scripts most probably expect the default charset. Change-Id: I318a5e1d9f536a95e70c06ffb5b6f408cd40f73a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | GitHook: use generic OutputStream instead of PrintStreamMatthias Sohn2021-02-154-28/+19
| | | | | | | | Change-Id: I15e64dc963c9d27dc9c8de4976dd63f74b918b15 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | Allow dir/file conflicts in virtual base commit on recursive merge.Marija Savtchouk2021-02-091-10/+13
|/ | | | | | | | | | | | | | | | 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>
* Merge "GitHook: make fields outputStream and errorStream private"Christian Halstrick2021-02-091-2/+2
|\
| * GitHook: make fields outputStream and errorStream privateMatthias Sohn2021-02-091-2/+2
| | | | | | | | | | | | Subclasses can use the corresponding getter methods. Change-Id: Iaa9ab01f5a9731a264b28608d2418a9405b601d7 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* | GPG: support git config gpg.programThomas Wolf2021-02-075-35/+207
|/ | | | | | | | | | | | | | Add it to the GpgConfig. Change GpgConfig to load the values once only. Add a parameter to the GpgObjectSigner interface's operations to pass in a GpgConfig. Update CommitCommand and TagCommand to pass the value to the signer. Let the signer decide whether it can actually produce the wanted signature type (openpgp or x509). No behavior change. But this makes it possible to implement different signers that might support x509 signatures, or use gpg.program and shell out to an external GPG executable for signing. Change-Id: I427f83eb1ece81c310e1cddd85315f6f88cc99ea Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
* Fix DateRevQueue tie breaks with more than 2 elementsAdithya Chakilam2021-02-072-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Field updateHead can be a local variable in RefDirectoryRenameLars Vogel2021-02-061-4/+1
| | | | | | | Keeping the field updateDate is unecessary, as it is set and used only in the doRename method. Change-Id: I1cdd1adf759b75c103480db7a74cec8c2d78b794 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
* Fix FileRepository#convertToReftable which failed if no reflog existedMatthias Sohn2021-02-051-4/+6
| | | | | | | | | Deleting non-existing files when converting to reftable without backup caused convertToReftable to fail. Observed this on a mirrored repository which had no reflogs. Fix this by skipping missing files during deletion. Change-Id: I3bb913d5bfddccc6813677b873006efb849a6ebc Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
* Merge "reftable: add random suffix to table names"Matthias Sohn2021-02-051-2/+6
|\
| * reftable: add random suffix to table namesHan-Wen Nienhuys2021-01-251-2/+6
| | | | | | | | | | | | | | | | | | | | | | In some circumstances (eg. compacting a stack that has deletions), the result may have a {min, max} range that already exists. In these cases, we would rename onto an already existing file, which does not work on Windows. By adding a random suffix, we disambiguate the files, and avoid this failure scenario. Change-Id: I0273f99bb845cfbdbd8cdd582b55d3c310505d29 Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
* | TransportGitAnon: remove unnecessary socket bind to a local addressAlina Djamankulova2021-02-051-1/+0
| | | | | | | | | | | | | | | | | | before connecting. A socket gets bound on connect in the next line. Signed-off-by: Alina Djamankulova <adjama@google.com> Change-Id: I69a423c592e2fdd582b3c40099137b4ef3d05b39
* | IO: fix IO.readFully(InputStream, byte[], int)Thomas Wolf2021-01-311-3/+3
| | | | | | | | | | | | | | | | | | 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-298-26/+102
|\ \