git cl patch: bail out quickly if there is no branch.
This is because later calls to SetIssue() would fail.
R=michaelpg@chromium.org
BUG=611020
Review-Url: https://codereview.chromium.org/2259993002
diff --git a/git_cl.py b/git_cl.py
index 8a5dc73..3acfdbb 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4409,6 +4409,8 @@
RunGit(['branch', '-D', options.newbranch],
stderr=subprocess2.PIPE, error_ok=True)
RunGit(['new-branch', options.newbranch])
+ elif not GetCurrentBranch():
+ DieWithError('A branch is required to apply patch. Hint: use -b option.')
cl = Changelist(auth_config=auth_config, codereview=options.forced_codereview)