Commit d2b084c
builtin/gc: avoid global state in
The `gc_before_repack()` should only ever run once in git-gc(1), but we
may end up calling it twice when the "--detach" flag is passed. The
duplicated call is avoided though via a static flag in this function.
This pattern is somewhat unintuitive though. Refactor it to drop the
static flag and instead guard the second call of `gc_before_repack()`
via `opts.detach`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>gc_before_repack()
1 parent 697202b commit d2b084c
1 file changed
+9
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
816 | 816 | | |
817 | 817 | | |
818 | 818 | | |
819 | | - | |
820 | | - | |
| 819 | + | |
| 820 | + | |
821 | 821 | | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | 822 | | |
832 | | - | |
| 823 | + | |
833 | 824 | | |
834 | | - | |
| 825 | + | |
| 826 | + | |
835 | 827 | | |
836 | 828 | | |
837 | 829 | | |
| |||
965 | 957 | | |
966 | 958 | | |
967 | 959 | | |
968 | | - | |
| 960 | + | |
| 961 | + | |
969 | 962 | | |
970 | 963 | | |
971 | 964 | | |
| |||
995 | 988 | | |
996 | 989 | | |
997 | 990 | | |
998 | | - | |
| 991 | + | |
| 992 | + | |
999 | 993 | | |
1000 | 994 | | |
1001 | 995 | | |
| |||
0 commit comments