首页 > 编程知识 正文

patch请求方式,patch补丁文件

时间:2023-05-06 14:06:41 阅读:115326 作者:2997

Git修补程序- -使用-- patch和diff (

git diff和diff生成的文档摘要

关于git patch制作的概要

git格式路径的使用方法

如果要更改的patch当前具有git仓库,则可以直接从当前git仓库下使用git格式路径创建patch文件。 通常,在当前仓库下,patches目录包含. patch文件。 必须修改a.c文件,patches目录下已经有. patch和a.c文件

如果进行了更改,通常需要编译此package,然后在编译目录下查找a.c源文件。 编译目录下的源文件是命中当前patches下所有patches的源文件。 将此源文件替换为仓库下面的源文件并提交一次commit,然后根据这次的commit进行自己的修改,提交自己的commit,然后使用git格式路径创建路径。 将最后创建的patch放在patches目录下提交gerrit。

如果要更改的package中不存在git仓库,则openwrt下的大多数package就是这种情况。 在这种情况下,编译的sorce来自opensource,源代码下载的连接通常在Makefile中指定。 此时,自己创建git clone opensource的源代码仓库,并将在本地编译目录中要修改的文件替换为该仓库下的文件来创建patch。

当然,使用quilt工具在openwrt中创建路径更方便。

包/libs/lib nl

Makefile patches/

sourceurl:https://github.com/thom 311/lib nl/release/download/.

git clone https://github.com/thom 311/lib nl.git

git diff创建的. patch不包含commit信息,git format -patch创建的patch包含commit信息。

1.gitdiffcommitid1com mid2(commit id1ispreviouscommitone,commitid2 is current commit one ) )。

gitdiffcommitid1commit id2test.patch

diff-- gita/src/fok/file1. CB/src/fok/file1. cindex 0d 3c 576 . e5c4f 35100644-- a/src/fok/file1. CB/C6 @ @ staticintmy _ type _ get (u8 type )-staticintmy_value_set ) void*priv, char value )/* myvaluesetfunction diff-- gita/src/test/file2. CB/src/test/file2. cindex3Fe 44 BD.5372 FBC 10644 file2. cb8 @ @ staticintmy _ input _ check (struct my _ structure * structure,}msg_dump ) msgdump,' mydebuginformation/* belowischecking . */next=(结构a* )结构; for(I=0; ilen; I )2. git格式路径

src/fok/file1. c|3 -表示file1. c中有三行更改,插入了两行,删除了一行

src/test/file2. c|2 -表示file2. c中的两行已更改,插入了一行,删除了一行

2 files changed,3 insertions (,2 deletions(-) -表示共对两个文件进行了更改,共插入了三个,删除了两个

@@-456、456、6@@表示在从这里开始修正之前是第456行至第5行,即456-460行,是下图patch内容的17、18、19、22、23; 修改后,有456至6行,即456-461行。 下图中patch内容的17、18、20、21、22、23行file1.c删除了一行并插入了两行

由此可见,如果在file1.c之后有修改,则修改前的格式为在643行开始修改后在644行开始(因为在上一次修改时引入了多一行)。

@ @ 643,4644,6 @ @

from0c 3456 b 953 d 12 f 570 c 341 f 032 ab 854 c9d 100 AC 56 sunnov 29003360002020 from : username username @ example.mail date 3360 sun 29 nov CT : [ patch ] test : giveanexampleforpatchsigned-off-by :用户名称用户@ ex ample fok/file1. c|3-src/tttt 3 insertions (2deletions---diff---- gita/src/fok/file1. CB/src/fok/file1. cindex 0d 3c 576.e5c4f 3510066 fooc6@ @ staticintmy _ type _ get (u8 type )-staticintmy_value_set ) void*priv, char value )/* myvaluesetfunction diff-- gita/src/test/file2. CB/src/test/file2. cindex3Fe 44 BD.5372 FBC 10644 file2. cb8 @ @ staticintmy _ input _ check (struct my _ structure * structure,}msg_dump ) msgdump,' mydebuginformation/* belowischecking . */next=(结构a* )结构; for(I=0; ilen; I----2.7.4

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。