Skip to content

Require gitlib 1.7 and fix its deprecations - #1237

Merged
veewee merged 1 commit into
phpro:v2.xfrom
lyrixx:gitlib-1.7
Oct 16, 2026
Merged

veewee merged 1 commit into
phpro:v2.xfrom
lyrixx:gitlib-1.7

Conversation

@lyrixx

@lyrixx lyrixx commented Oct 15, 2026

Copy link
Copy Markdown
Contributor
Q A
Branch v2.x
Bug fix? no
New feature? no
BC breaks? The constructor of GitRepository and GitRepositoryLocator::locate(), see below
Deprecations? no
Documented? no
Fixed tickets

gitlib 1.7 prepares the upgrade to 2.0: it has the API of 2.0 that 1.x can get, and deprecates
what 2.0 replaces. GrumPHP runs with 1.7 as is, but triggers two deprecations:

  • new Repository() with an array of options: the working directory is now its second argument,
    and a CliDriver configures git, with the logger;
  • Diff::setRepository(): Diff::parse() takes the repository.

This PR fixes both. Without deprecations with 1.7, GrumPHP runs with 2.0 with the same code: a
^1.7 || ^2.0 constraint will be enough, without branching on the version of gitlib.

CliDriver has no counterpart for inherit_environment_variables: Symfony Process makes git
inherit the environment variables anyway. git still gets the variables of the environment
configuration (Dotenv sets them in $_ENV and $_SERVER) and the PATH GrumPHP prepends to;
it no longer gets the entries of $_SERVER that aren't environment variables (PHP_SELF,
SCRIPT_NAME...).

GitRepository takes the CliDriver instead of the array of options, and passes it to
GitRepositoryLocator::locate(). The container builds both.

Tested in a repository with git:pre-commit (stashing the unstaged changes), run, and a diff on
stdin: no deprecation anymore, two before.

@veewee

veewee commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

@lyrixx Looks good.

So do I understand it correctly that I should tag this one and then later on the 2.x support? Or how do you see this?

@veewee
veewee merged commit cc92fa4 into phpro:v2.x Oct 16, 2026
26 checks passed
@lyrixx
lyrixx deleted the gitlib-1.7 branch October 16, 2026 13:13
@lyrixx

lyrixx commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

So do I understand it correctly that I should tag this one and then later on the 2.x support? Or how do you see this?

I think it's a good idea 👍🏼

After, there is no rush to upgrade to gitlib 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants