git命令不会读取特定文件的第一次提交。我的脚本如下

时间:2017-08-02 00:23:33

标签: git bash grep commit git-commit

1.我正在尝试读取特定文件的所有提交,如果他们添加/删除了关键字" compile"。 2.它没有读取第一个提交,这些更改与"编译"相关。 3.问题是什么?

 if grep 'compile.*' build.gradle| awk 'BEGIN {print "Dependencies" }  
                                                   { print $0 }'>>/Users/rohan/Capstone/testoutput.csv  #startifDependencies
        then 
        found=found+1
        git log --pretty=format:"%h" -- build.gradle | while read -r LINE
        do   #startDo2
            if git show $LINE build.gradle | egrep '^\-\s+compile.*' > /dev/null
                then
                lib=$(git show $LINE build.gradle | egrep '^\-\s+compile.*' | cut -d\' -f2)
                git log -1 --pretty=format:"$lib,$f,%cn,removed,%h,%ad,$found" $LINE build.gradle |  awk '{print $0}'>>/Users/rohan/Capstone/testoutput_1.csv

                elif git show $LINE build.gradle | egrep '^\+\s+compile.*' > /dev/null
                then
                lib=$(git show $LINE build.gradle | egrep '^\+\s+compile.*' | cut -d\' -f2)
                git log -1 --pretty=format:"$lib,$f,%cn,added,%h,%ad,$found" $LINE build.gradle | awk '{print $0 }'>>/Users/rohan/Capstone/testoutput_1.csv
            fi
        done  #endDo2
        else echo "Dependencies not found">>/Users/rohan/Capstone/testoutput_1.txt
        fi   #endifDependencies
        elif cd $w/$f/

0 个答案:

没有答案