1. 06 6月, 2015 3 次提交
  2. 20 5月, 2015 1 次提交
    • J
      copy.c: make copy_fd() report its status silently · 00b7cbfc
      Junio C Hamano 提交于
      When copy_fd() function encounters errors, it emits error messages
      itself, which makes it impossible for callers to take responsibility
      for reporting errors, especially when they want to ignore certain
      errors.
      
      Move the error reporting to its callers in preparation.
      
       - copy_file() and copy_file_with_time() by indirection get their
         own calls to error().
      
       - hold_lock_file_for_append(), when told to die on error, used to
         exit(128) relying on the error message from copy_fd(), but now it
         does its own die() instead.  Note that the callers that do not
         pass LOCK_DIE_ON_ERROR need to be adjusted for this change, but
         fortunately there is none ;-)
      
       - filter_buffer_or_fd() has its own error() already, in addition to
         the message from copy_fd(), so this will change the output but
         arguably in a better way.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      00b7cbfc
  3. 15 5月, 2015 1 次提交
    • M
      lockfile: allow file locking to be retried with a timeout · 044b6a9e
      Michael Haggerty 提交于
      Currently, there is only one attempt to lock a file. If it fails, the
      whole operation fails.
      
      But it might sometimes be advantageous to try acquiring a file lock a
      few times before giving up. So add a new function,
      hold_lock_file_for_update_timeout(), that allows a timeout to be
      specified. Make hold_lock_file_for_update() a thin wrapper around the
      new function.
      
      If timeout_ms is positive, then retry for at least that many
      milliseconds to acquire the lock. On each failed attempt, use select()
      to wait for a backoff time that increases quadratically (capped at 1
      second) and has a random component to prevent two processes from
      getting synchronized. If timeout_ms is negative, retry indefinitely.
      
      In a moment we will switch to using the new function when locking
      packed-refs.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      044b6a9e
  4. 04 11月, 2014 1 次提交
  5. 16 10月, 2014 1 次提交
  6. 02 10月, 2014 31 次提交
  7. 29 8月, 2014 1 次提交
  8. 15 7月, 2014 1 次提交
    • J
      lockfile: allow reopening a closed but still locked file · 93dcaea2
      Junio C Hamano 提交于
      In some code paths (e.g. giving "add -i" to prepare the contents to
      be committed interactively inside "commit -p") where a caller takes
      a lock, writes the new content, give chance for others to use it
      while still holding the lock, and then releases the lock when all is
      done.  As an extension, allow the caller to re-update an already
      closed file while still holding the lock (i.e. not yet committed) by
      re-opening the file, to be followed by updating the contents and
      then by the usual close_lock_file() or commit_lock_file().
      
      This is necessary if we want to add code to rebuild the cache-tree
      and write the resulting index out after "add -i" returns the control
      to "commit -p", for example.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      93dcaea2