diff options
Diffstat (limited to 'upload-pack.c')
-rw-r--r-- | upload-pack.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/upload-pack.c b/upload-pack.c index ac9ac1592d..745fda8515 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -74,7 +74,7 @@ static int write_one_shallow(const struct commit_graft *graft, void *cb_data) { FILE *fp = cb_data; if (graft->nr_parent == -1) - fprintf(fp, "--shallow %s\n", sha1_to_hex(graft->sha1)); + fprintf(fp, "--shallow %s\n", oid_to_hex(&graft->oid)); return 0; } @@ -86,7 +86,7 @@ static void create_pack_file(void) "corruption on the remote side."; int buffered = -1; ssize_t sz; - const char *argv[12]; + const char *argv[13]; int i, arg = 0; FILE *pipe_fd; @@ -100,6 +100,8 @@ static void create_pack_file(void) argv[arg++] = "--thin"; argv[arg++] = "--stdout"; + if (shallow_nr) + argv[arg++] = "--shallow"; if (!no_progress) argv[arg++] = "--progress"; if (use_ofs_delta) @@ -679,7 +681,7 @@ static void receive_needs(void) } /* return non-zero if the ref is hidden, otherwise 0 */ -static int mark_our_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data) +static int mark_our_ref(const char *refname, const unsigned char *sha1) { struct object *o = lookup_unknown_object(sha1); @@ -687,12 +689,16 @@ static int mark_our_ref(const char *refname, const unsigned char *sha1, int flag o->flags |= HIDDEN_REF; return 1; } - if (!o) - die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1)); o->flags |= OUR_REF; return 0; } +static int check_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data) +{ + mark_our_ref(refname, sha1); + return 0; +} + static void format_symref_info(struct strbuf *buf, struct string_list *symref) { struct string_list_item *item; @@ -711,7 +717,7 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo const char *refname_nons = strip_namespace(refname); unsigned char peeled[20]; - if (mark_our_ref(refname, sha1, flag, NULL)) + if (mark_our_ref(refname, sha1)) return 0; if (capabilities) { @@ -765,8 +771,8 @@ static void upload_pack(void) advertise_shallow_grafts(1); packet_flush(1); } else { - head_ref_namespaced(mark_our_ref, NULL); - for_each_namespaced_ref(mark_our_ref, NULL); + head_ref_namespaced(check_ref, NULL); + for_each_namespaced_ref(check_ref, NULL); } string_list_clear(&symref, 1); if (advertise_refs) |