Compare commits
No commits in common. "6f956ff56af0a65b6dd8f84aa845031c22998c61" and "d35f4d8241b21df380c90762c7e734ae4cef035e" have entirely different histories.
6f956ff56a
...
d35f4d8241
1 changed files with 3 additions and 10 deletions
|
|
@ -4,8 +4,6 @@
|
||||||
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
|
# Darren 'Tadgy' Austin <darren (at) afterdark.org.uk>
|
||||||
# Licensed under the terms of the GNU General Public License version 3.
|
# Licensed under the terms of the GNU General Public License version 3.
|
||||||
|
|
||||||
# shellcheck disable=SC2317
|
|
||||||
|
|
||||||
# Defaults.
|
# Defaults.
|
||||||
DB_FILE=".gitattributesdb" # Database file, relative to the repository root.
|
DB_FILE=".gitattributesdb" # Database file, relative to the repository root.
|
||||||
DB_EXTRA=".gitattributesdb-extra" # List of base64 encoded paths (one per line) to also store/restore attributes for.
|
DB_EXTRA=".gitattributesdb-extra" # List of base64 encoded paths (one per line) to also store/restore attributes for.
|
||||||
|
|
@ -175,7 +173,7 @@ store_attributes() {
|
||||||
|
|
||||||
# Function to restore path attributes from the database.
|
# Function to restore path attributes from the database.
|
||||||
restore_attributes() {
|
restore_attributes() {
|
||||||
local COUNT=0 ID FMT PATHNAME PREV_WARN=0 WARN=0
|
local COUNT=0 ID PATHNAME PREV_WARN=0 WARN=0
|
||||||
|
|
||||||
# Informational message.
|
# Informational message.
|
||||||
log "Restoring path attributes from database"
|
log "Restoring path attributes from database"
|
||||||
|
|
@ -211,16 +209,11 @@ restore_attributes() {
|
||||||
|
|
||||||
# Restore {a,m}times (and ACLs on Linux).
|
# Restore {a,m}times (and ACLs on Linux).
|
||||||
if [[ "$PLATFORM" == "Linux" ]]; then
|
if [[ "$PLATFORM" == "Linux" ]]; then
|
||||||
# BusyBox touch doesn't support nanosecond accuracy, so work around it.
|
touch -m -d "$(date -d "@${DB_MTIMES[$ID]}" +'%Y-%m-%d %H:%M:%S.%N' 2>/dev/null)0" -- "$PATHNAME" 2>/dev/null || {
|
||||||
FMT="%Y-%m-%d %H:%M:%S"
|
|
||||||
touch --help 2>&1 | grep BusyBox >/dev/null 2>&1 || {
|
|
||||||
FMT+=".%N"
|
|
||||||
}
|
|
||||||
touch -m -d "$(date -d "@${DB_MTIMES[$ID]}" +"$FMT" 2>/dev/null)" -- "$PATHNAME" 2>/dev/null || {
|
|
||||||
warn "Failed to restore mtime: $PATHNAME"
|
warn "Failed to restore mtime: $PATHNAME"
|
||||||
(( WARN++ ))
|
(( WARN++ ))
|
||||||
}
|
}
|
||||||
touch -a -d "$(date -d "@${DB_ATIMES[$ID]}" +"$FMT" 2>/dev/null)" -- "$PATHNAME" 2>/dev/null || {
|
touch -a -d "$(date -d "@${DB_ATIMES[$ID]}" +'%Y-%m-%d %H:%M:%S.%N' 2>/dev/null)0" -- "$PATHNAME" 2>/dev/null || {
|
||||||
warn "Failed to restore atime: $PATHNAME"
|
warn "Failed to restore atime: $PATHNAME"
|
||||||
(( WARN++ ))
|
(( WARN++ ))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue