Questions tagged [patch]

A patch is a piece of software designed to fix problems with, or update a computer program or its supporting data. This includes fixing security vulnerabilities and other bugs, and improving the usability or performance.

Programmers publish and apply patches in various forms. Because proprietary software authors withhold their source code, their patches are distributed as binary executables instead of source. This type of patch modifies the program executable—the program the user actually runs—either by modifying the binary file to include the fixes or by completely replacing it.

Patches can also circulate in the form of source code modifications. In these cases, the patches consist of textual differences between two source code files. These types of patches commonly come out of open source projects. In these cases, developers expect users to compile the new or changed files themselves.

Because the word "patch" carries the connotation of a small fix, large fixes may use different nomenclature. Bulky patches or patches that significantly change a program may circulate as "service packs" or as "software updates". Microsoft Windows NT and its successors (including Windows 2000, Windows XP, and later versions) use the "service pack" terminology.

In several Unix-like systems, particularly Linux, updates between releases are delivered as new software packages. These updates are in the same format as the original installation so they can be used either to update an existing package in-place (effectively patching) or be used directly for new installations.

2809 questions
143
votes
5 answers

How to apply a Git patch to a file with a different name and path?

I have two repositories. In one, I make changes to file ./hello.test. I commit the changes and create a patch from that commit with git format-patch -1 HEAD. Now, I have a second repository that contains a file that has the same contents as…
mart1n
  • 5,969
  • 5
  • 46
  • 83
130
votes
5 answers

What does "1 line adds whitespace errors" mean when applying a patch?

I'm editing some markdown files of a cloned remote repository, and wanted to test creating and applying patches from one branch to another. However, every time I make any change at all, I get the following message during git apply: 0001-b.patch:16:…
Yarin
  • 173,523
  • 149
  • 402
  • 512
114
votes
3 answers

What is the difference between 'git format-patch and 'git diff'?

I don't see a difference between the output of 'git format-patch' and 'git diff', is there any? And won't I be able to use 'git diff' to produce a patch and then apply it using git apply? My problem is that I have changes added to the index, but…
Rafid
  • 18,991
  • 23
  • 72
  • 108
107
votes
4 answers

TortoiseHg Apply a Patch

TortoiseHg allows you to email a patch file of your changes to someone, but does it support applying patches? If so, how do you apply a patch using TortoiseHg?
Michael La Voie
  • 27,772
  • 14
  • 72
  • 92
106
votes
4 answers

What is the format of a patch file?

What does the following mean ? diff -rBNu src.orig/java/org/apache/nutch/analysis/NutchAnalysisConstants.java src/java/org/apache/nutch/analysis/NutchAnalysisConstants.java --- src.orig/java/org/apache/nutch/analysis/NutchAnalysisConstants.java…
omg
  • 136,412
  • 142
  • 288
  • 348
106
votes
3 answers

Title for matplotlib legend

I know it seems fairly redundant to have a title for a legend, but is it possible using matplotlib? Here's a snippet of the code I have: import matplotlib.patches as mpatches import matplotlib.pyplot as plt one = mpatches.Patch(facecolor='#f3f300',…
Brandon Molyneaux
  • 1,543
  • 2
  • 12
  • 23
102
votes
7 answers

How to apply a git patch from one repository to another?

I have two repositories, one is the main repo for a library, and the other is a project using that library. If I make a fix to the in the subservient project, I'd like an easy way to apply that patch back upstream. The file's location is different…
James Wheare
  • 4,650
  • 2
  • 26
  • 22
98
votes
13 answers

git add --interactive "Your edited hunk does not apply"

I'm trying to use git add --interactive to selectively add some changes to my index, but I continually receive the "Your edited hunk does not apply. Edit again..." message. I get this message even if I choose the e option, and immediately…
Josh
  • 2,077
  • 1
  • 17
  • 21
97
votes
4 answers

How to create a patch for a whole directory to update it?

I know there are several threads on this already, but no one has fully explained exactly how to perform the initial diff to create the patch file, then how to apply that patch to the initial directory to update it. In my case, there is a directory…
poundifdef
  • 18,726
  • 23
  • 95
  • 134
93
votes
5 answers

Mocking a global variable

I've been trying to implement some unit tests for a module. An example module named alphabet.py is as follows: import database def length_letters(): return len(letters) def contains_letter(letter): return letter in letters letters =…
Funkatic
  • 1,113
  • 1
  • 8
  • 14
91
votes
2 answers

Git error: previous rebase directory .git/rebase-apply still exists but mbox given

I'm trying to apply a patch, which I took from http://www.winehq.org/pipermail/wine-devel/2014-May/104356.html. I copied it into a text editor, and saved it as my.patch (I needed to fix the email, it had been obfuscated). I tried to apply it with…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
87
votes
6 answers

How to use PATCH verb with curl

I am trying to make a PATCH call to a server. I am using the following command: curl --data status=closed -X PATCH https://api.viafoura.com/v2/dev.viafoura.com/pages/7000000043515 Is this the correct way of sending the PATCH request? I am getting…
sheidaei
  • 9,842
  • 20
  • 63
  • 86
84
votes
5 answers

PATCH Async requests with Windows.Web.Http.HttpClient class

I need to do a PATCH request with the Windows.Web.Http.HttpClient class and there is no official documentation on how to do it. How can I do this?
Schrödinger's Box
  • 3,218
  • 1
  • 30
  • 51
80
votes
4 answers

How do I make a PATCH request in PHP using cURL?

I have to make a PATCH request using PhP cURL. I couldn't find any documentation, so I tried the following but it isn't working. $data = "{'field_name': 'field_value'}"; $url = "http://webservice.url"; $headers = array('X-HTTP-Method-Override:…
Sandeep M
  • 2,942
  • 2
  • 13
  • 17
80
votes
2 answers

git hunk edit mode - how to remove a '-' line?

+ bbb - aaa # --- # To remove '-' lines, make them ' ' lines (context). # To remove '+' lines, delete them. # Lines starting with # will be removed. # # If the patch applies cleanly, the edited hunk will immediately be # marked for staging. If it…
Lai Yu-Hsuan
  • 27,509
  • 28
  • 97
  • 164