Skip to content

Commit

Permalink
Merge branch 'jgfouca/scripts/acme_util_fix_branch_get' into master
Browse files Browse the repository at this point in the history
acme_util: get_current_branch return None on fail

[BFB]

* jgfouca/scripts/acme_util_fix_branch_get:
  acme_util: get_current_branch return None on fail
  • Loading branch information
jgfouca committed Oct 11, 2015
2 parents 7161c10 + 9af53d9 commit 8f2c155
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cime/scripts-acme/acme_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,12 @@ def get_current_branch(repo=None):
branch = branch.replace("origin/", "", 1)
return branch
else:
output = run_cmd("git symbolic-ref HEAD", from_dir=repo)
return output.replace("refs/heads/", "")
stat, output, errput = run_cmd("git symbolic-ref HEAD", from_dir=repo, ok_to_fail=True)
if (stat != 0):
warning("Couldn't get current git branch, error: '%s'" % errput)
return None
else:
return output.replace("refs/heads/", "")

###############################################################################
def get_current_commit(short=False, repo=None):
Expand Down

0 comments on commit 8f2c155

Please sign in to comment.