Skip to content
Snippets Groups Projects
Commit 1feecbd9 authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI
Browse files

branches: Escape percent signs in branch names

If a branch name contains a percent sign, it will be interpreted as a placeholder and color.py will fail to format it.

To avoid this, escape the percent signs prior to calling Coloring
method.

Bug: b/379090488
Change-Id: Id019c776bbf8cbed5c101f2773606f1d32c9e057
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/443801


Reviewed-by: default avatarScott Lee <ddoman@google.com>
Tested-by: default avatarJosip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
parent 616e3149
No related branches found
No related tags found
No related merge requests found
......@@ -167,7 +167,10 @@ is shown, then the branch appears in all projects.
else:
published = " "
hdr("%c%c %-*s" % (current, published, width, name))
# A branch name can contain a percent sign, so we need to escape it.
# Escape after f-string formatting to properly account for leading
# spaces.
hdr(f"{current}{published} {name:{width}}".replace("%", "%%"))
out.write(" |")
_RelPath = lambda p: p.RelPath(local=opt.this_manifest_only)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment