diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb index a16658125eddab4cf1c0f0cdc742d2a1992ae6d8..2640e2df6156d5822063001f5a1032e7b88f9977 100644 --- a/Library/Homebrew/test/test_integration_cmds.rb +++ b/Library/Homebrew/test/test_integration_cmds.rb @@ -700,6 +700,38 @@ class IntegrationCommandTests < Homebrew::TestCase (HOMEBREW_REPOSITORY/".git").rmtree end + def test_log_formula + core_tap = CoreTap.new + formula_file = core_tap.formula_dir/"testball.rb" + formula_file.write <<-EOS.undent + class Testball < Formula + url "https://example.com/testball-0.1.tar.gz" + end + EOS + + core_tap.path.cd do + shutup do + system "git", "init" + system "git", "add", "--all" + system "git", "commit", "-m", "This is a test commit for Testball" + end + end + + homebrew_core_clone = Pathname.new core_tap.path.dirname/"homebrew-core-clone" + shallow = Pathname.new homebrew_core_clone/".git/shallow" + + (core_tap.path.dirname).cd do + system "git", "clone", "--depth=1", "file://#{core_tap.path}", "homebrew-core-clone" + + assert_match "This is a test commit for Testball", cmd("log", "testball") + assert_predicate shallow, :exist?, "A shallow clone should have been created." + end + ensure + formula_file.unlink + (core_tap.path/".git").rmtree + (core_tap.path.dirname/"homebrew-core-clone").rmtree + end + def test_leaves formula_dir = CoreTap.new.formula_dir formula_file1 = formula_dir/"testball1.rb"