Show 31 quoted lines
> Nicolas Pitre <nico@cam.org> writes:
>
> > @@ -65,7 +65,20 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
> > if (run_command_v_opt(argv_reflog, RUN_GIT_CMD))
> > return error(FAILED_RUN, argv_reflog[0]);
> >
> > - if (run_command_v_opt(argv_repack, RUN_GIT_CMD))
> > + if (num_loose_objects() > 0) {
> > + do_repack = 1;
> > + } else {
> > + struct packed_git *p;
> > + unsigned long num_pack = 0;
> > + if (!packed_git)
> > + prepare_packed_git();
> > + for (p = packed_git; p; p = p->next)
> > + if (p->pack_local)
> > + num_pack++;
> > + if (num_pack > 1)
> > + do_repack = 1;
> > + }
> > + if (do_repack && run_command_v_opt(argv_repack, RUN_GIT_CMD))
> > return error(FAILED_RUN, argv_repack[0]);
> >
> > if (prune && run_command_v_opt(argv_prune, RUN_GIT_CMD))
>
> Is this even correct?
>
> When your repository is fully packed, if you decided to discard
> one of your topic branches with "git branch -D", what does this
> code do? We see no loose objects, we see only one pack, so the
> unreachable objects are left in the pack?