[depot_tools] Use a function instead of reimplementing it.
It seems dubious that this function ever need to change. But it’s
safer to use this function just in case.
Bug: 1428476
Change-Id: I3c60e6be5c7dab6f003c209b47340e7573819e16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4403090
Commit-Queue: Arthur Milchior <arthurmilchior@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
diff --git a/git_cl.py b/git_cl.py
index 2948295..1105574 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -4262,8 +4262,7 @@
# Print the various branches
PrintIssueToBranches(options, args)
DieWithError('Multiple branches associated to issue: %d' % issue_num)
- prefix_size = len('refs/heads/')
- RunGit(['switch', branches[0][prefix_size:]])
+ RunGit(['switch', scm.GIT.ShortBranchName(branches[0])])
return 0