Every SVN project in folders tags, and trunk has version.txt file with current number of the version. I need some advice on how to write a pre-commit script that would check if the version.txt in trunk was modifed to higher version than it is in tag.
Asked
Active
Viewed 372 times
1 Answers
2
Try this has-changed-since-last-tag
script:
#!/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
It will return with exit code 0
if the content of given file changed compared to last tag. If it didn't change, it returns 1
.

hnicke
- 602
- 4
- 7
-
Thanks, but i forgot to mention that it has to be in SVN not GIT – Mateusz Woźniak Jul 04 '19 at 11:24