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:
parent
5a905c2eba
commit
36a62ca339
2
build.sh
2
build.sh
|
|
@ -224,7 +224,7 @@ while [ "$#" -gt 0 ]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$doBuild" ]; then
|
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"
|
( set -x; docker build -t "$repoTag" "$gitRepo/$gitDir" ) &>> "$thisLog"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
files=( $(git ls-files) )
|
files=( $({ git ls-files | xargs dirname | sort -u && git ls-files; } | sort -r) )
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
||||||
for f in "${files[@]}"; do
|
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')"
|
touchFormat="$(date --date="$stamp" +'%Y%m%d%H%M.%S')"
|
||||||
touch --no-dereference -t "$touchFormat" "$f"
|
touch --no-dereference -t "$touchFormat" "$f"
|
||||||
done
|
done
|
||||||
Loading…
Reference in New Issue