Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
SSH121 committed Apr 20, 2023
1 parent 9f85ae6 commit 300df8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@
-a 可选 git库 较旧的提交id
-b 可选 git库 较新的提交id

脚本运行时会产生log 放置在脚本目录下的update文件夹
脚本运行时会产生log 放置在脚本目录下的update文件夹

PS: 如果部分远程目录与本地目录无法做到对应 文件会默认为新增 因此需要特别检查 远程目录与本地目录不重合的部分是否有文件新增
16 changes: 13 additions & 3 deletions sh-updateDiff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ function random()

param_pattern="j:r:w:l:a:b:"
OPTIND=1
judgementWord="wink;"
replaceWord="NG;"
judgementWord="judgement;"
replaceWord="replace;"

config=$(cat sh-config.json | sed -r 's/",/"/' | egrep -v '^[{}]' | sed 's/"//g' | sed 's/:/=/1' | sed -r 's/ //g')
declare $config
Expand Down Expand Up @@ -162,7 +162,7 @@ localPath=$(pwd)
if [ "$(git diff HEAD)" == "" ];then
echo "本地仓库无修改"
else
echo "本地仓库有修改, 是否退出自行处理? (y/n)"
echo "本地仓库有修改, 是否退出自行处理? (y/n) \n y 退出脚本 \n n 脚本将仓库记录还原到HEAD状态"
read confirmation
if [ "$confirmation" == "y" ]; then
exit
Expand Down Expand Up @@ -197,6 +197,7 @@ diffContent=$(cat $dicPath/diff.txt | tr "\n" ";")
IFS=';' read -ra diffs <<< "$diffContent"

fileNumber=0
unCheckNumber=0
for item in "${diffs[@]}";
do
file="$item"
Expand Down Expand Up @@ -256,6 +257,7 @@ do
cp $localPath/"$file" $fileDic/本地文件.$fileExtension
echo $file | tee -a $fileDic/diff.txt
log "复制双文件到 "$fileDic
((unCheckNumber++))
continue
fi
if [[ "$fileType" == "code" || "$fileType" == "txt" ]];
Expand Down Expand Up @@ -283,6 +285,7 @@ do
echo $file | tee -a $fileDic/path.txt
git diff $aCommit $bCommit -- ./$file | tee -a $fileDic/diff.txt
log "复制双文件到 "$fileDic
((unCheckNumber++))
hasJudgement=true
break
fi
Expand Down Expand Up @@ -313,6 +316,7 @@ do
echo $file | tee -a $fileDic/path.txt
git diff $aCommit $bCommit -- ./$file | tee -a $fileDic/diff.txt
log "复制双文件到 "$fileDic
((unCheckNumber++))
hasReplace=true
break
fi
Expand All @@ -322,7 +326,13 @@ do
fi
cp $workPath/"$file" $localPath/"$file"
log "复制文件 "$workPath/"$file"
log ""$localPath/"$file"
fi
fi
done

log "\n"
echo "脚本运行结束:"
log " 共处理文件数量: "$fileNumber
log " 待整理文件数量: "$unCheckNumber

0 comments on commit 300df8f

Please sign in to comment.