code: def test_get_tracking_branch(o_path=None, c_path=None):
      src = GitRepo(o_path)
      for filename in ("some1.txt", "some2.dat"):
          with open(op.join(o_path, filename), "w") as f:
              f.write(filename)
          src.add(filename)
      src.commit("Some files")
  
      clone = GitRepo.clone(o_path, c_path)
      # Note, that the default branch might differ even if it is always 'master'.
      # For direct mode annex repositories it would then be "annex/direct/master"
      # for example. Therefore use whatever branch is checked out by default:
      master_branch = clone.get_active_branch()
      ok_(master_branch)
  
      eq_(
          (DEFAULT_REMOTE, "refs/heads/" + master_branch),
          clone.get_tracking_branch(),
      )
  
      clone.checkout("new_branch", ["-b"])
  
      eq_((None, None), clone.get_tracking_branch())
  
      eq_(
          (DEFAULT_REMOTE, "refs/heads/" + master_branch),
          clone.get_tracking_branch(master_branch),
      )
  
      clone.checkout(master_branch, options=["--track", "-btopic"])
      eq_(
          (".", "refs/heads/" + master_branch),
          clone.get_tracking_branch(),
      )
      eq_((None, None), clone.get_tracking_branch(remote_only=True))
  
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 29 for calling a global function with example usage: test_get_tracking_branch(o_path, c_path) without return types