- *colon = '\0';
- ref = ctx.repo->readme;
- ctx.repo->readme = colon + 1;
- if (!(*ctx.repo->readme))
- return;
+ /* If it starts with a colon, we want to use
+ * the default branch */
+ if (colon == readme && repo->defbranch)
+ *ref = xstrdup(repo->defbranch);
+ else
+ *ref = xstrndup(readme, colon - readme);
+ readme = colon + 1;