in spec/lib/gdk/project/git_worktree_spec.rb [170:199]
def expect_update(stash_result:, fetch_success: true)
expect_shellout('git stash save -u', stdout: stash_result)
expect_shellout('git rev-parse --is-shallow-repository', stdout: shallow_clone.to_s) unless expected_fetch_type == :fast
unless expected_fetch_type == :all
case infer_remote_name_source
when :local_branch
expect_shellout(%W[git config branch.
when :git_remote_list
expect(GDK.config).to receive(:repositories).and_return({ project_name => remote_url })
expect_shellout(%W[git config branch.
expect_shellout(%w[git remote -v], stdout: git_remote_list)
end
end
command = case expected_fetch_type
when :fast
"git fetch --force --tags --prune test-origin #{revision}"
when :shallow
"git fetch --tags --depth 1 test-origin #{revision}"
when :all
'git fetch --force --all --tags --prune'
else
raise "unknown fetch type, expected one of :fetch_fast, :shallow, :all"
end
expect_shellout(command, success: fetch_success, stderr: "fetch_success: #{fetch_success}",
args: { retry_attempts: described_class::NETWORK_RETRIES })
end