    # File lib/chef/knife/core/cookbook_scm_repo.rb, line 40
          def sanity_check
            unless ::File.directory?(repo_path)
              ui.error("The cookbook repo path #{repo_path} does not exist or is not a directory")
              exit 1
            end
            unless git_repo?(repo_path)
              ui.error "The cookbook repo #{repo_path} is not a git repository."
              ui.info("Use `git init` to initialize a git repo")
              exit 1
            end
            unless branch_exists?(default_branch)
              ui.error "The default branch '#{default_branch}' does not exist"
              ui.info "If this is a new git repo, make sure you have at least one commit before installing cookbooks"
              exit 1
            end
            cmd = git('status --porcelain')
            if cmd.stdout =~ DIRTY_REPO
              ui.error "You have uncommitted changes to your cookbook repo (#{repo_path}):"
              ui.msg cmd.stdout
              ui.info "Commit or stash your changes before importing cookbooks"
              exit 1
            end
            # TODO: any untracked files in the cookbook directory will get nuked later
            # make this an error condition also.
            true
          end