Merge branch 'nd/gc-lock-against-each-other'
authorJunio C Hamano <gitster@pobox.com>
Wed, 4 Sep 2013 19:35:34 +0000 (12:35 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 4 Sep 2013 19:35:34 +0000 (12:35 -0700)
* nd/gc-lock-against-each-other:
gc: reject if another gc is running, unless --force is given

1  2 
Documentation/git-gc.txt
compat/mingw.c
diff --combined Documentation/git-gc.txt
index 2402ed68280ded314c340e394da64b3372038113,5d04ab033030931cfd57ac4a75a96615fc33ff98..e158a3b31fce6b7573a3f549a3d9e0ecbf1cdff2
@@@ -9,7 -9,7 +9,7 @@@ git-gc - Cleanup unnecessary files and 
  SYNOPSIS
  --------
  [verse]
- 'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune]
+ 'git gc' [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] [--force]
  
  DESCRIPTION
  -----------
@@@ -62,9 -62,8 +62,9 @@@ automatic consolidation of packs
  
  --prune=<date>::
        Prune loose objects older than date (default is 2 weeks ago,
 -      overridable by the config variable `gc.pruneExpire`).  This
 -      option is on by default.
 +      overridable by the config variable `gc.pruneExpire`).
 +      --prune=all prunes loose objects regardless of their age.
 +      --prune is on by default.
  
  --no-prune::
        Do not prune any loose objects.
  --quiet::
        Suppress all progress reports.
  
+ --force::
+       Force `git gc` to run even if there may be another `git gc`
+       instance running on this repository.
  Configuration
  -------------
  
diff --combined compat/mingw.c
index bb92c436f70790ba907991f3307aa0fe4afdf0f5,2951389c69bf7f69518781be8ff9615022acea32..22ee9ef1cfb388fdcb7a2686653a6b10359bca59
@@@ -841,8 -841,8 +841,8 @@@ struct pinfo_t 
        struct pinfo_t *next;
        pid_t pid;
        HANDLE proc;
 -} pinfo_t;
 -struct pinfo_t *pinfo = NULL;
 +};
 +static struct pinfo_t *pinfo = NULL;
  CRITICAL_SECTION pinfo_cs;
  
  static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **env,
@@@ -1086,6 -1086,12 +1086,12 @@@ int mingw_kill(pid_t pid, int sig
                errno = err_win_to_posix(GetLastError());
                CloseHandle(h);
                return -1;
+       } else if (pid > 0 && sig == 0) {
+               HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
+               if (h) {
+                       CloseHandle(h);
+                       return 0;
+               }
        }
  
        errno = EINVAL;
@@@ -1253,7 -1259,7 +1259,7 @@@ static int WSAAPI getaddrinfo_stub(cons
        else
                sin->sin_addr.s_addr = INADDR_LOOPBACK;
        ai->ai_addr = (struct sockaddr *)sin;
 -      ai->ai_next = 0;
 +      ai->ai_next = NULL;
        return 0;
  }
  
@@@ -1677,16 -1683,14 +1683,16 @@@ int sigaction(int sig, struct sigactio
  #undef signal
  sig_handler_t mingw_signal(int sig, sig_handler_t handler)
  {
 -      sig_handler_t old = timer_fn;
 +      sig_handler_t old;
  
        switch (sig) {
        case SIGALRM:
 +              old = timer_fn;
                timer_fn = handler;
                break;
  
        case SIGINT:
 +              old = sigint_fn;
                sigint_fn = handler;
                break;