Skip to content

Commit 5e80651

Browse files
committed
Fix git failures in rspecs
When run with a modern git version which supports `--initial-branch`, git init was run twice due to using `|` instead of expected `||` in the shell commands
1 parent 58188a5 commit 5e80651

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

spec/configure_helper_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# reasonable enough assumption to make for the real world usage of this
1717
# tool. Still, it would be nice to have proper handling of that
1818
# scenario at some point.
19-
`git init --initial-branch main | git init`
19+
`git init --initial-branch main || git init`
2020

2121
expect(Fastlane::UI).to receive(:user_error!)
2222

spec/git_helper_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,41 +26,41 @@
2626
end
2727

2828
it 'can detect a valid git repository' do
29-
`git init --initial-branch main | git init`
29+
`git init --initial-branch main || git init`
3030
expect(Fastlane::Helper::GitHelper.is_git_repo?).to be true
3131
end
3232

3333
it 'can detect a valid git repository from a child folder' do
34-
`git init --initial-branch main | git init`
34+
`git init --initial-branch main || git init`
3535
`mkdir -p a/b`
3636
Dir.chdir('./a/b')
3737
expect(Fastlane::Helper::GitHelper.is_git_repo?).to be true
3838
end
3939

4040
it 'can detect a valid git repository when given a path' do
4141
Dir.mktmpdir do |dir|
42-
`git -C #{dir} init --initial-branch main | git -C #{dir} init`
42+
`git -C #{dir} init --initial-branch main || git -C #{dir} init`
4343
expect(Fastlane::Helper::GitHelper.is_git_repo?(path: dir)).to be true
4444
end
4545
end
4646

4747
it 'can detect a valid git repository when given a child folder path' do
4848
Dir.mktmpdir do |dir|
49-
`git -C #{dir} init --initial-branch main | git -C #{dir} init`
49+
`git -C #{dir} init --initial-branch main || git -C #{dir} init`
5050
path = File.join(dir, 'a', 'b')
5151
`mkdir -p #{path}`
5252
expect(Fastlane::Helper::GitHelper.is_git_repo?(path: path)).to be true
5353
end
5454
end
5555

5656
it 'can detect a repository with Git-lfs enabled' do
57-
`git init --initial-branch main | git init`
57+
`git init --initial-branch main || git init`
5858
`git lfs install`
5959
expect(Fastlane::Helper::GitHelper.has_git_lfs?).to be true
6060
end
6161

6262
it 'can detect a repository without Git-lfs enabled' do
63-
`git init --initial-branch main | git init`
63+
`git init --initial-branch main || git init`
6464
`git lfs uninstall &>/dev/null`
6565
expect(Fastlane::Helper::GitHelper.is_git_repo?).to be true
6666
expect(Fastlane::Helper::GitHelper.has_git_lfs?).to be false
@@ -186,7 +186,7 @@
186186
end
187187

188188
def setup_git_repo(dummy_file_path: nil, add_file_to_gitignore: false, commit_gitignore: false)
189-
`git init --initial-branch main | git init`
189+
`git init --initial-branch main || git init`
190190
`touch .gitignore`
191191
`git add .gitignore && git commit -m 'Add .gitignore'`
192192

0 commit comments

Comments
 (0)