I would like to use the git pre-auto-gc hook but it doesn’t seem to be invoked at all.
The file is executable and I tested it with git 1.7.1 and 1.5.6.5, neither of these seems to work as expected (they’re not invoking the script when git gc --auto is run).
Does anyone of you know something about it? Maybe I need to setup someting in the configuration to make git aware of this hook?
I tried to google a bit but I didn’t find anything…
Thanks :-).
Okay I may have an answer.
In the git source of gc.c, I see that the hook is run in the
need_to_gcfunction which have two ways to squeeze it…IMO the first short-circuit (if
gc.autois set to 0) is okay. But the second one should not prevent the hooks to be run, maybe it should pass it a boolean argument saying if yes or no the gc is needed. Because as it is now it’s kind of frustrating that the hook isn’t run when you would want it to.And BTW I discovered the git source code, it’s really a pleasure to read code that much clean!
EDIT: I tested the hook again on some old and rather big repos and the gc has never been called when the
--autooption was supplied. The defaultauto_thresholdvalue (which is apparently 27) might be a bit too high, or maybe the gc is needed only in extreme situation.Anyway, it annoys me that this hook is not invoked, so much for that.