Nguyễn Thái Ngọc Duy wrote:
> This may happen when `git gc --auto` is run automatically, then the
> user, to avoid wait time, switches to a new terminal, keeps working
> and `git gc --auto` is started again because the first gc instance has
> not clean up the repository.
>
> This patch tries to avoid multiple gc running, especially in --auto
> mode. In the worst case, gc may be delayed 12 hours if a daemon reuses
> the pid stored in gc-%s.pid.
Definitely looks like a good solution. Thanks for this.
I'm currently on vacation, so can't apply and test: sorry.
> + if (!force &&
> + (fp = fopen(git_path("gc-%s.pid", utsname.nodename), "r")) !=
> NULL &&
> + !fstat(fileno(fp), &st) &&
It's open for a very short period of time, so lockfile (which we'd
normally use) would probably be an overkill.
> + time(NULL) - st.st_mtime <= 12 * 3600) {
Quick question: is this kind of file-lifetime used anywhere else in git.git?
> + if (auto_gc)
> + return 0; /* be quiet on --auto */
> + die(_("gc is already running"));
Nice.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html