Re: [PATCH] Add --no-reuse-delta, --window, and --depth options to
- From
Junio C Hamano <junkio@cox.net>
- Date
- May 8, 2007, 21:12 UTC
- Message-ID
- <7vwszj10kn.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <alpine.LFD.0.99.0705081005400.24220@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
> In which case, it is git-gc that needs to get a bit smarter. Maybe > something like this:
I agree git-gc should be tuned to "one size fits all well enough" default, rather than getting more complicated parameters to fine tune its behaviour to satisfy power users.
Show 22 quoted lines
> @@ -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?