Sorry for the long delay since v3. This version mostly cleans up a couple more places where the lockfile object was left in an ill-defined state. Thanks to Johannes Sixt and Torsten Bögershausen for their review of v3. I believe that this series addresses all of the comments from v1 [1], v2 [2], and v3 [3]. This series applies to the current "master". There is a trivial conflict between these changes and "next", and a few not-too-serious conflicts between these changes and Ronnie's reference-related series in "pu". I've figured out how to resolve the conflicts locally. Is there some form in which I can put the conflict resolution that would help you? Changes since v3: * Rebase to the current master, including adjusting the patch series for 93dcaea2 (addition of reopen_lock_file()). * Perform the internal consistency check right away in commit_lock_file(), rather than after possibly having closed the file. * Improve the explanation of the rationale for marking lock_file fields volatile. * Fix comments that still referred to lock_file::filename[0] even though it is now a strbuf. * Change rollback_lock_file() to exit early if the lock is not active (rather than nesting the rest of the function in an "if" statement). * Fix Johannes's email address in the trailers. * Extract a function commit_lock_file_to(lk, filename) and delegate to it from commit_lock_file() and commit_locked_index() so that the latter gets the benefit of the improvements in this patch series. [1] http://thread.gmane.org/gmane.comp.version-control.git/245609 [2] http://thread.gmane.org/gmane.comp.version-control.git/245801 [3] http://thread.gmane.org/gmane.comp.version-control.git/246222 Michael Haggerty (32): unable_to_lock_die(): rename function from unable_to_lock_index_die() api-lockfile: expand the documentation rollback_lock_file(): do not clear filename redundantly rollback_lock_file(): exit early if lock is not active rollback_lock_file(): set fd to -1 lockfile: unlock file if lockfile permissions cannot be adjusted hold_lock_file_for_append(): release lock on errors lock_file(): always add lock_file object to lock_file_list lockfile.c: document the various states of lock_file objects cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN delete_ref_loose(): don't muck around in the lock_file's filename prepare_index(): declare return value to be (const char *) write_packed_entry_fn(): convert cb_data into a (const int *) lock_file(): exit early if lockfile cannot be opened remove_lock_file(): call rollback_lock_file() commit_lock_file(): inline temporary variable commit_lock_file(): die() if called for unlocked lockfile object commit_lock_file(): if close fails, roll back commit_lock_file(): rollback lock file on failure to rename api-lockfile: document edge cases dump_marks(): remove a redundant call to rollback_lock_file() git_config_set_multivar_in_file(): avoid call to rollback_lock_file() lockfile: avoid transitory invalid states struct lock_file: declare some fields volatile try_merge_strategy(): remove redundant lock_file allocation try_merge_strategy(): use a statically-allocated lock_file object commit_lock_file(): use a strbuf to manage temporary space Change lock_file::filename into a strbuf resolve_symlink(): use a strbuf for internal scratch space resolve_symlink(): take a strbuf parameter trim_last_path_elm(): replace last_path_elm() Extract a function commit_lock_file_to() Documentation/technical/api-lockfile.txt | 67 +++++-- builtin/commit.c | 16 +- builtin/merge.c | 15 +- builtin/reflog.c | 2 +- builtin/update-index.c | 2 +- cache.h | 16 +- config.c | 28 +-- fast-import.c | 4 +- lockfile.c | 299 ++++++++++++++++++------------- read-cache.c | 12 +- refs.c | 29 +-- shallow.c | 6 +- 12 files changed, 296 insertions(+), 200 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html