Add pending prefix to the target_ref if it is specified

BUG=435702

Review URL: https://codereview.chromium.org/797793003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293356 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index de9433f..c881729 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -1761,6 +1761,10 @@
                                               'refs/heads/')
       elif remote_branch.startswith('refs/remotes/branch-heads'):
         remote_branch = remote_branch.replace('refs/remotes/', 'refs/')
+      pending_prefix = settings.GetPendingRefPrefix()
+      # If a pending prefix exists then replace refs/ with it.
+      if pending_prefix:
+        remote_branch = remote_branch.replace('refs/', pending_prefix)
       upload_args.extend(['--target_ref', remote_branch])
 
   project = settings.GetProject()