]> git.ipfire.org Git - thirdparty/git.git/blobdiff - upload-pack.c
t4039: abstract away SHA-1-specific constants
[thirdparty/git.git] / upload-pack.c
index 4d2129e7fc134cdbc67e08ce9fb4f805023059b5..875db9299682c5d9fb593241e1907c3df9e7d597 100644 (file)
@@ -140,18 +140,17 @@ static void create_pack_file(const struct object_array *have_obj,
                argv_array_push(&pack_objects.args, "--delta-base-offset");
        if (use_include_tag)
                argv_array_push(&pack_objects.args, "--include-tag");
-       if (filter_options.filter_spec) {
-               struct strbuf expanded_filter_spec = STRBUF_INIT;
-               expand_list_objects_filter_spec(&filter_options,
-                                               &expanded_filter_spec);
+       if (filter_options.choice) {
+               const char *spec =
+                       expand_list_objects_filter_spec(&filter_options);
                if (pack_objects.use_shell) {
                        struct strbuf buf = STRBUF_INIT;
-                       sq_quote_buf(&buf, expanded_filter_spec.buf);
+                       sq_quote_buf(&buf, spec);
                        argv_array_pushf(&pack_objects.args, "--filter=%s", buf.buf);
                        strbuf_release(&buf);
                } else {
                        argv_array_pushf(&pack_objects.args, "--filter=%s",
-                                        expanded_filter_spec.buf);
+                                        spec);
                }
        }
 
@@ -528,13 +527,13 @@ static int get_reachable_list(struct object_array *src,
                return -1;
 
        while ((i = read_in_full(cmd.out, namebuf, hexsz + 1)) == hexsz + 1) {
-               struct object_id sha1;
+               struct object_id oid;
                const char *p;
 
-               if (parse_oid_hex(namebuf, &sha1, &p) || *p != '\n')
+               if (parse_oid_hex(namebuf, &oid, &p) || *p != '\n')
                        break;
 
-               o = lookup_object(the_repository, sha1.hash);
+               o = lookup_object(the_repository, &oid);
                if (o && o->type == OBJ_COMMIT) {
                        o->flags &= ~TMP_MARK;
                }
@@ -722,7 +721,7 @@ static void deepen_by_rev_list(struct packet_writer *writer, int ac,
 {
        struct commit_list *result;
 
-       close_commit_graph(the_repository);
+       close_commit_graph(the_repository->objects);
        result = get_shallow_commits_by_rev_list(ac, av, SHALLOW, NOT_SHALLOW);
        send_shallow(writer, result);
        free_commit_list(result);
@@ -884,6 +883,7 @@ static void receive_needs(struct packet_reader *reader, struct object_array *wan
                if (skip_prefix(reader->line, "filter ", &arg)) {
                        if (!filter_capability_requested)
                                die("git upload-pack: filtering capability not negotiated");
+                       list_objects_filter_die_if_populated(&filter_options);
                        parse_list_objects_filter(&filter_options, arg);
                        continue;
                }
@@ -960,7 +960,7 @@ static void receive_needs(struct packet_reader *reader, struct object_array *wan
 static int mark_our_ref(const char *refname, const char *refname_full,
                        const struct object_id *oid)
 {
-       struct object *o = lookup_unknown_object(oid->hash);
+       struct object *o = lookup_unknown_object(oid);
 
        if (ref_is_hidden(refname, refname_full)) {
                o->flags |= HIDDEN_REF;
@@ -1305,6 +1305,7 @@ static void process_args(struct packet_reader *request,
                }
 
                if (allow_filter && skip_prefix(arg, "filter ", &p)) {
+                       list_objects_filter_die_if_populated(&filter_options);
                        parse_list_objects_filter(&filter_options, p);
                        continue;
                }