diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 77ec788b9b..6eaa7be715 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -26,6 +26,12 @@ class AbstractDownloadStrategy def cached_location end + # @!attribute [r] + # return most recent modified time for all files in the current working directory after stage. + def source_modified_time + Pathname.pwd.to_enum(:find).select(&:file?).map(&:mtime).max + end + # Remove {#cached_location} and any other files associated with the resource # from the cache. def clear_cache @@ -555,6 +561,10 @@ class GitDownloadStrategy < VCSDownloadStrategy cp_r File.join(cached_location, "."), Dir.pwd end + def source_modified_time + Time.parse Utils.popen_read("git", "--git-dir", git_dir, "show", "-s", "--format=%cD") + end + private def cache_tag