Skip to content

Commit d353d74

Browse files
committed
Only check 'args.stash' when 'submit' or 'export' is used
1 parent e3cf3da commit d353d74

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/stack_pr/cli.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,15 +1370,14 @@ def main():
13701370
current_branch = get_current_branch_name()
13711371
get_branch_name_base(common_args.branch_name_template)
13721372
try:
1373-
if args.stash:
1374-
run_shell_command(["git", "stash", "save"], quiet=not common_args.verbose)
1375-
13761373
if args.command != "view" and not is_repo_clean():
13771374
error(ERROR_REPO_DIRTY)
13781375
return
13791376
common_args = deduce_base(common_args)
13801377

13811378
if args.command in ["submit", "export"]:
1379+
if args.stash:
1380+
run_shell_command(["git", "stash", "save"], quiet=not common_args.verbose)
13821381
command_submit(
13831382
common_args,
13841383
args.draft,
@@ -1403,7 +1402,7 @@ def main():
14031402
print_cmd_failure_details(exc)
14041403
raise
14051404
finally:
1406-
if args.stash:
1405+
if args.command in ["submit", "export"] and args.stash:
14071406
run_shell_command(["git", "stash", "pop"], quiet=not common_args.verbose)
14081407

14091408

0 commit comments

Comments
 (0)