@@ -19,11 +19,13 @@ def _run(args, **kwargs):
1919 return check_output (args , ** kwargs )
2020
2121
22- def get_default_compare_branch (base_directory , encoding ):
23- branches = (
24- _run (["git" , "branch" , "-r" ], cwd = base_directory ).decode (encoding ).splitlines ()
25- )
26- branches = [branch .strip () for branch in branches ]
22+ def _get_remote_branches (base_directory , encoding ):
23+ output = _run (["git" , "branch" , "-r" ], cwd = base_directory ).decode (encoding )
24+
25+ return [branch .strip () for branch in output .splitlines ()]
26+
27+
28+ def _get_default_compare_branch (branches ):
2729 if "origin/main" in branches :
2830 return "origin/main"
2931 if "origin/master" in branches :
@@ -78,8 +80,8 @@ def __main(comparewith, directory, config):
7880 # and also some CI such as GitHub Actions).
7981 encoding = getattr (sys .stdout , "encoding" , "utf8" )
8082 if comparewith is None :
81- comparewith = get_default_compare_branch (
82- base_directory = base_directory , encoding = encoding
83+ comparewith = _get_default_compare_branch (
84+ _get_remote_branches ( base_directory = base_directory , encoding = encoding )
8385 )
8486
8587 if comparewith is None :
0 commit comments