scm/git: allow introspecting path lookup

Print path of first detected Git instead of executing it. This is hidden
behind a `--homebrew=print-path` argument that is unlikely to conflict
with any existing or future Git flags.
This commit is contained in:
Martin Afanasjew 2016-06-13 02:51:50 +02:00
parent 96cbce015e
commit a8165b6dbd

View File

@ -23,6 +23,10 @@ def exec(*args)
# prevent fork-bombs # prevent fork-bombs
arg0 = args.first arg0 = args.first
return if arg0 =~ /^#{F}/i || Pathname.new(arg0).realpath == SELF_REAL return if arg0 =~ /^#{F}/i || Pathname.new(arg0).realpath == SELF_REAL
if ARGV == %w[--homebrew=print-path]
puts arg0
exit
end
super super
end end