cmd/log: improve output messaging.
This wasn’t adapted to the new, multiple repository world.
This commit is contained in:
parent
8cedd62750
commit
623c95b3f8
@ -9,20 +9,32 @@ module Homebrew
|
|||||||
|
|
||||||
def log
|
def log
|
||||||
if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
cd HOMEBREW_REPOSITORY
|
git_log HOMEBREW_REPOSITORY
|
||||||
git_log
|
|
||||||
else
|
else
|
||||||
path = Formulary.path(ARGV.named.first)
|
path = Formulary.path(ARGV.named.first)
|
||||||
cd path.dirname # supports taps
|
tap = Tap.from_path(path)
|
||||||
git_log path
|
git_log path.dirname, path, tap
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_log(path = nil)
|
def git_log(cd_dir, path = nil, tap = nil)
|
||||||
if File.exist? "#{`git rev-parse --show-toplevel`.chomp}/.git/shallow"
|
cd cd_dir
|
||||||
|
repo = Utils.popen_read("git rev-parse --show-toplevel").chomp
|
||||||
|
if tap
|
||||||
|
name = tap.to_s
|
||||||
|
git_cd = "$(brew --repo #{tap})"
|
||||||
|
elsif cd_dir == HOMEBREW_REPOSITORY
|
||||||
|
name = "Homebrew/brew"
|
||||||
|
git_cd = "$(brew --repo)"
|
||||||
|
else
|
||||||
|
name, git_cd = cd_dir
|
||||||
|
end
|
||||||
|
|
||||||
|
if File.exist? "#{repo}/.git/shallow"
|
||||||
opoo <<-EOS.undent
|
opoo <<-EOS.undent
|
||||||
The git repository is a shallow clone therefore the filtering may be incorrect.
|
#{name} is a shallow clone so only partial output will be shown.
|
||||||
Use `git fetch --unshallow` to get the full repository.
|
To get a full clone run:
|
||||||
|
git -C "#{git_cd}" fetch --unshallow
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
args = ARGV.options_only
|
args = ARGV.options_only
|
||||||
|
|||||||
@ -33,7 +33,7 @@ describe "brew log", :integration_test do
|
|||||||
|
|
||||||
expect { brew "log", "#{shallow_tap}/testball" }
|
expect { brew "log", "#{shallow_tap}/testball" }
|
||||||
.to output(/This is a test commit for Testball/).to_stdout
|
.to output(/This is a test commit for Testball/).to_stdout
|
||||||
.and output(/Warning: The git repository is a shallow clone/).to_stderr
|
.and output(%r{Warning: homebrew/shallow is a shallow clone}).to_stderr
|
||||||
.and be_a_success
|
.and be_a_success
|
||||||
|
|
||||||
expect(shallow_tap.path/".git/shallow").to exist, "A shallow clone should have been created."
|
expect(shallow_tap.path/".git/shallow").to exist, "A shallow clone should have been created."
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user