In our starter hello-world.spec.yaml, we set the batch change name to be the branch name by default:
branch: ${{ batch_change.name }}
However, there's actually no guarantee that the name a user picked for their Batch Change is actually compliant with the spec for git branch ref names. For example, we allow .s in the batch change name. While . characters are allowed in certain settings, but they can't follow a / or another . according to the spec.
This yields a confusing error in the UI because gitserver fails to push the commit so there's no ref to create the changeset from:
But you can see what actually went wrong from closer inspection in the gitserver logs:
Hey, @sourcegraph/batchers (@eseliger @courier-new @adeola-ak @BolajiOlajide @st0nebraker @malomarrec @chrispine @danielmarquespt) - we have been mentioned. Let's take a look.
The regex expression for a valid git ref name is kinda disgusting and based on a very complex spec.
In our starter
hello-world.spec.yaml
, we set the batch change name to be the branch name by default:However, there's actually no guarantee that the name a user picked for their Batch Change is actually compliant with the spec for git branch ref names. For example, we allow
.
s in the batch change name. While.
characters are allowed in certain settings, but they can't follow a/
or another.
according to the spec.This yields a confusing error in the UI because gitserver fails to push the commit so there's no ref to create the changeset from:
But you can see what actually went wrong from closer inspection in the gitserver logs:
Namely that
fatal: invalid refspec
part.We ought to handle this a bit more gracefully, by doing one or multiple of a couple things:
hello-world
spec if it's invalid