Patch
From APIDesign
(Difference between revisions)
| Line 36: | Line 36: | ||
* I know the '''-R''' argument of the CLI command | * I know the '''-R''' argument of the CLI command | ||
* I know something more than [[I|you]]! | * I know something more than [[I|you]]! | ||
| + | |||
| + | === Embeddable Format === | ||
| + | |||
| + | The above [[diff]] format can be easily embedded into an email and sent as a ''part of a message''. E.g. surrounding the [[patch]] with prose sections as completely OK. The [[patch]] command line tool will just ignore everything not having the appropriate '''diff''' header | ||
Revision as of 08:02, 20 January 2026
How can a patch be distributed? When accepting API Patches and having proper Git repository infrastructure one can probably think of a patch as a pull request. However, there are older and I'd like to claim still useful ways to deliver patches that work well with Git and other versioning systems. In fact this old good way is still in the heart of these versioning systems. I am talking about:
diff --git channel/Channel.java channel/Channel.java index da14c1bce6..0db8858d0a 100644 --- a/channel/Channel.java +++ b/channel/Channel.java @@ -493,13 +494,10 @@ public final class Channel<Data extends Channel.Config> implements AutoCloseable * @return {@code true} if the exception was printed and further details should be printed */ private boolean printStackTrace(Throwable ex, boolean userCode) { - if (!userCode) { if (ex != null) { ex.printStackTrace(); } - return true; - } - return false; + return true; } /**
Quiz
What do you think about the above text?
- I have a feeling I understand the patch
- I known what those lines starting with + and - mean
- I can apply the same changes to existing Channel.java file manually
- I known tool to apply the changes for me
- It is a UI application
- I can do it from command line
- I ask AI to apply the change for me
- I know the -p argument of the CLI command
- I know the -R argument of the CLI command
- I know something more than you!
Embeddable Format
The above diff format can be easily embedded into an email and sent as a part of a message. E.g. surrounding the patch with prose sections as completely OK. The patch command line tool will just ignore everything not having the appropriate diff header