>srclfs8 [ use_patch ]# echo "bbb" >> destlfs8 [ use_patch ]# ca_1 out of 1 hunk failed">
当前位置:   article > 正文

文件补丁管理 - patch_1 out of 1 hunk failed

1 out of 1 hunk failed

一、流程

1. 通过diff 查看文件修改前后(src、dest)内容差异,并将修改内容存入目标patch文件;

2. 通过patch命令操作源文件src,将修改内容patch添加至源文件;

二、注意点

1. diff操作时,注意文件顺序,顺序出现错误将导致 后续补丁操作失败;

  1. lfs8 [ use_patch ]# echo "aaa" >>src
  2. lfs8 [ use_patch ]# echo "bbb" >> dest
  3. lfs8 [ use_patch ]# cat src
  4. aaa
  5. lfs8 [ use_patch ]# cat dest
  6. bbb
  7. lfs8 [ use_patch ]# diff dest src > patch //patch 失败原因:diff操作时 修改前文件在后,修改后文件在前
  8. lfs8 [ use_patch ]# cat patch
  9. 1c1
  10. < bbb
  11. ---
  12. > aaa
  13. lfs8 [ use_patch ]# /usr/bin/patch -Np0 src -i patch //patch 失败现象
  14. patching file src
  15. Reversed (or previously applied) patch detected! Skipping patch.
  16. 1 out of 1 hunk ignored -- saving rejects to file src.rej
  17. lfs8 [ use_patch ]# ls
  18. dest patch src src.rej

三、标准流程实操

  1. lfs8 [ use_patch ]# echo "aaa" >> src
  2. lfs8 [ use_patch ]#
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/559578
推荐阅读
相关标签
  

闽ICP备14008679号