- path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch ?
- repo->defbranch : "master");
- if (stat(path, &s) == 0) {
+ strbuf_reset(&path);
+ strbuf_addf(&path, "%s/refs/heads/%s", repo->path,
+ repo->defbranch ? repo->defbranch : "master");
+ if (stat(path.buf, &s) == 0) {