Check for detached HEAD state.
Bug: 1416683
Change-Id: I538715d05170662001ac7193a86dbd2e7f50e3f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4258505
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Joanna Wang <jojwang@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index 29c0326..bc6046b 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4908,6 +4908,10 @@
since their last upload and a boolean of whether the user wants to
cherry-pick and upload the current branch instead of uploading all cls.
"""
+ cl = Changelist()
+ if cl.GetBranch() is None:
+ DieWithError('Can\'t upload from detached HEAD state. Get on a branch!')
+
branch_ref = None
cls = []
must_upload_upstream = False