Skip to content
Commits on Aug 25, 2015
  1. @gitster

    Merge branch 'mh/tempfile'

    gitster committed
    The "lockfile" API has been rebuilt on top of a new "tempfile" API.
    
    * mh/tempfile:
      credential-cache--daemon: use tempfile module
      credential-cache--daemon: delete socket from main()
      gc: use tempfile module to handle gc.pid file
      lock_repo_for_gc(): compute the path to "gc.pid" only once
      diff: use tempfile module
      setup_temporary_shallow(): use tempfile module
      write_shared_index(): use tempfile module
      register_tempfile(): new function to handle an existing temporary file
      tempfile: add several functions for creating temporary files
      prepare_tempfile_object(): new function, extracted from create_tempfile()
      tempfile: a new module for handling temporary files
      commit_lock_file(): use get_locked_file_path()
      lockfile: add accessor get_lock_file_path()
      lockfile: add accessors get_lock_file_fd() and get_lock_file_fp()
      create_bundle(): duplicate file descriptor to avoid closing it twice
      lockfile: move documentation to lockfile.h and lockfile.c
Commits on Jun 24, 2015
  1. @gitster

    Merge branch 'js/sleep-without-select'

    gitster committed
    Portability fix.
    
    * js/sleep-without-select:
      lockfile: wait using sleep_millisec() instead of select()
      lockfile: convert retry timeout computations to millisecond
      help.c: wrap wait-only poll() invocation in sleep_millisec()
      lockfile: replace random() by rand()
Commits on May 22, 2015
  1. @gitster

    Merge branch 'jc/ignore-epipe-in-filter'

    gitster committed
    Filter scripts were run with SIGPIPE disabled on the Git side,
    expecting that they may not read what Git feeds them to filter.
    We however treated a filter that does not read its input fully
    before exiting as an error.
    
    This changes semantics, but arguably in a good way.  If a filter
    can produce its output without consuming its input using whatever
    magic, we now let it do so, instead of diagnosing it as a
    programming error.
    
    * jc/ignore-epipe-in-filter:
      filter_buffer_or_fd(): ignore EPIPE
      copy.c: make copy_fd() report its status silently
Commits on May 19, 2015
  1. @gitster

    copy.c: make copy_fd() report its status silently

    gitster committed
    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: Junio C Hamano <gitster@pobox.com>
Commits on Oct 14, 2014
  1. @gitster

    Merge branch 'mh/lockfile-stdio'

    gitster committed
    * mh/lockfile-stdio:
      commit_packed_refs(): reimplement using fdopen_lock_file()
      dump_marks(): reimplement using fdopen_lock_file()
      fdopen_lock_file(): access a lockfile using stdio
  2. @gitster

    Merge branch 'mh/lockfile'

    gitster committed
    The lockfile API and its users have been cleaned up.
    
    * mh/lockfile: (38 commits)
      lockfile.h: extract new header file for the functions in lockfile.c
      hold_locked_index(): move from lockfile.c to read-cache.c
      hold_lock_file_for_append(): restore errno before returning
      get_locked_file_path(): new function
      lockfile.c: rename static functions
      lockfile: rename LOCK_NODEREF to LOCK_NO_DEREF
      commit_lock_file_to(): refactor a helper out of commit_lock_file()
      trim_last_path_component(): replace last_path_elm()
      resolve_symlink(): take a strbuf parameter
      resolve_symlink(): use a strbuf for internal scratch space
      lockfile: change lock_file::filename into a strbuf
      commit_lock_file(): use a strbuf to manage temporary space
      try_merge_strategy(): use a statically-allocated lock_file object
      try_merge_strategy(): remove redundant lock_file allocation
      struct lock_file: declare some fields volatile
      lockfile: avoid transitory invalid states
      git_config_set_multivar_in_file(): avoid call to rollback_lock_file()
      dump_marks(): remove a redundant call to rollback_lock_file()
      api-lockfile: document edge cases
      commit_lock_file(): rollback lock file on failure to rename
      ...
Commits on Oct 8, 2014
  1. @gitster

    Merge branch 'sp/stream-clean-filter'

    gitster committed
    When running a required clean filter, we do not have to mmap the
    original before feeding the filter.  Instead, stream the file
    contents directly to the filter and process its output.
    
    * sp/stream-clean-filter:
      sha1_file: don't convert off_t to size_t too early to avoid potential die()
      convert: stream from fd to required clean filter to reduce used address space
      copy_fd(): do not close the input file descriptor
      mmap_limit: introduce GIT_MMAP_LIMIT to allow testing expected mmap size
      memory_limit: use git_env_ulong() to parse GIT_ALLOC_LIMIT
      config.c: add git_env_ulong() to parse environment variable
      convert: drop arguments other than 'path' from would_convert_to_git()
