54 Commits

Author SHA1 Message Date
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
mansimarkaur
d91036e891 Added tests for last_revision_commit_of_file 2017-08-27 01:23:32 +05:30
Markus Reiter
1a96dc39d1 Add audit check to see if both version and checksum changed. 2017-05-22 02:01:57 +02:00
David Broder-Rodgers
ed9f775b77 Added support for returning HTTP status codes and for git and svn URLs 2017-02-20 19:24:19 +00:00
Markus Reiter
fe2d51e0b9 Fix Style/IfUnlessModifier. 2016-09-23 15:30:07 +02:00
Mike McQuaid
a02be9eea2 ENV: move to new paths. (#507)
Move some stuff formerly in `Library/ENV` around:
- Move `Library/ENV/$XCODE_VERSION` to `Library/Homebrew/env/super` as they are
  all superenv wrappers and all symlinks to the same version. We never needed
  the "separate shims for separate versions" functionality and it just adds
  confusion.
- Move `Library/ENV/pkgconfig` to `Library/Homebrew/env/pkgconfig` to get more
  things under `Library/Homebrew`
- Move `Library/ENV/scm` to `Library/scm` as these wrappers are not actually
  used by or related to superenv (or stdenv) in any way.
2016-07-15 19:03:45 +01:00
Martin Afanasjew
324a34d8ea utils/git: provide git_path and git_version 2016-06-19 22:12:34 +02:00
Xu Cheng
5560f5550d git: check homebrew/core existence before installing brewed git 2016-04-02 21:51:36 +08:00
Xu Cheng
e0e277ecde utils/git: various improvement
* Use `ENV/scm/git` to check whether git is installed.
* Use `brew install git` to enforce pre-install checks such as sudo
  check.
2016-03-21 19:07:38 +08:00