Merge branch 'np/maint-1.6.3-deepen'
* np/maint-1.6.3-deepen: pack-objects: free preferred base memory after usage make shallow repository deepening more network efficient
This commit is contained in:
commit
8e4384fd44
@ -1008,6 +1008,33 @@ static void add_preferred_base(unsigned char *sha1)
|
||||
it->pcache.tree_size = size;
|
||||
}
|
||||
|
||||
static void cleanup_preferred_base(void)
|
||||
{
|
||||
struct pbase_tree *it;
|
||||
unsigned i;
|
||||
|
||||
it = pbase_tree;
|
||||
pbase_tree = NULL;
|
||||
while (it) {
|
||||
struct pbase_tree *this = it;
|
||||
it = this->next;
|
||||
free(this->pcache.tree_data);
|
||||
free(this);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(pbase_tree_cache); i++) {
|
||||
if (!pbase_tree_cache[i])
|
||||
continue;
|
||||
free(pbase_tree_cache[i]->tree_data);
|
||||
free(pbase_tree_cache[i]);
|
||||
pbase_tree_cache[i] = NULL;
|
||||
}
|
||||
|
||||
free(done_pbase_paths);
|
||||
done_pbase_paths = NULL;
|
||||
done_pbase_paths_num = done_pbase_paths_alloc = 0;
|
||||
}
|
||||
|
||||
static void check_object(struct object_entry *entry)
|
||||
{
|
||||
if (entry->in_pack) {
|
||||
@ -2312,6 +2339,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||
rp_av[rp_ac] = NULL;
|
||||
get_object_list(rp_ac, rp_av);
|
||||
}
|
||||
cleanup_preferred_base();
|
||||
if (include_tag && nr_result)
|
||||
for_each_ref(add_ref_tag, NULL);
|
||||
stop_progress(&progress_state);
|
||||
|
@ -32,6 +32,7 @@ static int no_progress, daemon_mode;
|
||||
static int shallow_nr;
|
||||
static struct object_array have_obj;
|
||||
static struct object_array want_obj;
|
||||
static struct object_array extra_edge_obj;
|
||||
static unsigned int timeout;
|
||||
/* 0 for no sideband,
|
||||
* otherwise maximum packet size (up to 65520 bytes).
|
||||
@ -135,6 +136,10 @@ static int do_rev_list(int fd, void *create_full_pack)
|
||||
if (prepare_revision_walk(&revs))
|
||||
die("revision walk setup failed");
|
||||
mark_edges_uninteresting(revs.commits, &revs, show_edge);
|
||||
if (use_thin_pack)
|
||||
for (i = 0; i < extra_edge_obj.nr; i++)
|
||||
fprintf(pack_pipe, "-%s\n", sha1_to_hex(
|
||||
extra_edge_obj.objects[i].item->sha1));
|
||||
traverse_commit_list(&revs, show_commit, show_object, NULL);
|
||||
fflush(pack_pipe);
|
||||
fclose(pack_pipe);
|
||||
@ -492,7 +497,6 @@ static void receive_needs(void)
|
||||
if (!prefixcmp(line, "shallow ")) {
|
||||
unsigned char sha1[20];
|
||||
struct object *object;
|
||||
use_thin_pack = 0;
|
||||
if (get_sha1(line + 8, sha1))
|
||||
die("invalid shallow line: %s", line);
|
||||
object = parse_object(sha1);
|
||||
@ -504,7 +508,6 @@ static void receive_needs(void)
|
||||
}
|
||||
if (!prefixcmp(line, "deepen ")) {
|
||||
char *end;
|
||||
use_thin_pack = 0;
|
||||
depth = strtol(line + 7, &end, 0);
|
||||
if (end == line + 7 || depth <= 0)
|
||||
die("Invalid deepen: %s", line);
|
||||
@ -587,6 +590,7 @@ static void receive_needs(void)
|
||||
NULL, &want_obj);
|
||||
parents = parents->next;
|
||||
}
|
||||
add_object_array(object, NULL, &extra_edge_obj);
|
||||
}
|
||||
/* make sure commit traversal conforms to client */
|
||||
register_shallow(object->sha1);
|
||||
|
Loading…
Reference in New Issue
Block a user