git create patch with diff

Try a: git apply –ignore-space-change –ignore-whitespace patch.diff As mentioned in “git: patch does not apply”, this can be caused by: the line endings differing between the local file system and the remote repo. User core.eol in .gitattributes file is a good approach (see “git force file encoding on commit”) the execution bit (‘x‘). That can … Read more

How to make and apply SVN patch?

Use svn patch. Case 1: using /usr/bin/patch: svn diff > $TMPDIR/mypatchfile.patch cd myOtherCheckOut patch -p0 < $TMPDIR/mypatchfile.patch Applies your changes well if there are no added/deleted files through svn add or svn delete Case 2: using svn patch: svn diff > $TMPDIR/mypatchfile.patch cd myOtherCheckOut svn patch $TMPDIR/mypatchfile.patch Tracks added and deleted files too. Note that … Read more

How to do PATCH properly in strongly typed languages based on Spring – example

TL;DR patchy is a tiny library I’ve come up with that takes care of the major boilerplate code needed to properly handle PATCH in Spring i.e.: class Request : PatchyRequest { @get:NotBlank val name:String? by { _changes } override var _changes = mapOf<String,Any?>() } @RestController class PatchingCtrl { @RequestMapping(“/”, method = arrayOf(RequestMethod.PATCH)) fun update(@Valid request: … Read more

Python mock patch a function called by another function

First example suggests that f1() and f2() defined in the same module. Hence the following should work: from foo.bar import f2 from mock import patch class MyTest(TestCase): @patch(‘foo.bar.f1’) def test_f2_2(self, some_func): some_func.return_value = (20, False) num, stat = f2() self.assertEqual((num, stat), (40, False)) Patch is on the same as import: @patch(‘foo.bar.f1’) Here is a good … Read more

Create a patch including specific files in git

You can create a patch file by restricting the output of git diff by listing paths at the end of the command (after a — to avoid any potential clashes between path names and branch names). For example, you could do the following: git diff origin/master HEAD — app/models/region.rb doc/ > changes.patch Above commands generate … Read more