Skip to content

Commit a23ec23

Browse files
committed
Better docs
1 parent 07d5484 commit a23ec23

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ It's (kind-of) an alternative to two other great plugins (differences will becom
4141
_<sup>1</sup> Root package patching is the exception, please see [applying patches to root package](docs/usage.md#applying-patches-to-root-package-root-project-folder) in usage docs._
4242

4343

44-
### Some feature hilights
44+
## Feature description
4545

4646
- Apply patches from dedicated composer packages (package your patchset!).
4747
- Each patch can have a version constraint (composer semver) checked against the target package.
@@ -63,7 +63,19 @@ _<sup>1</sup> Root package patching is the exception, please see [applying patch
6363

6464
Double composer update/install for build is not necessary.
6565

66-
### Chicken or egg problem
66+
## Use Git for applying patches
67+
68+
By default the library will try to use the `patch` command if not available and fall back to `git` otherwise.
69+
You can force using git for each patch (see: [Usage Documentation](docs/usage.md)).
70+
71+
There were some problems using `git apply` reported in other plugins for packages that were not installed
72+
as source (did not have a git repo; `.git` dir). I was not able to reproduce this problem with git 2.X - however -
73+
a workaround for this potential problem has been implemented:
74+
75+
- If the target package has `.git` directory, then the patches are applied relative to target package root
76+
- If no git repo in target package then patches are applied from root project directory
77+
78+
## Chicken or egg problem
6779

6880
Patching via composer plugin has one big problem - you cannot catch all events on the first install.
6981
Furthermore applying patches on package install/remove is very error prone as you can never predict
@@ -79,7 +91,7 @@ of your project then you should patch the root package because the patch applica
7991
plugins have done their work so patching source files in vendor will have no effect.**
8092

8193

82-
### No remote patches
94+
## Why no remote patches
8395

8496
This plugin will not download patches from external sources directly (http). I consider this a bad practice and will
8597
never support it. I won't even comment on downloading patches using unencrypted connection without SHA check. Also what

docs/testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
This plugin uses a special sandbox which allows it to run composer as a separate process during testing.
66

7-
A fake local packagist repository is created from [package definitions](tests/Functional/Fixtures/Packages)
7+
A fake local packagist repository is created from [package definitions](/tests/Functional/Fixtures/Packages)
88
for the purpose of testing by using internally [Satis](https://github.com/composer/satis) as a library.
99

10-
See the [ComposerSandbox](tests/Functional/Fixtures/ComposerSandbox.php) class for the details.
10+
See the [ComposerSandbox](/tests/Functional/Fixtures/ComposerSandbox.php) class for the details.
1111

1212
## Running tests
1313

docs/usage.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ _Use this way to easily distribute your patchset and use it in multiple projects
5656

5757
## Define patches in your root package
5858

59-
# Composer json configuration reference
59+
# JSON configuration reference
6060

6161
## Patch properties
6262

@@ -84,6 +84,15 @@ This has the same effect as the `-p{x}` switch of the patch command, where `{x}`
8484

8585
For 99% of the patches this will be the default `1`. Set this only if your patch was generated in some non-standard way.
8686

87+
### `method` (string, default: `"patch"`)
88+
89+
There are two methods of application: `patch` and `git`.
90+
91+
By default the library will attempt to use the `patch` binary and fall back to `git apply` if not available.
92+
93+
If you want to force using `git apply` for patches that are compatible only with `git` you can do so
94+
with this parameter on patch level.
95+
8796
# Notable use-cases
8897

8998
## Applying patches to root package (root project folder)
@@ -97,3 +106,4 @@ project manually. The plugin will warn you when this is the case but will not fa
97106
to apply any new root package patches though.
98107

99108
__New patches will be applied to the root package but then _application order_ is not guaranteed.__
109+

0 commit comments

Comments
 (0)