]> git.ipfire.org Git - thirdparty/git.git/blame - builtin/repack.c
gitweb: correctly store previous rev in javascript-actions mode
[thirdparty/git.git] / builtin / repack.c
CommitLineData
a1bbc6c0
SB
1#include "builtin.h"
2#include "cache.h"
b2141fc1 3#include "config.h"
a1bbc6c0
SB
4#include "dir.h"
5#include "parse-options.h"
6#include "run-command.h"
7#include "sigchain.h"
8#include "strbuf.h"
9#include "string-list.h"
10#include "argv-array.h"
525e18c0 11#include "midx.h"
5d19e813 12#include "packfile.h"
36f0f344 13#include "object-store.h"
a1bbc6c0
SB
14
15static int delta_base_offset = 1;
ee34a2be 16static int pack_kept_objects = -1;
36eba032 17static int write_bitmaps = -1;
16d75fa4 18static int use_delta_islands;
a1bbc6c0
SB
19static char *packdir, *packtmp;
20
21static const char *const git_repack_usage[] = {
9c9b4f2f 22 N_("git repack [<options>]"),
a1bbc6c0
SB
23 NULL
24};
25
1c409a70
DT
26static const char incremental_bitmap_conflict_error[] = N_(
27"Incremental repacks are incompatible with bitmap indexes. Use\n"
28"--no-write-bitmap-index or disable the pack.writebitmaps configuration."
29);
30
31
a1bbc6c0
SB
32static int repack_config(const char *var, const char *value, void *cb)
33{
34 if (!strcmp(var, "repack.usedeltabaseoffset")) {
35 delta_base_offset = git_config_bool(var, value);
36 return 0;
37 }
ee34a2be
JK
38 if (!strcmp(var, "repack.packkeptobjects")) {
39 pack_kept_objects = git_config_bool(var, value);
40 return 0;
41 }
71d76cb4
JK
42 if (!strcmp(var, "repack.writebitmaps") ||
43 !strcmp(var, "pack.writebitmaps")) {
d078d85b 44 write_bitmaps = git_config_bool(var, value);
3198b89f
JK
45 return 0;
46 }
16d75fa4
JK
47 if (!strcmp(var, "repack.usedeltaislands")) {
48 use_delta_islands = git_config_bool(var, value);
49 return 0;
50 }
a1bbc6c0
SB
51 return git_default_config(var, value, cb);
52}
53
54/*
55 * Remove temporary $GIT_OBJECT_DIRECTORY/pack/.tmp-$$-pack-* files.
56 */
57static void remove_temporary_files(void)
58{
59 struct strbuf buf = STRBUF_INIT;
60 size_t dirlen, prefixlen;
61 DIR *dir;
62 struct dirent *e;
63
64 dir = opendir(packdir);
65 if (!dir)
66 return;
67
68 /* Point at the slash at the end of ".../objects/pack/" */
69 dirlen = strlen(packdir) + 1;
70 strbuf_addstr(&buf, packtmp);
71 /* Hold the length of ".tmp-%d-pack-" */
72 prefixlen = buf.len - dirlen;
73
74 while ((e = readdir(dir))) {
75 if (strncmp(e->d_name, buf.buf + dirlen, prefixlen))
76 continue;
77 strbuf_setlen(&buf, dirlen);
78 strbuf_addstr(&buf, e->d_name);
79 unlink(buf.buf);
80 }
81 closedir(dir);
82 strbuf_release(&buf);
83}
84
85static void remove_pack_on_signal(int signo)
86{
87 remove_temporary_files();
88 sigchain_pop(signo);
89 raise(signo);
90}
91
92/*
93 * Adds all packs hex strings to the fname list, which do not
5d19e813 94 * have a corresponding .keep file. These packs are not to
0c16cd49 95 * be kept if we are going to pack everything into one file.
a1bbc6c0 96 */
ed7e5fc3
NTND
97static void get_non_kept_pack_filenames(struct string_list *fname_list,
98 const struct string_list *extra_keep)
a1bbc6c0
SB
99{
100 DIR *dir;
101 struct dirent *e;
102 char *fname;
a1bbc6c0
SB
103
104 if (!(dir = opendir(packdir)))
105 return;
106
107 while ((e = readdir(dir)) != NULL) {
26936bfd 108 size_t len;
ed7e5fc3
NTND
109 int i;
110
111 for (i = 0; i < extra_keep->nr; i++)
112 if (!fspathcmp(e->d_name, extra_keep->items[i].string))
113 break;
114 if (extra_keep->nr > 0 && i < extra_keep->nr)
115 continue;
116
26936bfd 117 if (!strip_suffix(e->d_name, ".pack", &len))
a1bbc6c0
SB
118 continue;
119
a1bbc6c0
SB
120 fname = xmemdupz(e->d_name, len);
121
5d19e813 122 if (!file_exists(mkpath("%s/%s.keep", packdir, fname)))
a1bbc6c0
SB
123 string_list_append_nodup(fname_list, fname);
124 else
125 free(fname);
126 }
127 closedir(dir);
128}
129
130static void remove_redundant_pack(const char *dir_name, const char *base_name)
131{
a1bbc6c0 132 struct strbuf buf = STRBUF_INIT;
8434e85d
DS
133 strbuf_addf(&buf, "%s/%s.pack", dir_name, base_name);
134 unlink_pack_path(buf.buf, 1);
a1bbc6c0
SB
135 strbuf_release(&buf);
136}
137
2b958e79
JT
138struct pack_objects_args {
139 const char *window;
140 const char *window_memory;
141 const char *depth;
142 const char *threads;
143 const char *max_pack_size;
144 int no_reuse_delta;
145 int no_reuse_object;
146 int quiet;
147 int local;
148};
149
150static void prepare_pack_objects(struct child_process *cmd,
151 const struct pack_objects_args *args)
152{
153 argv_array_push(&cmd->args, "pack-objects");
154 if (args->window)
155 argv_array_pushf(&cmd->args, "--window=%s", args->window);
156 if (args->window_memory)
157 argv_array_pushf(&cmd->args, "--window-memory=%s", args->window_memory);
158 if (args->depth)
159 argv_array_pushf(&cmd->args, "--depth=%s", args->depth);
160 if (args->threads)
161 argv_array_pushf(&cmd->args, "--threads=%s", args->threads);
162 if (args->max_pack_size)
163 argv_array_pushf(&cmd->args, "--max-pack-size=%s", args->max_pack_size);
164 if (args->no_reuse_delta)
165 argv_array_pushf(&cmd->args, "--no-reuse-delta");
166 if (args->no_reuse_object)
167 argv_array_pushf(&cmd->args, "--no-reuse-object");
168 if (args->local)
169 argv_array_push(&cmd->args, "--local");
170 if (args->quiet)
171 argv_array_push(&cmd->args, "--quiet");
172 if (delta_base_offset)
173 argv_array_push(&cmd->args, "--delta-base-offset");
174 argv_array_push(&cmd->args, packtmp);
175 cmd->git_cmd = 1;
176 cmd->out = -1;
177}
178
5d19e813
JT
179/*
180 * Write oid to the given struct child_process's stdin, starting it first if
181 * necessary.
182 */
183static int write_oid(const struct object_id *oid, struct packed_git *pack,
184 uint32_t pos, void *data)
185{
186 struct child_process *cmd = data;
187
188 if (cmd->in == -1) {
189 if (start_command(cmd))
c83d950e 190 die(_("could not start pack-objects to repack promisor objects"));
5d19e813
JT
191 }
192
193 xwrite(cmd->in, oid_to_hex(oid), GIT_SHA1_HEXSZ);
194 xwrite(cmd->in, "\n", 1);
195 return 0;
196}
197
198static void repack_promisor_objects(const struct pack_objects_args *args,
199 struct string_list *names)
200{
201 struct child_process cmd = CHILD_PROCESS_INIT;
202 FILE *out;
203 struct strbuf line = STRBUF_INIT;
204
205 prepare_pack_objects(&cmd, args);
206 cmd.in = -1;
207
208 /*
209 * NEEDSWORK: Giving pack-objects only the OIDs without any ordering
210 * hints may result in suboptimal deltas in the resulting pack. See if
211 * the OIDs can be sent with fake paths such that pack-objects can use a
212 * {type -> existing pack order} ordering when computing deltas instead
213 * of a {type -> size} ordering, which may produce better deltas.
214 */
215 for_each_packed_object(write_oid, &cmd,
216 FOR_EACH_OBJECT_PROMISOR_ONLY);
217
218 if (cmd.in == -1)
219 /* No packed objects; cmd was never started */
220 return;
221
222 close(cmd.in);
223
224 out = xfdopen(cmd.out, "r");
225 while (strbuf_getline_lf(&line, out) != EOF) {
226 char *promisor_name;
227 int fd;
2f0c9e9a 228 if (line.len != the_hash_algo->hexsz)
3813a89f 229 die(_("repack: Expecting full hex object ID lines only from pack-objects."));
5d19e813
JT
230 string_list_append(names, line.buf);
231
232 /*
233 * pack-objects creates the .pack and .idx files, but not the
234 * .promisor file. Create the .promisor file, which is empty.
235 */
236 promisor_name = mkpathdup("%s-%s.promisor", packtmp,
237 line.buf);
238 fd = open(promisor_name, O_CREAT|O_EXCL|O_WRONLY, 0600);
239 if (fd < 0)
c83d950e 240 die_errno(_("unable to create '%s'"), promisor_name);
5d19e813
JT
241 close(fd);
242 free(promisor_name);
243 }
244 fclose(out);
245 if (finish_command(&cmd))
c83d950e 246 die(_("could not finish pack-objects to repack promisor objects"));
5d19e813
JT
247}
248
a1bbc6c0
SB
249#define ALL_INTO_ONE 1
250#define LOOSEN_UNREACHABLE 2
251
252int cmd_repack(int argc, const char **argv, const char *prefix)
253{
42a02d85
JK
254 struct {
255 const char *name;
b77fcd1e 256 unsigned optional:1;
42a02d85
JK
257 } exts[] = {
258 {".pack"},
259 {".idx"},
5cf2741c 260 {".bitmap", 1},
5d19e813 261 {".promisor", 1},
42a02d85 262 };
d3180279 263 struct child_process cmd = CHILD_PROCESS_INIT;
a1bbc6c0 264 struct string_list_item *item;
a1bbc6c0
SB
265 struct string_list names = STRING_LIST_INIT_DUP;
266 struct string_list rollback = STRING_LIST_INIT_NODUP;
267 struct string_list existing_packs = STRING_LIST_INIT_DUP;
268 struct strbuf line = STRBUF_INIT;
ed7e5fc3 269 int i, ext, ret, failed;
a1bbc6c0
SB
270 FILE *out;
271
272 /* variables to be filled by option parsing */
273 int pack_everything = 0;
274 int delete_redundant = 0;
aa8bd519 275 const char *unpack_unreachable = NULL;
905f27b8 276 int keep_unreachable = 0;
ed7e5fc3 277 struct string_list keep_pack_list = STRING_LIST_INIT_NODUP;
a1bbc6c0 278 int no_update_server_info = 0;
525e18c0 279 int midx_cleared = 0;
2b958e79 280 struct pack_objects_args po_args = {NULL};
a1bbc6c0
SB
281
282 struct option builtin_repack_options[] = {
283 OPT_BIT('a', NULL, &pack_everything,
284 N_("pack everything in a single pack"), ALL_INTO_ONE),
285 OPT_BIT('A', NULL, &pack_everything,
286 N_("same as -a, and turn unreachable objects loose"),
287 LOOSEN_UNREACHABLE | ALL_INTO_ONE),
288 OPT_BOOL('d', NULL, &delete_redundant,
289 N_("remove redundant packs, and run git-prune-packed")),
2b958e79 290 OPT_BOOL('f', NULL, &po_args.no_reuse_delta,
a1bbc6c0 291 N_("pass --no-reuse-delta to git-pack-objects")),
2b958e79 292 OPT_BOOL('F', NULL, &po_args.no_reuse_object,
a1bbc6c0
SB
293 N_("pass --no-reuse-object to git-pack-objects")),
294 OPT_BOOL('n', NULL, &no_update_server_info,
295 N_("do not run git-update-server-info")),
2b958e79
JT
296 OPT__QUIET(&po_args.quiet, N_("be quiet")),
297 OPT_BOOL('l', "local", &po_args.local,
a1bbc6c0 298 N_("pass --local to git-pack-objects")),
d078d85b 299 OPT_BOOL('b', "write-bitmap-index", &write_bitmaps,
5cf2741c 300 N_("write bitmap index")),
16d75fa4
JK
301 OPT_BOOL('i', "delta-islands", &use_delta_islands,
302 N_("pass --delta-islands to git-pack-objects")),
a1bbc6c0
SB
303 OPT_STRING(0, "unpack-unreachable", &unpack_unreachable, N_("approxidate"),
304 N_("with -A, do not loosen objects older than this")),
905f27b8
JK
305 OPT_BOOL('k', "keep-unreachable", &keep_unreachable,
306 N_("with -a, repack unreachable objects")),
2b958e79 307 OPT_STRING(0, "window", &po_args.window, N_("n"),
a1bbc6c0 308 N_("size of the window used for delta compression")),
2b958e79 309 OPT_STRING(0, "window-memory", &po_args.window_memory, N_("bytes"),
a1bbc6c0 310 N_("same as the above, but limit memory size instead of entries count")),
2b958e79 311 OPT_STRING(0, "depth", &po_args.depth, N_("n"),
a1bbc6c0 312 N_("limits the maximum delta depth")),
2b958e79 313 OPT_STRING(0, "threads", &po_args.threads, N_("n"),
40bcf318 314 N_("limits the maximum number of threads")),
2b958e79 315 OPT_STRING(0, "max-pack-size", &po_args.max_pack_size, N_("bytes"),
a1bbc6c0 316 N_("maximum size of each packfile")),
ee34a2be
JK
317 OPT_BOOL(0, "pack-kept-objects", &pack_kept_objects,
318 N_("repack objects in packs marked with .keep")),
ed7e5fc3
NTND
319 OPT_STRING_LIST(0, "keep-pack", &keep_pack_list, N_("name"),
320 N_("do not repack this pack")),
a1bbc6c0
SB
321 OPT_END()
322 };
323
324 git_config(repack_config, NULL);
325
326 argc = parse_options(argc, argv, prefix, builtin_repack_options,
327 git_repack_usage, 0);
328
067fbd41
JK
329 if (delete_redundant && repository_format_precious_objects)
330 die(_("cannot delete packs in a precious-objects repo"));
331
905f27b8
JK
332 if (keep_unreachable &&
333 (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE)))
334 die(_("--keep-unreachable and -A are incompatible"));
335
73284822 336 if (write_bitmaps < 0) {
25575015 337 if (!(pack_everything & ALL_INTO_ONE) ||
7ff024e7 338 !is_bare_repository())
25575015 339 write_bitmaps = 0;
73284822 340 }
ee34a2be 341 if (pack_kept_objects < 0)
7ff024e7 342 pack_kept_objects = write_bitmaps > 0;
ee34a2be 343
1c409a70
DT
344 if (write_bitmaps && !(pack_everything & ALL_INTO_ONE))
345 die(_(incremental_bitmap_conflict_error));
346
a1bbc6c0
SB
347 packdir = mkpathdup("%s/pack", get_object_directory());
348 packtmp = mkpathdup("%s/.tmp-%d-pack", packdir, (int)getpid());
349
350 sigchain_push_common(remove_pack_on_signal);
351
2b958e79
JT
352 prepare_pack_objects(&cmd, &po_args);
353
a2bae2dc 354 argv_array_push(&cmd.args, "--keep-true-parents");
ee34a2be 355 if (!pack_kept_objects)
a2bae2dc 356 argv_array_push(&cmd.args, "--honor-pack-keep");
ed7e5fc3
NTND
357 for (i = 0; i < keep_pack_list.nr; i++)
358 argv_array_pushf(&cmd.args, "--keep-pack=%s",
359 keep_pack_list.items[i].string);
a2bae2dc
RS
360 argv_array_push(&cmd.args, "--non-empty");
361 argv_array_push(&cmd.args, "--all");
362 argv_array_push(&cmd.args, "--reflog");
363 argv_array_push(&cmd.args, "--indexed-objects");
0c16cd49
JT
364 if (repository_format_partial_clone)
365 argv_array_push(&cmd.args, "--exclude-promisor-objects");
25575015 366 if (write_bitmaps > 0)
a2bae2dc 367 argv_array_push(&cmd.args, "--write-bitmap-index");
25575015
JK
368 else if (write_bitmaps < 0)
369 argv_array_push(&cmd.args, "--write-bitmap-index-quiet");
16d75fa4
JK
370 if (use_delta_islands)
371 argv_array_push(&cmd.args, "--delta-islands");
a1bbc6c0
SB
372
373 if (pack_everything & ALL_INTO_ONE) {
ed7e5fc3 374 get_non_kept_pack_filenames(&existing_packs, &keep_pack_list);
a1bbc6c0 375
5d19e813
JT
376 repack_promisor_objects(&po_args, &names);
377
a1bbc6c0 378 if (existing_packs.nr && delete_redundant) {
8d422993 379 if (unpack_unreachable) {
a2bae2dc 380 argv_array_pushf(&cmd.args,
a1bbc6c0
SB
381 "--unpack-unreachable=%s",
382 unpack_unreachable);
8d422993
JK
383 argv_array_push(&cmd.env_array, "GIT_REF_PARANOIA=1");
384 } else if (pack_everything & LOOSEN_UNREACHABLE) {
a2bae2dc 385 argv_array_push(&cmd.args,
a1bbc6c0 386 "--unpack-unreachable");
905f27b8
JK
387 } else if (keep_unreachable) {
388 argv_array_push(&cmd.args, "--keep-unreachable");
e26a8c47 389 argv_array_push(&cmd.args, "--pack-loose-unreachable");
8d422993
JK
390 } else {
391 argv_array_push(&cmd.env_array, "GIT_REF_PARANOIA=1");
392 }
a1bbc6c0
SB
393 }
394 } else {
a2bae2dc
RS
395 argv_array_push(&cmd.args, "--unpacked");
396 argv_array_push(&cmd.args, "--incremental");
a1bbc6c0
SB
397 }
398
a1bbc6c0
SB
399 cmd.no_stdin = 1;
400
401 ret = start_command(&cmd);
402 if (ret)
ffc9329f 403 return ret;
a1bbc6c0 404
a1bbc6c0 405 out = xfdopen(cmd.out, "r");
8f309aeb 406 while (strbuf_getline_lf(&line, out) != EOF) {
2f0c9e9a 407 if (line.len != the_hash_algo->hexsz)
3813a89f 408 die(_("repack: Expecting full hex object ID lines only from pack-objects."));
a1bbc6c0 409 string_list_append(&names, line.buf);
a1bbc6c0
SB
410 }
411 fclose(out);
412 ret = finish_command(&cmd);
413 if (ret)
ffc9329f 414 return ret;
a1bbc6c0 415
2b958e79 416 if (!names.nr && !po_args.quiet)
c83d950e 417 printf_ln(_("Nothing new to pack."));
a1bbc6c0 418
2d511cfc 419 close_object_store(the_repository->objects);
5bdece0d 420
a1bbc6c0
SB
421 /*
422 * Ok we have prepared all new packfiles.
423 * First see if there are packs of the same name and if so
424 * if we can move them out of the way (this can happen if we
425 * repacked immediately after packing fully.
426 */
427 failed = 0;
428 for_each_string_list_item(item, &names) {
b328c216 429 for (ext = 0; ext < ARRAY_SIZE(exts); ext++) {
e3cf2303 430 char *fname, *fname_old;
525e18c0
DS
431
432 if (!midx_cleared) {
1dcd9f20 433 clear_midx_file(the_repository);
525e18c0
DS
434 midx_cleared = 1;
435 }
436
9d7fbfd2 437 fname = mkpathdup("%s/pack-%s%s", packdir,
42a02d85 438 item->string, exts[ext].name);
a1bbc6c0
SB
439 if (!file_exists(fname)) {
440 free(fname);
441 continue;
442 }
443
e3cf2303 444 fname_old = mkpathdup("%s/old-%s%s", packdir,
42a02d85 445 item->string, exts[ext].name);
a1bbc6c0
SB
446 if (file_exists(fname_old))
447 if (unlink(fname_old))
448 failed = 1;
449
450 if (!failed && rename(fname, fname_old)) {
451 free(fname);
e3cf2303 452 free(fname_old);
a1bbc6c0
SB
453 failed = 1;
454 break;
455 } else {
456 string_list_append(&rollback, fname);
e3cf2303 457 free(fname_old);
a1bbc6c0
SB
458 }
459 }
460 if (failed)
461 break;
462 }
463 if (failed) {
464 struct string_list rollback_failure = STRING_LIST_INIT_DUP;
465 for_each_string_list_item(item, &rollback) {
e3cf2303 466 char *fname, *fname_old;
a1bbc6c0 467 fname = mkpathdup("%s/%s", packdir, item->string);
e3cf2303 468 fname_old = mkpathdup("%s/old-%s", packdir, item->string);
a1bbc6c0
SB
469 if (rename(fname_old, fname))
470 string_list_append(&rollback_failure, fname);
471 free(fname);
e3cf2303 472 free(fname_old);
a1bbc6c0
SB
473 }
474
475 if (rollback_failure.nr) {
476 int i;
477 fprintf(stderr,
c83d950e
NTND
478 _("WARNING: Some packs in use have been renamed by\n"
479 "WARNING: prefixing old- to their name, in order to\n"
480 "WARNING: replace them with the new version of the\n"
481 "WARNING: file. But the operation failed, and the\n"
482 "WARNING: attempt to rename them back to their\n"
483 "WARNING: original names also failed.\n"
484 "WARNING: Please rename them in %s manually:\n"), packdir);
a1bbc6c0
SB
485 for (i = 0; i < rollback_failure.nr; i++)
486 fprintf(stderr, "WARNING: old-%s -> %s\n",
487 rollback_failure.items[i].string,
488 rollback_failure.items[i].string);
489 }
490 exit(1);
491 }
492
493 /* Now the ones with the same name are out of the way... */
494 for_each_string_list_item(item, &names) {
b328c216 495 for (ext = 0; ext < ARRAY_SIZE(exts); ext++) {
a1bbc6c0
SB
496 char *fname, *fname_old;
497 struct stat statbuffer;
b77fcd1e 498 int exists = 0;
a1bbc6c0 499 fname = mkpathdup("%s/pack-%s%s",
42a02d85 500 packdir, item->string, exts[ext].name);
a1bbc6c0 501 fname_old = mkpathdup("%s-%s%s",
42a02d85 502 packtmp, item->string, exts[ext].name);
a1bbc6c0
SB
503 if (!stat(fname_old, &statbuffer)) {
504 statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
505 chmod(fname_old, statbuffer.st_mode);
b77fcd1e
JK
506 exists = 1;
507 }
508 if (exists || !exts[ext].optional) {
509 if (rename(fname_old, fname))
510 die_errno(_("renaming '%s' failed"), fname_old);
a1bbc6c0 511 }
a1bbc6c0
SB
512 free(fname);
513 free(fname_old);
514 }
515 }
516
517 /* Remove the "old-" files */
518 for_each_string_list_item(item, &names) {
b328c216 519 for (ext = 0; ext < ARRAY_SIZE(exts); ext++) {
e3cf2303
JK
520 char *fname;
521 fname = mkpathdup("%s/old-%s%s",
522 packdir,
523 item->string,
524 exts[ext].name);
0b63c6a5 525 if (remove_path(fname))
e923a8ab 526 warning(_("failed to remove '%s'"), fname);
e3cf2303 527 free(fname);
a1bbc6c0
SB
528 }
529 }
530
531 /* End of pack replacement. */
532
5d19e813
JT
533 reprepare_packed_git(the_repository);
534
a1bbc6c0 535 if (delete_redundant) {
2f0c9e9a 536 const int hexsz = the_hash_algo->hexsz;
4489a480 537 int opts = 0;
3383e199 538 string_list_sort(&names);
a1bbc6c0
SB
539 for_each_string_list_item(item, &existing_packs) {
540 char *sha1;
541 size_t len = strlen(item->string);
2f0c9e9a 542 if (len < hexsz)
a1bbc6c0 543 continue;
2f0c9e9a 544 sha1 = item->string + len - hexsz;
a1bbc6c0
SB
545 if (!string_list_has_string(&names, sha1))
546 remove_redundant_pack(packdir, item->string);
547 }
2b958e79 548 if (!po_args.quiet && isatty(2))
4489a480
RS
549 opts |= PRUNE_PACKED_VERBOSE;
550 prune_packed_objects(opts);
5dcfbf56
JS
551
552 if (!keep_unreachable &&
553 (!(pack_everything & LOOSEN_UNREACHABLE) ||
554 unpack_unreachable) &&
555 is_repository_shallow(the_repository))
556 prune_shallow(PRUNE_QUICK);
a1bbc6c0
SB
557 }
558
4489a480
RS
559 if (!no_update_server_info)
560 update_server_info(0);
a1bbc6c0 561 remove_temporary_files();
0465a505
DS
562
563 if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0))
564 write_midx_file(get_object_directory());
565
a1bbc6c0
SB
566 string_list_clear(&names, 0);
567 string_list_clear(&rollback, 0);
568 string_list_clear(&existing_packs, 0);
569 strbuf_release(&line);
570
571 return 0;
572}