Commits on Sep 2, 2014
  1. @gitster

    Merge branch 'jc/reopen-lock-file'

    gitster committed
    There are cases where you lock and open to write a file, close it to
    show the updated contents to external processes, and then have to
    update the file again while still holding the lock, but the lockfile
    API lacked support for such an access pattern.
    
    * jc/reopen-lock-file:
      lockfile: allow reopening a closed but still locked file
Commits on Jul 21, 2014
  1. @gitster

    Merge branch 'rs/ref-transaction-0'

    gitster committed
    Early part of the "ref transaction" topic.
    
    * rs/ref-transaction-0:
      refs.c: change ref_transaction_update() to do error checking and return status
      refs.c: remove the onerr argument to ref_transaction_commit
      update-ref: use err argument to get error from ref_transaction_commit
      refs.c: make update_ref_write update a strbuf on failure
      refs.c: make ref_update_reject_duplicates take a strbuf argument for errors
      refs.c: log_ref_write should try to return meaningful errno
      refs.c: make resolve_ref_unsafe set errno to something meaningful on error
      refs.c: commit_packed_refs to return a meaningful errno on failure
      refs.c: make remove_empty_directories always set errno to something sane
      refs.c: verify_lock should set errno to something meaningful
      refs.c: make sure log_ref_setup returns a meaningful errno
      refs.c: add an err argument to repack_without_refs
      lockfile.c: make lock_file return a meaningful errno on failurei
      lockfile.c: add a new public function unable_to_lock_message
      refs.c: add a strbuf argument to ref_transaction_commit for error logging
      refs.c: allow passing NULL to ref_transaction_free
      refs.c: constify the sha arguments for ref_transaction_create|delete|update
      refs.c: ref_transaction_commit should not free the transaction
      refs.c: remove ref_transaction_rollback
Commits on Jul 14, 2014
  1. @gitster

    lockfile: allow reopening a closed but still locked file

    gitster committed
    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: Junio C Hamano <gitster@pobox.com>
Commits on May 18, 2009
  1. @gitster

    Merge branch 'ar/unlink-err'

    gitster committed
    * ar/unlink-err:
      print unlink(2) errno in copy_or_link_directory
      replace direct calls to unlink(2) with unlink_or_warn
      Introduce an unlink(2) wrapper which gives warning if unlink failed
Commits on Feb 20, 2009
  1. @gitster

    Merge branch 'maint'

    gitster committed
    * maint:
      More friendly message when locking the index fails.
      Document git blame --reverse.
      Documentation: Note file formats send-email accepts
Commits on Dec 21, 2008
  1. @gitster

    Make sure lockfiles are unlocked when dying on SIGPIPE

    gitster committed
    We cleaned up lockfiles upon receiving the usual suspects HUP, TERM, QUIT
    but a wicked user could kill us of asphyxiation by piping our output to a
    pipe that does not read.  Protect ourselves by catching SIGPIPE and clean
    up the lockfiles as well in such a case.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Oct 19, 2008
  1. @gitster

    Enhance hold_lock_file_for_{update,append}() API

    gitster committed
    This changes the "die_on_error" boolean parameter to a mere "flags", and
    changes the existing callers of hold_lock_file_for_update/append()
    functions to pass LOCK_DIE_ON_ERROR.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on May 25, 2008
  1. @gitster

    Merge branch 'db/clone-in-c'

    gitster committed
    * db/clone-in-c:
      Add test for cloning with "--reference" repo being a subset of source repo
      Add a test for another combination of --reference
      Test that --reference actually suppresses fetching referenced objects
      clone: fall back to copying if hardlinking fails
      builtin-clone.c: Need to closedir() in copy_or_link_directory()
      builtin-clone: fix initial checkout
      Build in clone
      Provide API access to init_db()
      Add a function to set a non-default work tree
      Allow for having for_each_ref() list extra refs
      Have a constant extern refspec for "--tags"
      Add a library function to add an alternate to the alternates file
      Add a lockfile function to append to a file
      Mark the list of refs to fetch as const
    
    Conflicts:
    
    	cache.h
    	t/t5700-clone-reference.sh
Commits on Jul 25, 2007
  1. @gitster

    When locking in a symlinked repository, try to lock the original.

    gitster committed
    In a working tree prepared in new-workdir (in contrib/), some files in .git/
    directory are symbolic links to the original repository.  The usual sequence of
    lock-write-rename would break the symbolic link.
    
    Ideally we should resolve relative symbolic link with maxdepth, but I do not
    want to risk too elaborate patch before 1.5.3 release, so this is a minimum
    and trivially obvious fix.  new-workdir creates its symbolic links absolute,
    and does not link from a symlinked workdir, so this fix should suffice for now.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Jun 7, 2007
  1. @gitster

    War on whitespace

    gitster committed
    This uses "git-apply --whitespace=strip" to fix whitespace errors that have
    crept in to our source files over time.  There are a few files that need
    to have trailing whitespaces (most notably, test vectors).  The results
    still passes the test, and build result in Documentation/ area is unchanged.
    
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Something went wrong with that request. Please try again.