code: def test_GitRepo_ssh_fetch(remote_path=None, repo_path=None):
      from datalad import ssh_manager
  
      remote_repo = GitRepo(remote_path)
      with open(op.join(remote_path, "some.txt"), "w") as f:
          f.write("New text file.")
      remote_repo.add("some.txt")
      remote_repo.commit("new file added.")
  
      url = _path2localsshurl(remote_path)
      socket_path = op.join(
          str(ssh_manager.socket_dir),
          get_connection_hash("datalad-test"),
      )
      repo = GitRepo(repo_path, create=True)
      repo.add_remote("ssh-remote", url)
  
      # we don't know any branches of the remote:
      eq_([], repo.get_remote_branches())
  
      fetched = repo.fetch(remote="ssh-remote")
      assert_in(
          "ssh-remote/" + DEFAULT_BRANCH,
          [commit["ref"] for commit in fetched],
      )
      assert_repo_status(repo)
  
      # the connection is known to the SSH manager, since fetch() requested it:
      assert_in(socket_path, list(map(str, ssh_manager._connections)))
      # and socket was created:
      ok_(op.exists(socket_path))
  
      # we actually fetched it:
      assert_in(
          "ssh-remote/" + DEFAULT_BRANCH, repo.get_remote_branches()
      )
  
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 20 for calling a global function with example usage: test_GitRepo_ssh_fetch(remote_path, repo_path) without return types