|
| 1 | +# Changelog |
| 2 | + |
| 3 | +All notable changes to this project are documented in this file. |
| 4 | + |
| 5 | +## [Unreleased] |
| 6 | + |
| 7 | +Changes since [v1.6.0](https://github.com/gitonomy/gitlib/releases/tag/v1.6.0). |
| 8 | + |
| 9 | +1.7 prepares the upgrade to 2.0: it has the API of 2.0 that can be added without breaking 1.x, |
| 10 | +and deprecates what 2.0 replaces or breaks. Code without deprecations with 1.7 runs with 2.0 |
| 11 | +too, so a library can require `^1.7 || ^2.0` with a single code path. The exceptions, the |
| 12 | +changes of 2.0 1.7 can't bring, are listed in the `UPGRADE-2.0.md` of 2.0. |
| 13 | + |
| 14 | +1.7 breaks nothing of 1.6: the parameters keep their names, the arguments added to the methods |
| 15 | +of classes that aren't final are read with `func_get_arg()`, commented out in their signature |
| 16 | +(`@psalm-variadic` for Psalm), and gitlib keeps calling the deprecated methods that a subclass |
| 17 | +overrides. Deprecations are triggered through `symfony/deprecation-contracts`, a new |
| 18 | +dependency. |
| 19 | + |
| 20 | +1.7 requires PHP 8.1, for the `DiffLineType` enum: on PHP 8.0, Composer keeps 1.6. |
| 21 | + |
| 22 | +### Features |
| 23 | + |
| 24 | +- `Gitonomy\Git\Driver\Cli\CliDriver` configures git: the binary, the environment variables, |
| 25 | + the timeout and the logger. It takes the arguments of the `CliDriver` of 2.0. |
| 26 | +- `new Repository($dir, $workingDir, $driver)`: the second argument may be the working |
| 27 | + directory, the third one is a `CliDriver`. |
| 28 | +- `Repository::init()`, `initBare()`, `cloneFrom()`, `cloneBareFrom()`, `mirrorFrom()`, |
| 29 | + `isValidRepository()` and `isValidRepositoryAndBranch()` take the URL before the path and a |
| 30 | + `CliDriver` as last argument. Like in 2.0, `isValidRepositoryAndBranch()` checks the exact |
| 31 | + name of the branch, and both read a relative path as a path, never as the name of a remote |
| 32 | + of the working directory of PHP. |
| 33 | +- `Repository::getDiff($from, $to)`, with two arguments, compares two revisions, `Repository::getMergeBase()` |
| 34 | + returns their best common ancestor, `WorkingCopy::getDiff()` compares the working tree with |
| 35 | + a revision. Like in 2.0, they throw a `ReferenceNotFoundException` for an unknown revision, |
| 36 | + as `WorkingCopy::checkoutNewBranch()`. |
| 37 | +- `Diff::parse()`, `Diff::fromArray()` and `File::fromArray()` take the repository to read the |
| 38 | + blobs from, the constructor of `Diff\File` the changes and the repository. |
| 39 | + `File::isModeChange()`, `File::isCopy()`, `FileChange::getAdditions()` and |
| 40 | + `FileChange::getDeletions()`. |
| 41 | +- `FileChange::getDiffLines()` returns the lines of a hunk as `Diff\DiffLine` objects, with |
| 42 | + `getType()`, a `Diff\DiffLineType`, and `getContent()`. The constructor of `FileChange` |
| 43 | + takes `DiffLine` objects. |
| 44 | +- `Repository::getBlame()` and `Blame` take the first and the last lines to blame, as |
| 45 | + integers. |
| 46 | + `Blame::getHunks()` returns `Blame\Hunk` objects, numbered like the file; |
| 47 | + `Blame\Line::getNumber()` and `getOriginalNumber()`. |
| 48 | +- `Log::withOffset()` and `withLimit()` return another log. |
| 49 | +- `Branch::isMergedInto()` and `Branch::moveTo()`. `ReferenceBag::createBranch()` and |
| 50 | + `createTag()` take a `Revision` too. |
| 51 | +- `PushReference::getFullname()`, `getRange()`, `isCreation()` and `isDeletion()`. |
| 52 | +- Iterating a `Tree` gives its entries, `TreeEntry` objects with `getName()`, `getMode()` and |
| 53 | + `getObject()`, by name; `Tree::getBlobs()`, `getTrees()` and `getSubmodules()` return those |
| 54 | + of one type. |
| 55 | +- `Submodule`, with `getHash()`. The submodules of trees are still `CommitReference` |
| 56 | + objects, which extend `Submodule`. |
| 57 | +- `WorkingCopy::checkoutNewBranch()`. `WorkingCopy::checkout()` takes any `Revision`. |
| 58 | +- `Repository::getSizeInBytes()`, which doesn't follow links. |
| 59 | + |
| 60 | +### Deprecations |
| 61 | + |
| 62 | +- An array of options as second argument of `Repository`, the `debug` option set to `false`, |
| 63 | + `Repository::setLogger()` and `getLogger()`: use the `workingDir` and `driver` arguments. |
| 64 | +- `Admin` and `Repository::cloneTo()`: use the static methods of `Repository`. |
| 65 | +- `Repository::getDiff()` with one argument and `Log::getDiff()`: use |
| 66 | + `Repository::getDiff($from, $to)` or `WorkingCopy::getDiff()`. |
| 67 | +- `Diff::setRepository()`, `File::setRepository()`, `File::addChange()`, |
| 68 | + `File::isChangeMode()`, `File::isDelete()`, `File::getAnchor()` and `FileChange::getCount()`. |
| 69 | +- `FileChange::getLines()`, which returns the lines as arrays, the `FileChange::LINE_*` |
| 70 | + constants, and passing the lines to the constructor of `FileChange` as arrays: use |
| 71 | + `getDiffLines()`, `DiffLineType` and `DiffLine` objects. |
| 72 | +- A range of lines as a string in `Repository::getBlame()` and `Blame`, |
| 73 | + `Blame::getGroupedLines()` and `Blame\Line::getLine()`. |
| 74 | +- `Log::setOffset()`, `setLimit()`, a negative offset or limit, an option of `git log` but |
| 75 | + `--all` as revision, and `count()` of a log whose offset or limit leaves commits out: it |
| 76 | + counts them all, where 2.0 counts the commits the log iterates. Use `countCommits()`. |
| 77 | +- `ReferenceBag::update()`, `Branch::isMergedTo()`, arguments of |
| 78 | + `Commit::getIncludingBranches()`, creating a branch or a tag that exists already, deleting |
| 79 | + a reference by another name than its full name under `refs/`. |
| 80 | +- Passing an argument to `Repository::getReferences()`, to read the references again: open |
| 81 | + a new `Repository`. |
| 82 | +- `PushReference::getReference()`, `getRevision()`, `isCreate()` and `isDelete()`. |
| 83 | +- `CommitReference`. `Tree::getEntries()`, `getBlobEntries()`, `getTreeEntries()` and |
| 84 | + `getCommitReferenceEntries()`, which return the entries as arrays: iterate the tree, or use |
| 85 | + `getBlobs()`, `getTrees()` and `getSubmodules()`. |
| 86 | +- The second argument of `WorkingCopy::checkout()`: use `checkoutNewBranch()`. A local |
| 87 | + `Branch` object, which `checkout()` detaches HEAD on, where 2.0 attaches HEAD to the branch: |
| 88 | + pass its name, or its commit. |
| 89 | +- Passing a revision name to `Repository::getTree()` or `getBlob()` instead of a hash, and |
| 90 | + passing data to the constructor of `Commit`, internal in 2.0. |
| 91 | +- `Repository::getSize()`, `Repository::shell()`, `Commit::getShortMessage()`, |
| 92 | + `Commit::getFixedShortHash()` and `Util\StringHelper`. |
| 93 | +- The parsers that 2.0 moves to its `CliDriver`, all but `DiffParser` and `ParserBase`. |
| 94 | +- The classes `final` in 2.0 are `@final since gitonomy/gitlib 1.7`. The constructors |
| 95 | + internal in 2.0 (`Commit`, `Tree`, `Blob`, `Revision`, `Reference`, `ReferenceBag`) say so. |
| 96 | + |
| 97 | +## [v1.6.0] - 2025-12-09 |
| 98 | + |
| 99 | +_Earlier versions are not documented here. See the |
| 100 | +[GitHub releases](https://github.com/gitonomy/gitlib/releases) and |
| 101 | +[commit history](https://github.com/gitonomy/gitlib/commits/v1.6.0) for prior changes._ |
| 102 | + |
| 103 | +[Unreleased]: https://github.com/gitonomy/gitlib/compare/v1.6.0...1.x |
| 104 | +[v1.6.0]: https://github.com/gitonomy/gitlib/releases/tag/v1.6.0 |
0 commit comments