|
26 | 26 | end
|
27 | 27 |
|
28 | 28 | it 'can detect a valid git repository' do
|
29 |
| - `git init --initial-branch main | git init` |
| 29 | + `git init --initial-branch main || git init` |
30 | 30 | expect(Fastlane::Helper::GitHelper.is_git_repo?).to be true
|
31 | 31 | end
|
32 | 32 |
|
33 | 33 | 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` |
35 | 35 | `mkdir -p a/b`
|
36 | 36 | Dir.chdir('./a/b')
|
37 | 37 | expect(Fastlane::Helper::GitHelper.is_git_repo?).to be true
|
38 | 38 | end
|
39 | 39 |
|
40 | 40 | it 'can detect a valid git repository when given a path' do
|
41 | 41 | 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` |
43 | 43 | expect(Fastlane::Helper::GitHelper.is_git_repo?(path: dir)).to be true
|
44 | 44 | end
|
45 | 45 | end
|
46 | 46 |
|
47 | 47 | it 'can detect a valid git repository when given a child folder path' do
|
48 | 48 | 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` |
50 | 50 | path = File.join(dir, 'a', 'b')
|
51 | 51 | `mkdir -p #{path}`
|
52 | 52 | expect(Fastlane::Helper::GitHelper.is_git_repo?(path: path)).to be true
|
53 | 53 | end
|
54 | 54 | end
|
55 | 55 |
|
56 | 56 | 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` |
58 | 58 | `git lfs install`
|
59 | 59 | expect(Fastlane::Helper::GitHelper.has_git_lfs?).to be true
|
60 | 60 | end
|
61 | 61 |
|
62 | 62 | 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` |
64 | 64 | `git lfs uninstall &>/dev/null`
|
65 | 65 | expect(Fastlane::Helper::GitHelper.is_git_repo?).to be true
|
66 | 66 | expect(Fastlane::Helper::GitHelper.has_git_lfs?).to be false
|
|
186 | 186 | end
|
187 | 187 |
|
188 | 188 | 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` |
190 | 190 | `touch .gitignore`
|
191 | 191 | `git add .gitignore && git commit -m 'Add .gitignore'`
|
192 | 192 |
|
|
0 commit comments