Re: [PATCH v3] gc: reject if another gc is running, unless --force is given

2013-08-06 Thread Junio C Hamano
Ramkumar Ramachandra artag...@gmail.com writes: Junio C Hamano wrote: [...] The other comments mostly make sense. After reading what the whole function does, I think the purpose of this function is to take gc-lock (with optionally force). Perhaps a name along the lines of lock_gc,

Re: [PATCH v3] gc: reject if another gc is running, unless --force is given

2013-08-06 Thread Ramkumar Ramachandra
Junio C Hamano wrote: After reading what the whole function does, I think the purpose of this function is to take gc-lock (with optionally force). Perhaps a name along the lines of lock_gc, gc_lock, lock_repo_for_gc, would be more appropriate. The whole point of this exercise is to _not_

[PATCH v3] gc: reject if another gc is running, unless --force is given

2013-08-05 Thread Nguyễn Thái Ngọc Duy
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

Re: [PATCH v3] gc: reject if another gc is running, unless --force is given

2013-08-05 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy pclo...@gmail.com writes: diff --git a/builtin/gc.c b/builtin/gc.c index 6be6c8d..1f33908 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -167,11 +167,66 @@ static int need_to_gc(void) return 1; } +static int gc_running(int force) Sounds like a bool asking

Re: [PATCH v3] gc: reject if another gc is running, unless --force is given

2013-08-05 Thread Ramkumar Ramachandra
Junio C Hamano wrote: [...] The other comments mostly make sense. After reading what the whole function does, I think the purpose of this function is to take gc-lock (with optionally force). Perhaps a name along the lines of lock_gc, gc_lock, lock_repo_for_gc, would be more appropriate.