打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
用git查找期望的patch

1、用git blame -L xxx.c 多少行,+多少行以下几行(如+5)


root@gavin-desktop:/home/gavin/workdir/kernel_srcresp/linux-2.6# git blame -L 236,+5 arch/powerpc/Kconfig
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 236) config PPC_ADV_DEBUG_REGS
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 237)  bool
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 23

  depends on 40x || BOOKE
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 239)  default y
172ae2e7 (Dave Kleikamp 2010-02-08 11:50:57 +0000 240)
root@gavin-desktop:/home/gavin/workdir/kernel_srcresp/linux-2.6#



2、上面可以提供的信息有hash值、作者、相关宏定义

3.1 、根据hash值查找


(1) git diff-tree -p 172ae2e7 > xx.diff
(2) git format-patch -1 172ae2e7



3.2、根据作者查找patch


git log --author="Dave Kleikamp"
实际此方法只是列出此作者提交的所有patch的log,从而得到hash值再用3.1的方法得到patch



3.3、根据某个关键字查找


linux-2.6# git log --grep="CONFIG_PPC_ADV_DEBUG_REGS" arch/powerpc/Kconfig
commit 172ae2e7f8ff9053905a36672453a6d2ff95b182
Author: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Date:   Mon Feb 8 11:50:57 2010 +0000

    powerpc/booke: Introduce new CONFIG options for advanced debug registers
   
    powerpc/booke: Introduce new CONFIG options for advanced debug registers
   
    From: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
   
    Introduce new config options to simplify the ifdefs pertaining to the
    advanced debug registers for booke and 40x processors:
   
    CONFIG_PPC_ADV_DEBUG_REGS - boolean: true for dac-based processors
    CONFIG_PPC_ADV_DEBUG_IACS - number of IAC registers
    CONFIG_PPC_ADV_DEBUG_DACS - number of DAC registers
    CONFIG_PPC_ADV_DEBUG_DVCS - number of DVC registers
    CONFIG_PPC_ADV_DEBUG_DAC_RANGE - DAC ranges supported
   
    Beginning conservatively, since I only have the facilities to test 440
    hardware.  I believe all 40x and booke platforms support at least 2 IAC
    and 2 DAC registers.  For 440, 4 IAC and 2 DVC registers are enabled, as
    well as the DAC ranges.
   
    Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
    Acked-by: David Gibson <dwg@au1.ibm.com>
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
此方法同3.2,也是得到hash值再用3.1的方法得到patch



几种方法入手点不同,适合于不同的需要


这些东西肯定很多人都会用了,之前没用过git,只是需要找东西才拿起来试试,班门弄斧,请勿见怪

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
版本管理三国志 (CVS, Subversion, git)
什么是Merkle Tree
git format
git checkout 命令详解
你真的懂git rebase吗?
删除git中的提交信息(git-reset)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服