62 Commits

Author SHA1 Message Date
Douglas Eichelberger
827fc87cde Enable more typing 2023-03-15 14:29:15 -07:00
Douglas Eichelberger
f4c9a96c70 Enable types in dev-cmd 2023-03-14 08:32:03 -07:00
Harry Marr
49e2cf9f92
Extract supports_partial_clone_sparse_checkout? 2022-10-20 15:45:33 -04:00
Bo Anderson
02164a35db
Use ORIGINAL_PATHS over envs; reject nil PATH 2022-06-17 19:47:57 +01:00
XuehaiPan
d1aac8857a tests/utils/git_spec: update tests for ensure_formula_installed! 2021-11-24 00:30:26 +08:00
XuehaiPan
3376479e95 utils: add method ensure_formula_installed! 2021-11-23 22:48:39 +08:00
Bo Anderson
36a57aa738
utils/git: remove external dependency loading 2021-10-07 14:51:52 +01:00
Mike McQuaid
7ec024e090
utils/git: require formula.
This is currently causing `brew vendor-gems` to fail.
2021-10-07 11:23:55 +01:00
Bo Anderson
30b24cf4ad
Use HOMEBREW_CURL universally, including formulae 2021-10-04 02:03:04 +01:00
Mike McQuaid
d6957a3acb
Homebrew 3.0.0 deprecations/disables 2021-01-29 19:50:24 +00:00
Mike McQuaid
a1c97c8f3b
utils/git: quieter git --version.
Let's avoid printing this unless `--debug` (to avoid
`brew bundle check -v` outputting this).

Fixes https://github.com/Homebrew/homebrew-bundle/issues/865
2021-01-06 08:51:11 +00:00
Mike McQuaid
74fb058c7e
More deprecations
More deprecations, disabling and removal for Homebrew 2.7.0.
2020-12-18 14:17:37 +00:00
Jonathan Chang
8b206dfa33 git_extensions: move commit_message from utils/git 2020-12-06 14:33:23 +11:00
Jonathan Chang
92d3eda914 git_extensions: move origin_branch from utils/git 2020-12-06 14:33:23 +11:00
Jonathan Chang
d802b3755a utils/git: remove redundant current_branch 2020-12-06 14:33:23 +11:00
Jonathan Chang
75be0ca4d0 git_repository: add type signatures and comments 2020-12-06 14:33:23 +11:00
Mike McQuaid
4f3c590873
Unify and use Git username/email/GPG handling.
We're using essentially the same logic to setup Git for committing in
multiple places but the way we're doing so is inconsistent. Moved to
using two shared utility methods and use them consistently.
2020-11-02 12:21:18 +00:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Jonathan Chang
cdfb1badcf utils/git: helper function to get commit msg 2020-09-20 13:23:01 +10:00
Jonathan Chang
d09ebf428f utils/git: new file_at_commit function 2020-09-20 13:21:27 +10:00
Jonathan Chang
04687aef93 dev-cmd/pr-pull: don't assume a master branch 2020-09-20 13:21:27 +10:00
Jonathan Chang
3a8bd8514f utils/git: add cherry-pick function 2020-09-17 17:27:38 +10:00
Jonathan Chang
49d2e4cbab utils/git: modernize 2020-09-17 17:27:38 +10:00
Seeker
be92ef2889 utils/git: add origin_branch 2020-09-08 08:26:05 -07:00
Markus Reiter
0129247391 Refuse to install Git if HOMEBREW_TEST_GENERIC_OS is set. 2020-08-29 21:45:51 +02:00
Markus Reiter
a6bd784f55 Unset HOMEBREW_TEST_GENERIC_OS when installing Git. 2020-08-26 06:34:30 +02:00
Markus Reiter
677600014e Call clear_available_cache after installing Git. 2020-08-24 05:25:48 +02:00
Markus Reiter
3118fedab9 Refactor and document Git. 2020-08-23 06:40:07 +02:00
Issy Long
2c3b2f68cd
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.
2020-07-09 08:18:38 +01:00
vidusheeamoli
76a2e69990 sorbet: set utils/git.rb to true
(cherry picked from commit 44a04adb1de430066af73a65766eb644c0f5bd41)
2020-07-08 22:34:26 +05:30
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Mike McQuaid
f31e01c3ad
test: set Git name and email.
Extract the code from `bottle.rb` into `utils/git.rb` and ensure it's
run before we run tests.

Should resolve issues like in
https://github.com/Homebrew/homebrew-core/pull/50328
2020-02-17 19:40:44 +00:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
kiendang
028b8b408d Remove use of bash 2019-03-20 20:19:33 +08:00
kiendang
00f74902d4 Call git log through bash for globstar support 2019-03-18 03:05:30 +08:00
kiendang
6be6bba0be brew extract from all taps 2019-03-17 23:44:35 +08:00
Markus Reiter
5dd571adeb Replace #chuzzle with ActiveSupport’s #presence. 2018-10-07 23:10:56 +02:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Maxim Belkin
f984701c29
append ? to git_remote_exist 2018-03-14 16:30:45 -05:00
Viktor Oreshkin
461bb20b7c utils/git: use exact format for last_revision_*
Format for oneline can be overridden in user's gitconfig. If that's the
case, last_revision_commit_of_file won't work properly, and because of
that last_revision_of_file won't work at all.

Here's what I was getting when running brew tests:

       expected: "6bec2de"
            got: "\e[33m6bec2dee633f\e[m"

I have abbrev length set to 12, and oneline formatting is more colorful.

So, instead of relying on overrideable format, it should rather specify
"--format=%h" to get only hash, and speciy --abbrev=7 to force abbrev
length to be 7

After this commit tests are passing for me.
2018-03-12 14:07:00 +03:00
Mike McQuaid
83cca40fc9 RuboCop 0.53.0 manual fixes. 2018-03-08 14:10:02 +00:00
Chayoung You
b05d69f600
Format identifiers in oh1 2018-02-09 18:00:29 +09:00
ilovezfs
17f80a44e6
Revert "Use Homebrew's gitconfig for various commands" 2018-01-15 07:30:56 +00:00
Mike McQuaid
228cbd81c9 Use Homebrew's gitconfig for various commands
Git is a transport and storage mechanism for us so we don't want to
allow arbitrary customisation of this due to user issues e.g. #3664
and #3561.

Fixes #3664.
2018-01-11 20:40:59 +00:00
Mike McQuaid
3d876f7d70 utils/git: cache less aggressively.
This should avoid weird test ordering failures with specs on Linux (but
there's no real reason this can't occur on macOS too).
2017-09-24 20:39:06 +01:00
Mike McQuaid
7f93d816a3 utils/git: don't fail when CoreTap is untapped.
This produces test failures on Linux where we intentionally avoid having
it tapped.
2017-09-23 21:53:20 +01:00
mansimarkaur
784250d550 Used already existing clear_git_available_cache to remove @git 2017-08-29 22:53:10 +05:30
mansimarkaur
c695dffd37 Added clear git version cache method 2017-08-27 01:23:32 +05:30
mansimarkaur
372a422305 Added tests for ensure_git_installed when git is available or homebrew/core is unavailable 2017-08-27 01:23:32 +05:30
mansimarkaur
657b6ef7fb Added tests for git_available? 2017-08-27 01:23:32 +05:30