From: Junio C Hamano Date: Fri, 14 Jul 2006 22:39:19 +0000 (-0700) Subject: Merge branch 'lt/unitype' X-Git-Tag: v1.4.2-rc1~5 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/5cd060b56c3d0b9f2340377d73dfe1abbcbe8a20?ds=inline;hp=-c Merge branch 'lt/unitype' * lt/unitype: builtin-prune.c: forgot TYPE => OBJ changes. Remove TYPE_* constant macros and use object_type enums consistently. --- 5cd060b56c3d0b9f2340377d73dfe1abbcbe8a20 diff --combined commit.c index 6ac3bf7554,4c5aac8765..77f0ca175c --- a/commit.c +++ b/commit.c @@@ -56,7 -56,7 +56,7 @@@ static struct commit *check_commit(stru const unsigned char *sha1, int quiet) { - if (obj->type != TYPE_COMMIT) { + if (obj->type != OBJ_COMMIT) { if (!quiet) error("Object %s is a %s, not a commit", sha1_to_hex(sha1), typename(obj->type)); @@@ -86,11 -86,11 +86,11 @@@ struct commit *lookup_commit(const unsi if (!obj) { struct commit *ret = alloc_commit_node(); created_object(sha1, &ret->object); - ret->object.type = TYPE_COMMIT; + ret->object.type = OBJ_COMMIT; return ret; } if (!obj->type) - obj->type = TYPE_COMMIT; + obj->type = OBJ_COMMIT; return check_commit(obj, sha1, 0); } @@@ -655,9 -655,6 +655,9 @@@ unsigned long pretty_print_commit(enum continue; } + if (!subject) + body = 1; + if (is_empty_line(line, &linelen)) { if (!body) continue; @@@ -665,6 -662,8 +665,6 @@@ continue; if (fmt == CMIT_FMT_SHORT) break; - } else { - body = 1; } if (subject) { @@@ -703,12 -702,6 +703,12 @@@ /* Make sure there is an EOLN for the non-oneline case */ if (fmt != CMIT_FMT_ONELINE) buf[offset++] = '\n'; + /* + * make sure there is another EOLN to separate the headers from whatever + * body the caller appends if we haven't already written a body + */ + if (fmt == CMIT_FMT_EMAIL && !body) + buf[offset++] = '\n'; buf[offset] = '\0'; return offset; } diff --combined upload-pack.c index 94aa0dab48,2e820c9c85..f6f5a7e3db --- a/upload-pack.c +++ b/upload-pack.c @@@ -51,10 -51,6 +51,10 @@@ static ssize_t send_client_data(int fd if (fd == 3) /* emergency quit */ fd = 2; + if (fd == 2) { + xwrite(fd, data, sz); + return sz; + } return safe_write(fd, data, sz); } p = data; @@@ -330,7 -326,7 +330,7 @@@ static int got_sha1(char *hex, unsigne o = parse_object(sha1); if (!o) die("oops (%s)", sha1_to_hex(sha1)); - if (o->type == TYPE_COMMIT) { + if (o->type == OBJ_COMMIT) { struct commit_list *parents; if (o->flags & THEY_HAVE) return 0; @@@ -461,7 -457,7 +461,7 @@@ static int send_ref(const char *refname o->flags |= OUR_REF; nr_our_refs++; } - if (o->type == TYPE_TAG) { + if (o->type == OBJ_TAG) { o = deref_tag(o, refname, 0); packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname); }