aboutsummaryrefslogtreecommitdiff
path: root/upload-pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'upload-pack.c')
-rw-r--r--upload-pack.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/upload-pack.c b/upload-pack.c
index 874000281..7c05b15e6 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -603,6 +603,8 @@ static void receive_needs(void)
object = parse_object(sha1);
if (!object)
die("did not find object for %s", line);
+ if (object->type != OBJ_COMMIT)
+ die("invalid shallow object %s", sha1_to_hex(sha1));
object->flags |= CLIENT_SHALLOW;
add_object_array(object, NULL, &shallows);
continue;
@@ -734,12 +736,7 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo
" include-tag multi_ack_detailed";
struct object *o = lookup_unknown_object(sha1);
const char *refname_nons = strip_namespace(refname);
-
- if (o->type == OBJ_NONE) {
- o->type = sha1_object_info(sha1, NULL);
- if (o->type < 0)
- die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1));
- }
+ unsigned char peeled[20];
if (capabilities)
packet_write(1, "%s %s%c%s%s agent=%s\n",
@@ -754,11 +751,8 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo
o->flags |= OUR_REF;
nr_our_refs++;
}
- if (o->type == OBJ_TAG) {
- o = deref_tag_noverify(o);
- if (o)
- packet_write(1, "%s %s^{}\n", sha1_to_hex(o->sha1), refname_nons);
- }
+ if (!peel_ref(refname, peeled))
+ packet_write(1, "%s %s^{}\n", sha1_to_hex(peeled), refname_nons);
return 0;
}