code: def test_optimized_cloning(path=None):
      # make test repo with one file and one commit
      originpath = op.join(path, "origin")
      repo = GitRepo(originpath, create=True)
      with open(op.join(originpath, "test"), "w") as f:
          f.write("some")
      repo.add("test")
      repo.commit("init")
      assert_repo_status(originpath, annex=False)
      from glob import glob
  
      def _get_inodes(repo):
          return dict(
              [
                  (
                      os.path.join(*o.split(os.sep)[-2:]),
                      os.stat(o).st_ino,
                  )
                  for o in glob(
                      os.path.join(
                          repo.path,
                          repo.get_git_dir(repo),
                          "objects",
                          "*",
                          "*",
                      )
                  )
              ]
          )
  
      origin_inodes = _get_inodes(repo)
      # now clone it in different ways and see what happens to the object storage
      from datalad.support.network import get_local_file_url
  
      clonepath = op.join(path, "clone")
      for src in (
          originpath,
          get_local_file_url(originpath, compatibility="git"),
      ):
          clone = GitRepo.clone(url=src, path=clonepath, create=True)
          clone_inodes = _get_inodes(clone)
          eq_(
              origin_inodes, clone_inodes, msg="with src={}".format(src)
          )
          rmtree(clonepath)
  
imports: import logging
  import os
  import os.path
  import sys
  import pytest
  from datalad import get_encoding_info
  from datalad.cmd import StdOutCapture, StdOutErrCapture, WitlessRunner
  from datalad.support.exceptions import CommandError, FileNotInRepositoryError, InvalidGitRepositoryError, NoSuchPathError, PathKnownToRepositoryError
  from datalad.support.external_versions import external_versions
  from datalad.support.gitrepo import GitRepo, _normalize_path, normalize_paths, to_options
  from datalad.support.sshconnector import get_connection_hash
  from datalad.tests.utils_pytest import DEFAULT_BRANCH, DEFAULT_REMOTE, SkipTest, assert_cwd_unchanged, assert_equal, assert_false, assert_in, assert_in_results, assert_is_instance, assert_not_equal, assert_not_in, assert_raises, assert_repo_status, assert_true, create_tree, eq_, get_most_obscure_supported_name, integration, neq_, ok_, skip_if_no_network, skip_if_on_windows, skip_nomultiplex_ssh, slow, swallow_logs, with_tempfile, with_tree, xfail_buggy_annex_info
  from datalad.utils import Path, chpwd, getpwd, on_windows, rmtree
label_desc: Use image node_id 35 for calling a global function with example usage: test_optimized_cloning(path) and returns: dict