Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git.latest: Fix handling of nonexistant branches #30029

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion salt/states/git.py
Expand Up @@ -515,6 +515,7 @@ def latest(name,
remote_rev_type = 'sha1'
else:
remote_rev = None
remote_rev_type = None

# For the comment field of the state return dict, the remote location
# (and short-sha1, if rev is not a sha1) is referenced several times,
Expand All @@ -524,7 +525,7 @@ def latest(name,
remote_loc = 'remote HEAD (' + remote_rev[:7] + ')'
else:
remote_loc = remote_rev[:7]
else:
elif remote_rev is not None:
remote_loc = '{0} ({1})'.format(
desired_upstream if remote_rev_type == 'branch' else rev,
remote_rev[:7]
Expand Down