Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix a spec incompatibility with pre-2.28 git (#10892)

Jarek Radosz572da7a57b7e
diff --git a/spec/components/version_spec.rb b/spec/components/version_spec.rb
index c843a5ce6c5..6d519a22ae5 100644
--- a/spec/components/version_spec.rb
+++ b/spec/components/version_spec.rb
@@ -106,7 +106,7 @@ describe Discourse::VERSION do
# Simulate a remote upstream
`cd #{path} && git remote add origin #{path}/.git && git fetch -q`
- `cd #{path} && git branch -u origin/main`
+ `cd #{path} && git branch -u origin/$(git branch --show-current)`
end
path
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index 24af7fd1690..6cc43fc6fb4 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -165,7 +165,7 @@ module Helpers
def setup_git_repo(files)
repo_dir = Dir.mktmpdir
- `cd #{repo_dir} && git init . --initial-branch=main`
+ `cd #{repo_dir} && git init .`
`cd #{repo_dir} && git config user.email '[email protected]'`
`cd #{repo_dir} && git config user.name 'The Cool One'`
`cd #{repo_dir} && git config commit.gpgsign 'false'`