find funcs from git diff

#!/bin/bash


more diff.txt | awk '


function  printp(str) {
print(NR"  "str)
}


BEGIN{
cur=-1
last_func_display=""
size=0
still_in_origin_function_flag=1




}


{
if($1=="diff" || $1=="@@"){
/* printp("1") */


still_in_origin_function_flag = 1
if(last_func_display==""){
/* printp("2") */
}else{
/* printp("3") */
for(new_func in found_new_funcs){
print(fn[cur]"("found_new_funcs[new_func])
}


delete found_new_funcs
size=0
last_func_display=""
}
}


if($1=="+++"){


/* printp("4") */


cur++
fn[cur]=$2;
}else if($1=="@@"){


/* printp("5") */


last_func_display=$6
}else if($0~/^\+[0-z_]+ +[0-z_]+ *\(/){


/* printp("6") */


found_new_funcs[size++]=$2
still_in_origin_function_flag=0


}else if($0~/^\+[^+]/ && still_in_origin_function_flag==1){


/* printp("7") */


found_new_funcs[size++]=last_func_display
still_in_origin_function_flag=0

}
}


END{
for(new_func in found_new_funcs){
print(fn[cur]"("found_new_funcs[new_func])
}
}
'
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值