aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils
diff options
context:
space:
mode:
authormansimarkaur2017-08-25 17:19:34 +0530
committermansimarkaur2017-08-27 01:23:32 +0530
commitc695dffd373aefaaa84f1cf1098d23bd9f1d998d (patch)
tree76a2392aea90163100ae789e570e0ae8dc6b16e0 /Library/Homebrew/utils
parent372a42230510d24e539f2763ed148f7ba3ae7991 (diff)
downloadbrew-c695dffd373aefaaa84f1cf1098d23bd9f1d998d.tar.bz2
Added clear git version cache method
Diffstat (limited to 'Library/Homebrew/utils')
-rw-r--r--Library/Homebrew/utils/git.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/Homebrew/utils/git.rb b/Library/Homebrew/utils/git.rb
index 852192945..4fdcf1a2e 100644
--- a/Library/Homebrew/utils/git.rb
+++ b/Library/Homebrew/utils/git.rb
@@ -19,13 +19,17 @@ module Git
commit_hash = last_revision_commit_of_file(repo, relative_file, before_commit: before_commit)
out, = Open3.capture3(
HOMEBREW_SHIMS_PATH/"scm/git", "-C", repo,
- "show", "#{commit_hash}:#{file}"
+ "show", "#{commit_hash}:#{relative_file}"
)
out
end
end
module Utils
+ def self.clear_git_version_cache
+ remove_instance_variable(:@git) if instance_variable_defined?(:@git)
+ end
+
def self.git_available?
return @git if instance_variable_defined?(:@git)
@git = quiet_system HOMEBREW_SHIMS_PATH/"scm/git", "--version"