summaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-09-17 18:42:33 -0700
committerJunio C Hamano <junkio@cox.net>2006-09-17 18:42:33 -0700
commit7f0f4fa4374edfe2050b3ab636f43ee80daa63f2 (patch)
tree7b7494045e7f3ebfcc9dc1067994f81124bc97a4 /upload-pack.c
parent4405fb77f466ddd223b999d009a705601a90b0e6 (diff)
parentc04c4e5708c9ad3dc534ff50ad8f28de5a7cfbff (diff)
downloadgit-7f0f4fa4374edfe2050b3ab636f43ee80daa63f2.tar.gz
Merge part of branch 'jc/upload-pack'
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/upload-pack.c b/upload-pack.c
index b673d8cb97..189b239cc0 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -329,7 +329,8 @@ static int got_sha1(char *hex, unsigned char *sha1)
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;
@@ -346,21 +347,22 @@ static int get_common_commits(void)
}
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)
- hashcpy(last_sha1, sha1);
+ 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");