我试图运行一个.sh文件,它将为应用程序的所有文件提交作者详细信息。它工作正常的示例文件,但是当我试图运行相同的shell脚本几个文件的组合和提交ID我越来越致命的错误说路径不存在特定的提交ID。但实际上,该文件存在相同的提交ID。致命错误:提交ID中没有这样的路径“文件路径”
请说明问题的可能原因,并提出一些解决方案,以便我可以解决问题。下面是我使用的代码
#!/bin/bash
# get the list of files present in the current directory
files=`git ls-files "*.java"`
# removing whitespace
fn=($files)
# using for loop to iterate through each file
for ((j=0; j <${#fn[@]}; j++))
do
# To get the file name - as the fn returns the sub-directory path
filename=$(basename ${fn[$j]})
# split the Set of SHA values
IFS=';'
arr=($SHA)
# To iterate through each commit of the file
for ((i=0; i <${#arr[@]}; i++))
do
echo *fileName*
echo $filename
echo *EndfileName*
# To remove new line from the SHA id
commitId1=$(echo ${arr[$i]}|tr -d '\n')
owner=`git blame --line-porcelain ${fn[$j]} $commitId1 | grep "^author " | sort | uniq -c`
done
done
我是shell脚本和git的新手。所以请原谅我,如果代码是不好
我能够为相同的应用程序运行约1000个其他文件。甚至对于我遇到问题的文件的其他提交ID。 – Benjamin