Skip to content

Commit

Permalink
added exit if local branch is not branch request
Browse files Browse the repository at this point in the history
  • Loading branch information
kiihne-noaa authored Oct 25, 2024
1 parent b9c9d01 commit 582592f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fre/pp/checkoutScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ def _checkoutTemplate(experiment, platform, target, branch='main'):

# Set the name of the directory
name = f"{experiment}__{platform}__{target}"

# Get name of local branch and check branch rquest
branch_names = subprocess.run(["git","branch"],capture_output=True, text=True)
local_branch_name = branch_names.stdout.split()[1]
if branch != 'main':
if branch != local_branch_name:
stop_report = ("Error in branch: local branch does not match branch input"
sys.exit(stop_report)
return 1

# Clone the repository with depth=1; check for errors
click.echo("cloning experiment into directory " + directory + "/" + name)
clonecmd = (
Expand Down

0 comments on commit 582592f

Please sign in to comment.