开发者

What really is a patch?

This was one of my interview questions which i couldn't answer.... Is it related to web de开发者_StackOverflow社区velopement?

  • What really is a patch?

and my interview question was

  • how will u start new patch?


A patch is a small release of source code that fixes a specific (and usually critical) issue in a product. Patches are also usually released outside of a normal release cycle due to an urgent issue.


patch(1) is a program that comes with most every Unix or Linux type system which takes a diff file as input and applies the differences that file contains. This means one developer can run the diff(1) tool on two versions of a bit of source code, then send the resulting diff file to someone else with one of these source versions, and they can patch their copy to look like the other version.

There are several different diff formats. patch(1) likes unified diffs best.

It is common for open source projects to request patches from outsiders in unified diff format. This lets the outsider make their changes, then produce a patch (that is, a unified diff file) that someone with checkin rights can apply to the source repository directly. Some source management systems -- Subversion, for example -- make this easy: "svn diff" gets you a unified diff, which isn't the default with the regular Unix diff command. You can thus say something like "svn diff > my-changes.patch" and get a patch file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