私はアプリケーションのすべてのファイルに対してコミットごとに著者の詳細をフェッチする.shファイルを実行しようとしていました。サンプルファイルでうまくいきましたが、いくつかのファイルの組み合わせで同じシェルスクリプトを実行しようとしているときに、IDがコミットIDに存在しないという致命的なエラーが表示されています。しかし実際には、そのファイルに対して同じコミットIDが存在します。致命的なエラー:コミットIDにそのようなパス "file path"がありません
問題の考えられる理由を説明し、問題を解決できるように解決策を提案してください。以下は私が使用しているコードです
#!/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
私はシェルスクリプトとgitの新機能です。だから、コードは全ての著者を取得するには
私は同じアプリケーションのために約1000の他のファイルのために動くことができました。そして、私が問題に直面したファイルの他のコミットIDについても。 – Benjamin