Allow "nonexistent version" test to work without brew
Currently, this test fails if Homebrew isn't present as it expects a Homebrew-specific output. This commit varies the expected output based on whether Homebrew is installed.
This patch was originally created for the Debian package for ruby-build: https://salsa.debian.org/ruby-team/ruby-build/-/blob/607093e5198cc75ffa8e9a3b551843be5f2f6d93/debian/patches/0001-Fix-nonexistent-version-test-to-work-regardless-of-e.patch
Turns out I had forgotten the context - the patch is a few years old at this point. It's not actually anything to do with Homebrew, and I can remove that part. The Debian build environment doesn't have the .gitdirectory. I'll update this PR to only check for the existence of .git - I think it's reasonable to want this test to pass when you download the tarball from GitHub instead of cloning.
Thanks for this and sorry for the late reaction. I've amended the approach in a way that I find easier to read/maintain: temporarily create the .git directory if missing.