如何编写一个预加入挂钩,该挂钩检查是否修改了带有版本号的TXT文件



文件夹标签中的每个SVN项目,TRUNK具有版本的version.txt文件。我需要一些有关如何编写预称脚本的建议

尝试此has-changed-since-last-tag脚本:

#!/bin/bash  
file=${1:?Which file?}
# get latest tag
tag=$(git describe --abbrev=0)
# get content of file from the latest tag
fileFromTag=$(git show $tag:$file)
# compare current file with file from latest tag
! diff <(echo "$fileFromTag") $file > /dev/null

如果与上一个标签相比,给定文件的内容更改了,它将使用退出代码0返回。如果没有改变,它将返回1

最新更新