1

I tried to install something using brew install and this thing pops up

Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

and when I copied that thing to make it run, this happens

fish: $(...) is not supported. In fish, please use '(brew)'.
git -C "$(brew --repo homebrew/core)" fetch --unshallow
        ^

What does it means and how can I fix these things? Is there's a workaround to ignore or fix?

Additional information about my workstation:

  • MacOS Mojave
  • Homebrew version 2.0.2
  • Does run brew doctor and it shows up as no problem
  • Using Fish shell (of course I do)

Update 1 : It looks like I am an idiot leaving the $ there. I did try to fix it with you guys suggestions, and this what happened.

Removing the $ from the command, like so

git -C "(brew --repo homebrew/core)" fetch --unshallow

and this happens

fatal: cannot change to '(brew --repo homebrew/core)': No such file or directory

Update 2 : Also, @VonC asked me did brew --repo homebrew/core path exists by asking me to run these following line

brew --repo homebrew/core

and it comes up as this

/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

which indicates that the repository path is still valid and ready to use

Kunanon S.
  • 31
  • 1
  • 6
  • 2
    It tells you how to fix it: Leave out the dollar sign. – tripleee Mar 04 '19 at 04:54
  • 1
    I'm curious how long you have used the `fish` shell since you did not recognize that the error message told you what was wrong with the copy/paste command you tried to run. – Kurtis Rader Mar 04 '19 at 05:58
  • Looks like I am too stupid to understand what it just trying to hint. I have updated the question with some more discoveries I have found. – Kunanon S. Mar 04 '19 at 06:08

2 Answers2

2

As mentioned in fish-shell/issue 1405

In bash, $(...) is equivalent to backticks, except it's supported inside a double-quoted string.
Fish does not use $(...) or backticks, it uses (...) instead

So:

git -C (brew --repo homebrew/core) fetch --unshallow

Issue 159 discusses the support of $() command substitution syntax.
Since 2012.

fatal: cannot change to '(brew --repo homebrew/core)': No such file or directory

Then double-check what brew --repo homebrew/core returns, and if the path exists.

As an alternative, seen here:

git -C $HOMEBREW_CORE fetch --unshallow

Using "" should be supported, as seen in "How to remove the shallow clone warning from HomeBrew", but not advisable, from glenn-jackman's comment.

Simplest explanation for a "shallow clone" is that it's simply a clone of the git repository without the revision history thereby reducing the git repo footprint. You can also specify "depth" to reduce the amount of revision history obtained from a git clone.

In your case, if you need the full history, a fetch --unshallow is needed.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Looks like I did a double oopsies.
Thanks to all comments to me that I am doing an oopsies. I appreciate it a lot.

Instead of typing

git -C "$(brew --repo homebrew/core)" fetch --unshallow

which fish does not really likes $ in that line,

use this instead :

git -C (brew --repo homebrew/core) fetch --unshallow

no $ and ".
AAAAND that's it.

Please comment if this does not help. I still doubt that really resolves this question or not lol

Kunanon S.
  • 31
  • 1
  • 6