Revert #7933 ("sorbet: set utils/git.rb to true")

- My refactoring of #7933 went wrong in that the tests passed for `brew
  extract` and my manual testing, but both forgot about third-party taps
  exist, so that functionality broke as follows (courtesy of Misty).

  Before:

  ```
  # Git.last_revision_commit_of_files("/usr/local/Homebrew", ["LICENSE.txt", "README.md"])
  => ["ac0665d", ["README.md"]]
  ```

  After:

  ```
  # Git.last_revision_commit_of_files("/usr/local/Homebrew", ["LICENSE.txt", "README.md"])
  => [nil, []]
  ```

- While we think about how to do splats in Sorbet, revert this so
  that users are able to `brew extract` from third party taps again.

- A TODO for later in a separate PR is to write a test for `brew
  extract` that tests the behaviour of third-party taps.

---

- Reverted this manually because the GitHub UI couldn't do it.
- Arguably I didn't need to remove the RBI file, but it's easier to have
  everything gone for now and then revert this revert in future once we
  have a strategy for dealing with splats in Sorbet than have
  inconsistency.
This commit is contained in:
Issy Long 2020-07-09 08:18:38 +01:00
parent 369f919dab
commit 2c3b2f68cd
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4
3 changed files with 2 additions and 17 deletions

View File

@ -453,6 +453,7 @@ false:
- ./utils/curl.rb
- ./utils/fork.rb
- ./utils/formatter.rb
- ./utils/git.rb
- ./utils/github.rb
- ./utils/popen.rb
- ./utils/user.rb
@ -891,7 +892,6 @@ true:
- ./test/support/lib/config.rb
- ./utils/bottles.rb
- ./utils/notability.rb
- ./utils/git.rb
- ./utils/shell.rb
- ./utils/svn.rb
- ./utils/tty.rb

View File

@ -1,15 +0,0 @@
# typed: strict
module Git
include Kernel
def last_revision_commit_of_file(repo, file, before_commit: nil)
end
sig { params(repo: Pathname, files: T::Array[Pathname], before_commit: T.nilable(String)).void }
def last_revision_commit_of_files(repo, files, before_commit: nil)
end
def last_revision_of_file(repo, file, before_commit: nil)
end
end

View File

@ -36,7 +36,7 @@ module Git
out, = Open3.capture3(
HOMEBREW_SHIMS_PATH/"scm/git", "-C", repo, "log",
"--pretty=format:%h", "--abbrev=7", "--max-count=1",
"--diff-filter=d", "--name-only", *args, "--", files.join(" ")
"--diff-filter=d", "--name-only", *args, "--", *files
)
rev, *paths = out.chomp.split(/\n/).reject(&:empty?)
[rev, paths]