update.gc: check_and_set_needsgc before fetch
commit77d569e3d9d4be730c358929d46372bc58549883
authorKyle J. McKay <mackyle@gmail.com>
Thu, 8 Feb 2018 04:05:03 +0000 (7 20:05 -0800)
committerKyle J. McKay <mackyle@gmail.com>
Thu, 8 Feb 2018 04:05:03 +0000 (7 20:05 -0800)
treee9b5dc05557ac480f7150e503c146b86f6364891
parent54907ac1b769c24cce818d84cba66fd134b8197f
update.gc: check_and_set_needsgc before fetch

Since check_and_set_needsgc is all nice and neatly bundled up in a
function now, call it just before starting a mirror fetch in addition
to the call after a successful fetch.

This helps avoid excess pack buildup when the fetch itself succeeds
in fetching a pack but Git refuses to complete the update for some
reason (perhaps because a malicious Git-impersonation has attempted
to update a ref/heads/... ref to point at a non-commit object) thus
causing a "bang" exit.

Without this extra check, the excess pack cleanup would not take
place until the next regularly scheduled gc run which could potentially
be many days away.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
jobd/update.sh