summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 182a8da)
raw | patch | inline | side by side (parent: 182a8da)
author | Junio C Hamano <junkio@cox.net> | |
Thu, 6 Jul 2006 01:12:12 +0000 (18:12 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 13 Aug 2006 05:21:43 +0000 (22:21 -0700) |
No changes to what it does, but separating the codepath clearly
with if ... else if ... chain makes it easier to follow.
Signed-off-by: Junio C Hamano <junkio@cox.net>
with if ... else if ... chain makes it easier to follow.
Signed-off-by: Junio C Hamano <junkio@cox.net>
upload-pack.c | patch | blob | history |
diff --git a/upload-pack.c b/upload-pack.c
index bbd6bd60b52d806be0a69324009755f49b070082..35c7ecb7b4efabc700dc22bfe76617be1ea38b4a 100644 (file)
--- a/upload-pack.c
+++ b/upload-pack.c
static int get_common_commits(void)
{
static char line[1000];
- unsigned char sha1[20], last_sha1[20];
+ unsigned char sha1[20];
+ char hex[41], last_hex[41];
int len;
track_object_refs = 0;
}
len = strip(line, len);
if (!strncmp(line, "have ", 5)) {
- if (got_sha1(line+5, sha1) &&
- (multi_ack || have_obj.nr == 1)) {
- packet_write(1, "ACK %s%s\n",
- sha1_to_hex(sha1),
- multi_ack ? " continue" : "");
- if (multi_ack)
- memcpy(last_sha1, sha1, 20);
+ if (got_sha1(line+5, sha1)) {
+ memcpy(hex, sha1_to_hex(sha1), 41);
+ if (multi_ack) {
+ const char *msg = "ACK %s continue\n";
+ packet_write(1, msg, hex);
+ memcpy(last_hex, hex, 41);
+ }
+ else if (have_obj.nr == 1)
+ packet_write(1, "ACK %s\n", hex);
}
continue;
}
if (!strcmp(line, "done")) {
if (have_obj.nr > 0) {
if (multi_ack)
- packet_write(1, "ACK %s\n",
- sha1_to_hex(last_sha1));
+ packet_write(1, "ACK %s\n", last_hex);
return 0;
}
packet_write(1, "NAK\n");