Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.36k stars 9.73k forks source link

`brew --version` is showing incomplete and false information #3187

Closed chdiza closed 7 years ago

chdiza commented 7 years ago

I'm not sure when this started, but even from brand-new clones I get:

$ brew --version
Homebrew >1.2.0 (no git repository)
Homebrew/homebrew-core (git revision b3bc; last commit 2017-09-22)

I don't know why it won't give the actual version number. I also don't know why it's saying "(no git repository)". HOMEBREW_REPOSITORY, which is /usr/local/homebrew or /usr/local/hb (doesn't matter which), does have a git repo in it.

To reproduce:

$ cd /usr/local
$ git clone --depth 1 https://github.com/Homebrew/brew hb (or "homebrew")
$ mkdir -p Cellar
$ [symlink the brew executable into /usr/local/bin]
$ brew tap Homebrew/homebrew-core
$ brew --version
Homebrew >1.2.0 (no git repository)
Homebrew/homebrew-core (git revision b3bc; last commit 2017-09-22)
$ ls -a $(brew --repository) | grep "git"
.git
.github
.gitignore

Doctor says ready to brew. Config is here:

HOMEBREW_VERSION: >1.2.0 (no git repository)
ORIGIN: https://github.com/Homebrew/brew
HEAD: 064c52efc4bd4c8520b27a6415c138e97bdf4e2e
Last commit: 6 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b3bc1ce35d1eb942991c53fae0f2644bbaeb6ba3
Core tap last commit: 7 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit arrandale
Homebrew Ruby: 2.3.3 => /usr/local/homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 9.0 build 900
Git: 2.14.1 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
macOS: 10.12.6-x86_64
Xcode: 9.0
CLT: 9.0.0.0.1.1504363082
X11: N/A
MikeMcQuaid commented 7 years ago

git clone --depth 1 https://github.com/Homebrew/brew hb (or "homebrew")

If you clone with --depth 1 we cannot get the tags for the repository version. I've opened https://github.com/Homebrew/install/pull/110 to fix the installer default which did this.

MikeMcQuaid commented 7 years ago

I've also clarified the messaging in https://github.com/Homebrew/brew/pull/3188.

chdiza commented 7 years ago

If you clone with --depth 1 we cannot get the tags for the repository version. I've opened Homebrew/install#110 to fix the installer default which did this.

I didn't run the installer, though, I just manually cloned the brew repo and then the homebrew-core repo.

(Side query: it's only the brew repo that will get fully cloned, right? Not the homebrew-core repo? The latter is a huge PITA to fully clone, particularly on initial setup.)

chdiza commented 7 years ago

I didn't run the installer, though, I just manually cloned the brew repo and then the homebrew-core repo.

Wait, I'm probably being an idiot. Probably I will just be stuck with the wrong version output until enough brew updates happen to force a fetching of the rest of the brew repo, or until I manually perform such a fetch. That's fine, since it will probably happen within two or three brew updates.