WIP: Use git commit times instead of file timestamps when possible #952
|
@ -7,6 +7,16 @@ inc_scaffold=true
|
|||
[ -z "$inc_fundraising" ] && . "$basedir/build/fundraising.sh"
|
||||
[ -z "$inc_sources" ] && . "$basedir/build/sources.sh"
|
||||
|
||||
# Return the commiter time of the given file in seconds since unix
|
||||
# epoch. If file is not controlled by git return empty string.
|
||||
get_commit_time() {
|
||||
local filename=$1
|
||||
curdir=`pwd`
|
||||
cd `dirname $filename` # git expects to be running inside the repo
|
||||
git log -1 --format=%ct "${shortname}.${olang}.xhtml" 2>/dev/null
|
||||
cd $curdir
|
||||
}
|
||||
|
||||
build_xmlstream(){
|
||||
# assemble the xml stream for feeding into xsltproc
|
||||
# the expected shortname and language flag indicate
|
||||
|
@ -24,7 +34,14 @@ build_xmlstream(){
|
|||
|
||||
if [ -f "${shortname}.${lang}.xhtml" ]; then
|
||||
act_lang="$lang"
|
||||
[ "${shortname}.${olang}.xhtml" -nt "${shortname}.${lang}.xhtml" ] && outdated=yes
|
||||
# compare committer dates
|
||||
time_o=`get_commit_time "${shortname}.${olang}.xhtml"`
|
||||
time_l=`get_commit_time "${shortname}.${lang}.xhtml"`
|
||||
if [ -z "$time_o" ] || [ -z "$time_l" ]; then
|
||||
[ "${shortname}.${olang}.xhtml" -nt "${shortname}.${lang}.xhtml" ] && outdated=yes
|
||||
else
|
||||
[ $time_o -gt $time_l ] && outdated=yes
|
||||
fi
|
||||
else
|
||||
act_lang="$olang"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue