Update git-set-mtimes script to also set directory timestamps and to use the "author date" instead of the "committer date" since that's what's shown in a bare "git log" (so it ends up being less surprising)

This obviously deprecates any need for the old "git-set-dir-times" script, so it's also removed here.
This commit is contained in:
Tianon Gravi 2014-09-23 20:52:04 -06:00
parent 5a905c2eba
commit 36a62ca339
3 changed files with 3 additions and 22 deletions

View File

@ -224,7 +224,7 @@ while [ "$#" -gt 0 ]; do
done
if [ "$doBuild" ]; then
( set -x; cd "$gitRepo/$gitDir" && "$dir/git-set-dir-times" ) &>> "$thisLog"
( set -x; cd "$gitRepo/$gitDir" && "$dir/git-set-mtimes" ) &>> "$thisLog"
( set -x; docker build -t "$repoTag" "$gitRepo/$gitDir" ) &>> "$thisLog"

View File

@ -1,19 +0,0 @@
#!/bin/bash
set -e
"$(dirname "$(readlink -f "$BASH_SOURCE")")/git-set-file-times"
IFS=$'\n'
topLevelDirs=( $(find -mindepth 1 -maxdepth 1 -type d -not -name .git) )
unset IFS
IFS=$'\n'
allDirs=( $(find "${topLevelDirs[@]}" -depth -type d) . )
unset IFS
for dir in "${allDirs[@]}"; do
ref="$(ls -At "$dir" | grep -v '^.git$' | head -1)"
if [ "$ref" ]; then
touch --no-dereference --reference "$dir/$ref" "$dir"
fi
done

View File

@ -2,11 +2,11 @@
set -e
IFS=$'\n'
files=( $(git ls-files) )
files=( $({ git ls-files | xargs dirname | sort -u && git ls-files; } | sort -r) )
unset IFS
for f in "${files[@]}"; do
stamp="$(git --no-pager log -1 --format='format:%ci' -- "$f")"
stamp="$(git --no-pager log -1 --format='format:%ai' -- "$f")"
touchFormat="$(date --date="$stamp" +'%Y%m%d%H%M.%S')"
touch --no-dereference -t "$touchFormat" "$f"
done