@@ -798,8 +798,12 @@ def cherry_pick_cli(
798798
799799 click .echo ("\U0001F40D \U0001F352 \u26CF " )
800800
801- chosen_config_path , config = load_config (config_path )
802-
801+ try :
802+ chosen_config_path , config = load_config (config_path )
803+ except ValueError as exc :
804+ click .echo ("You're not inside a Git tree right now! \U0001F645 " , err = True )
805+ click .echo (exc , err = True )
806+ sys .exit (- 1 )
803807 try :
804808 cherry_picker = CherryPicker (
805809 pr_remote ,
@@ -813,7 +817,7 @@ def cherry_pick_cli(
813817 chosen_config_path = chosen_config_path ,
814818 )
815819 except InvalidRepoException as ire :
816- click .echo (ire .args [0 ])
820+ click .echo (ire .args [0 ], err = True )
817821 sys .exit (- 1 )
818822 except ValueError as exc :
819823 ctx .fail (exc )
@@ -1015,7 +1019,12 @@ def load_config(path=None):
10151019def get_sha1_from (commitish ):
10161020 """Turn 'commitish' into its sha1 hash."""
10171021 cmd = ["git" , "rev-parse" , commitish ]
1018- return subprocess .check_output (cmd ).strip ().decode ("utf-8" )
1022+ try :
1023+ return (
1024+ subprocess .check_output (cmd , stderr = subprocess .PIPE ).strip ().decode ("utf-8" )
1025+ )
1026+ except subprocess .CalledProcessError as exc :
1027+ raise ValueError (exc .stderr .strip ().decode ("utf-8" ))
10191028
10201029
10211030def reset_stored_config_ref ():
0 commit comments