ref: 1770b8f94bb1d97fdeb6f7db293ed36da9751826
parent: 04703df8448c3012dc431bbb2a3e1adfa7eda4c3
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Sep 7 18:33:30 EDT 2020
git/serve: filter to heads/* in ref list.
--- a/serve.c
+++ b/serve.c
@@ -37,11 +37,15 @@
if(fmtpkt(c, "%H HEAD", head) == -1)
goto error;
}
+
if((nrefs = listrefs(&refs, &names)) == -1)
sysfatal("listrefs: %r");
- for(i = 0; i < nrefs; i++)
+ for(i = 0; i < nrefs; i++){
+ if(strncmp(names[i], "heads/", strlen("heads/")) != 0)
+ continue;
if(fmtpkt(c, "%H refs/%s\n", refs[i], names[i]) == -1)
goto error;
+ }
if(flushpkt(c) == -1)
goto error;
ret = 0;
@@ -451,7 +455,7 @@
if(strncmp(pathpfx, path, strlen(pathpfx)) != 0)
sysfatal("%s: path escapes prefix", p);
if(chdir(path) == -1)
- sysfatal("cd %s: %r", p);
+ sysfatal("cd %s: %r", path);
if(access(".git", AREAD) == -1)
sysfatal("no git repository");
if(strcmp(cmd, "git-receive-pack") == 0 && allowwrite)