I don't know how to reproduce that submodule bug, but if you move the condition you end up in the `else` branch and it's probably not what you want.

In that case I would use a guard clause instead:

```ruby
if path.exist?
  return if path.basename.to_s == '.git'

  checksum = checksum_cookbook_file(path)
  messages << "#{manifest_record['path']}" if checksum != manifest_record['checksum']
else
 ```