M git.h => git.h +22 -0
@@ 18,6 18,8 @@ typedef struct Idxent Idxent;
typedef struct Objlist Objlist;
typedef struct Dtab Dtab;
typedef struct Dblock Dblock;
+typedef struct Objq Objq;
+typedef struct Qelt Qelt;
enum {
Pathmax = 512,
@@ 151,6 153,20 @@ struct Objset {
int sz;
};
+struct Qelt {
+ Object *o;
+ vlong mtime;
+ int color;
+ int dist;
+};
+
+struct Objq {
+ Qelt *heap;
+ int nheap;
+ int heapsz;
+ int nkeep;
+};
+
struct Dtab {
Object *o;
uchar *base;
@@ 301,3 317,9 @@ int gitconnect(Conn *, char *, char *);
int readphase(Conn *);
int writephase(Conn *);
void closeconn(Conn *);
+
+/* queues */
+void qinit(Objq*);
+void qclear(Objq*);
+void qput(Objq*, Object*, int, int);
+int qpop(Objq*, Qelt*);
M pack.c => pack.c +1 -0
@@ 194,6 194,7 @@ loadpack(Packf *pf, char *name)
pf->nidx = packf[i].nidx;
packf[i].idx = nil;
packf[i].pack = nil;
+ return 0;
}
}
if((ifd = open(buf, OREAD)) == -1)
M serve.c => serve.c +1 -5
@@ 98,12 98,8 @@ servnegotiate(Conn *c, Hash **head, int *nhead, Hash **tail, int *ntail)
while(1){
if((n = readpkt(c, pkt, sizeof(pkt))) == -1)
goto error;
- if(strncmp(pkt, "done", 4) == 0)
+ if(n == 0 || strncmp(pkt, "done", 4) == 0)
break;
- if(n == 0){
- if(!acked && fmtpkt(c, "NAK") == -1)
- goto error;
- }
if(strncmp(pkt, "have ", 5) != 0){
werrstr(" protocol garble %s", pkt);
goto error;