_brew | use git indexes mtime
This commit is contained in:
parent
d2c0d06d8f
commit
2a6b6036a2
@ -45,11 +45,9 @@ __brew_formulae_caching_policy() {
|
|||||||
! [[ -f "$1" ]] && return 0
|
! [[ -f "$1" ]] && return 0
|
||||||
# cache file modification date (seconds since epoch)
|
# cache file modification date (seconds since epoch)
|
||||||
local -i cache_mtime=$(date -r "$1" +%s)
|
local -i cache_mtime=$(date -r "$1" +%s)
|
||||||
# latest homebrew commit on HEAD (branch 'stable' by default)
|
# latest modified homebrew tap index file
|
||||||
local brew_repo=${HOMEBREW_PREFIX:-/usr/local}/Homebrew/.git
|
local latest_modified_git_index=(${HOMEBREW_REPOSITORY:-/usr/local/Homebrew}/Library/Taps/*/*/.git/index(om[1]))
|
||||||
local latest_commit=$(git --git-dir=${brew_repo} rev-parse HEAD) # --branches=refs/stable
|
local -i commit_mtime=$(date -r "$latest_modified_git_index" +%s)
|
||||||
# latest homebrew commit date (seconds since epoch)
|
|
||||||
local -i commit_mtime=$(git --git-dir=${brew_repo} rev-list -1 --format=format:'%at' $latest_commit | tail +2)
|
|
||||||
(( $cache_mtime < $commit_mtime ))
|
(( $cache_mtime < $commit_mtime ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user