composer-patches: Patches fail to apply with older versions of Git
With Composer Patches 1.6.3, patches will silently fail to apply on machines with older versions of Git installed. I think it will fail for versions prior to Git 2.9.0, based on this commit: https://github.com/git/git/commit/3f5794493c7a0ba2bba0278b9129d98df343d341
Empirically, I’ve tested and verified that Git versions 2.11.0 and above work fine, while 2.7.4 and before fail. I haven’t had time to build the versions in between from source in order to test.
I haven’t yet determined whether this is a regression introduced by https://github.com/cweagans/composer-patches/pull/165
I don’t see why that would have caused a regression. But in testing, Composer Patches 1.6.2 works fine while Composer Patches 1.6.3 fails in at least one environment: https://github.com/acquia/lightning/pull/524
I think the problem is that older versions of git apply silently fail to apply patches, so there’s no way for Composer Patches to verify whether they’ve applied correctly or not. But again, I’m not sure how to reconcile that with the changes in https://github.com/acquia/lightning/pull/524, which should have only been more aggressive in catching git apply failures.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (3 by maintainers)
Commits related to this issue
- Fixes #174: Compatibility with older Git versions. — committed to danepowell/composer-patches by danepowell 7 years ago
- Merge pull request #175 from danepowell/issue-174 Fixes #174: Compatibility with older Git versions. — committed to cweagans/composer-patches by cweagans 7 years ago
- Merge pull request #175 from danepowell/issue-174 Fixes #174: Compatibility with older Git versions. Modifying source to promet/composer-patches, adding a var_dump(); die — committed to promet/composer-patches by cweagans 7 years ago
- Fixes #174: Compatibility with older Git versions — committed to stucki/composer-patches by stucki 6 years ago
- Fixes #174: Compatibility with older Git versions — committed to stucki/composer-patches by stucki 6 years ago
- Update to git >= 2.11 - see https://github.com/cweagans/composer-patches/issues/174 — committed to LastCallMedia/PHP-Docker by rbayliss 6 years ago
Do you have any suggestions for how we can get around this? One thought is that we could check for the presence of a .git dir, and only use
git applyif it exists (otherwise, fall back topatch). What do you think about that?Le sigh.
git–
A fix is pending in https://github.com/cweagans/composer-patches/pull/175, but for anyone that needs an immediate workaround, you can pin composer-patches to 1.6.2 or use my fork. Add the following to your
composer.json:Depending on what other dependencies you have installed, you might need to change the alias to 1.6.3.