util–bash-simplify/git/git_loopCommit_findFind.sh
#!/bin/bash#【描述】 git仓库:循环所有提交、查找有无指定文件名
#【依赖】
#【术语】
#【备注】
#【用法举例】
# bash /app/bash-simplify/git/git_loopCommit_findFind.sh /app5/android-prj-home/libxposed/api master "XposedHooker.*"set -e -ushopt -s expand_aliases
alias alias_git=' git --work-tree=$gitRepoD --git-dir=$gitRepoD/.git/'
alias alias_gitLogList='( alias_git --no-pager log --pretty=format:"%H" ;)'function git_loopCommit_findFind(){[[ $# -lt 3 ]] && return 71local gitRepoD=$1
# gitRepoD=/app5/android-prj-home/libxposed/api
local initBranch=$2
# initBranch=master
local fileName=$3
# fileName=XposedHooker.*grep .git $gitRepoD/.git/config#url = https://gitlab.com/xposed_grp/LSPosed/libxposed/api.git#开发调试,统计文件个数,正常文件个数是变化的,以确定 此脚本 写到这里 有没有错误: 目测 正常
alias_git checkout $initBranch && alias_gitLogList | while read k; do ( alias_git checkout $k 2>/dev/null && find $gitRepoD -type f -not -path "*/.git/*" | wc -l ;); done
echo "(脚本自检)以上为每个提交中的 工作目录[${gitRepoD}]的文件个数,若是变化的(通常),则此脚本功能基本正常"#业务命令, git仓库:循环所有提交、查找有无指定文件名
alias_git checkout $initBranch && alias_gitLogList | while read k; do { ( alias_git checkout $k 2>/dev/null && find $gitRepoD -type f -name "$fileName" -not -path "*/.git/*" | grep . && echo " : $k " ;) || true ;}; done}export -f git_loopCommit_findFindgit_loopCommit_findFind $*
bash /app/bash-simplify/git/git_loopCommit_findFind.sh /app5/android-prj-home/libxposed/service/ master "XposedHooker.*"
无匹配:
url = https://gitlab.com/xposed_grp/LSPosed/libxposed/service.git
bash /app/bash-simplify/git/git_loopCommit_findFind.sh /app5/android-prj-home/libxposed/api master "XposedHooker.*"
有匹配:
url = https://gitlab.com/xposed_grp/LSPosed/libxposed/api.git/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 55efdf9d159195261d7326e9e125965a90025a12
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 54582730315ba4a3d7cfaf9baf9d23c419e07006
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 2f03a689cf70fde2b5af29d689c790993e93e0ab
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 02fd45cae80ca4edf560e2b23b13076fbb93d3f6
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: a42f85d06eac3373d266a534ab3b31a584b30774
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: e2588ee24bbef12c7c2e07666efa60e58e1ee6b3
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 325009e994d34ee90522486aec3fa5cc09597b8b
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: c0ad35ada563e14ead80e04c1ed3aecbabdb383c
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 97701a92998283a668f6670551b73211e73309d0
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 19c2201eec6025e03c5d54c2766d536cfd9eda5e
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 844d2984a02651fb66771cf4907d4ad68490e6c9
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: b581d269a34bdf0f7d2d209ea550b7208de71794
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 74534aa0c1511f963dda33ff839504440096822e
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 811c45551f0b203e936f6573d5008c84ece744de
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: f9236fb1c139b94dfd18882604de2de80ddb4f82
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 8842af1b7939bea5376a4876bdb4fbe4e0958cdf
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: b0f7fdca6df9b95553f4fe1fe0225d162cf56942
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: b6926a5fbaaeb72ad042a3647fd79665f2f45bd4
/app5/android-prj-home/libxposed/api/api/src/main/java/io/github/libxposed/api/annotations/XposedHooker.java: 4be04fc3ce8f37a8700671e54e00e92e2f769051