-#include <signal.h>
-#include <sys/wait.h>
-#include <sys/poll.h>
#include "cache.h"
#include "refs.h"
#include "pkt-line.h"
/* emergency quit */
fd = 2;
if (fd == 2) {
+ /* XXX: are we happy to lose stuff here? */
xwrite(fd, data, sz);
return sz;
}
*cp++ = buffered;
outsz++;
}
- sz = read(pu_pipe[0], cp,
+ sz = xread(pu_pipe[0], cp,
sizeof(data) - outsz);
if (0 < sz)
;
/* Status ready; we ship that in the side-band
* or dump to the standard error.
*/
- sz = read(pe_pipe[0], progress,
+ sz = xread(pe_pipe[0], progress,
sizeof(progress));
if (0 < sz)
send_client_data(2, progress, sz);
continue;
}
len = strip(line, len);
- if (!strncmp(line, "have ", 5)) {
+ if (!prefixcmp(line, "have ")) {
switch (got_sha1(line+5, sha1)) {
case -1: /* they have what we do not */
if (multi_ack && ok_to_give_up())
if (!len)
break;
- if (!strncmp("shallow ", line, 8)) {
+ if (!prefixcmp(line, "shallow ")) {
unsigned char sha1[20];
struct object *object;
use_thin_pack = 0;
add_object_array(object, NULL, &shallows);
continue;
}
- if (!strncmp("deepen ", line, 7)) {
+ if (!prefixcmp(line, "deepen ")) {
char *end;
use_thin_pack = 0;
depth = strtol(line + 7, &end, 0);
die("Invalid deepen: %s", line);
continue;
}
- if (strncmp("want ", line, 5) ||
+ if (prefixcmp(line, "want ") ||
get_sha1_hex(line+5, sha1_buf))
die("git-upload-pack: protocol error, "
"expected to get sha, not '%s'", line);
SHALLOW, NOT_SHALLOW);
while (result) {
struct object *object = &result->item->object;
- if (!(object->flags & CLIENT_SHALLOW)) {
+ if (!(object->flags & (CLIENT_SHALLOW|NOT_SHALLOW))) {
packet_write(1, "shallow %s",
sha1_to_hex(object->sha1));
register_shallow(object->sha1);
object->flags &= ~CLIENT_SHALLOW;
/* make sure the real parents are parsed */
unregister_shallow(object->sha1);
+ object->parsed = 0;
parse_commit((struct commit *)object);
parents = ((struct commit *)object)->parents;
while (parents) {
strict = 1;
continue;
}
- if (!strncmp(arg, "--timeout=", 10)) {
+ if (!prefixcmp(arg, "--timeout=")) {
timeout = atoi(arg+10);
continue;
}
if (!enter_repo(dir, strict))
die("'%s': unable to chdir or not a git archive", dir);
-
+ if (is_repository_shallow())
+ die("attempt to fetch/clone from a shallow repository");
upload_pack();
return 0;
}