git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Sixt <j6t@kdbg.org>,
	git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCH v2 00/16] Introduce a tempfile module
Date: Mon, 10 Aug 2015 11:47:35 +0200	[thread overview]
Message-ID: <cover.1439198011.git.mhagger@alum.mit.edu> (raw)

This is a re-roll of the tempfile patch series [1]. I'm sorry for the
long delay getting v2 out. Thanks to Junio and Johannes Sixt for their
feedback about v1. I think I have addressed all of their points.

This version is very similar to v1 in spirit, though quite a few
details have changed. The main difference is that I add some more
wrapper functions for both lockfile and tempfile (a) to add some
abstraction and (b) so that users of the former don't need to know
that it is based on the latter:

* Add new lockfile wrappers around the corresponding tempfile
  functions:

  * lockfile:
    * fdopen_lock_file()
    * close_lock_file()
    * reopen_lock_file()

* Add accessors:

  * lockfile:
    * get_lock_file_path()
    * get_lock_file_fd()
    * get_lock_file_fp()

  * tempfile:
    * is_tempfile_active()
    * get_tempfile_path()
    * get_tempfile_fd()
    * get_tempfile_fp()

Other changes in this version:

* Make some trivial wrapper functions inline.

* Change create_bundle() to dup() the file descriptor that it passes
  to write_pack_data() so that it doesn't have to tinker with
  lock->tempfile.fd to prevent the file from being closed twice.

* Move some docs about the implementation from tempfile.h to
  tempfile.c.

* Rename register_tempfile_object() to prepare_tempfile_object() to
  reduce confusion with register_tempfile(). Remove its "path"
  parameter and add a docstring.

* Simplify some `die("BUG:...")` error messages.

This series applies to the same commit as v1, namely
v2.4.3-368-g7974889. There is one small conflict when merging to
master or next or (pu minus gitster/mh/tempfile).

This patch series is also available from my GitHub fork [2] as branch
"tempfile".

[1] http://thread.gmane.org/gmane.comp.version-control.git/270998
[2] https://github.com/mhagger/git

Michael Haggerty (16):
  Move lockfile documentation to lockfile.h and lockfile.c
  create_bundle(): duplicate file descriptor to avoid closing it twice
  lockfile: add accessors get_lock_file_fd() and get_lock_file_fp()
  lockfile: add accessor get_lock_file_path()
  commit_lock_file(): use get_locked_file_path()
  tempfile: a new module for handling temporary files
  prepare_tempfile_object(): new function, extracted from
    create_tempfile()
  tempfile: add several functions for creating temporary files
  register_tempfile(): new function to handle an existing temporary file
  write_shared_index(): use tempfile module
  setup_temporary_shallow(): use tempfile module
  diff: use tempfile module
  lock_repo_for_gc(): compute the path to "gc.pid" only once
  gc: use tempfile module to handle gc.pid file
  credential-cache--daemon: delete socket from main()
  credential-cache--daemon: use tempfile module

 Documentation/technical/api-lockfile.txt | 220 --------------------
 Makefile                                 |   1 +
 builtin/commit.c                         |  15 +-
 builtin/gc.c                             |  32 +--
 bundle.c                                 |  26 ++-
 config.c                                 |  14 +-
 credential-cache--daemon.c               |  25 +--
 credential-store.c                       |   2 +-
 diff.c                                   |  29 +--
 lockfile.c                               | 205 +++----------------
 lockfile.h                               | 336 +++++++++++++++++++++++++------
 read-cache.c                             |  40 +---
 refs.c                                   |  18 +-
 shallow.c                                |  41 +---
 tempfile.c                               | 305 ++++++++++++++++++++++++++++
 tempfile.h                               | 271 +++++++++++++++++++++++++
 16 files changed, 951 insertions(+), 629 deletions(-)
 delete mode 100644 Documentation/technical/api-lockfile.txt
 create mode 100644 tempfile.c
 create mode 100644 tempfile.h

-- 
2.5.0

             reply	other threads:[~2015-08-10  9:48 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10  9:47 Michael Haggerty [this message]
2015-08-10  9:47 ` [PATCH v2 01/16] Move lockfile documentation to lockfile.h and lockfile.c Michael Haggerty
2015-08-11 19:27   ` Junio C Hamano
2015-08-10  9:47 ` [PATCH v2 02/16] create_bundle(): duplicate file descriptor to avoid closing it twice Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 03/16] lockfile: add accessors get_lock_file_fd() and get_lock_file_fp() Michael Haggerty
2015-08-11 19:29   ` Junio C Hamano
2015-08-10  9:47 ` [PATCH v2 04/16] lockfile: add accessor get_lock_file_path() Michael Haggerty
2015-08-11 19:36   ` Junio C Hamano
2015-08-10  9:47 ` [PATCH v2 05/16] commit_lock_file(): use get_locked_file_path() Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 06/16] tempfile: a new module for handling temporary files Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 07/16] prepare_tempfile_object(): new function, extracted from create_tempfile() Michael Haggerty
2015-08-11 19:38   ` Junio C Hamano
2015-08-10  9:47 ` [PATCH v2 08/16] tempfile: add several functions for creating temporary files Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 09/16] register_tempfile(): new function to handle an existing temporary file Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 10/16] write_shared_index(): use tempfile module Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 11/16] setup_temporary_shallow(): " Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 12/16] diff: " Michael Haggerty
2015-08-11 20:03   ` Junio C Hamano
2015-08-12 15:13     ` Michael Haggerty
2015-08-12 16:41       ` Junio C Hamano
2015-08-12 17:12         ` [PATCH v2' " Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 13/16] lock_repo_for_gc(): compute the path to "gc.pid" only once Michael Haggerty
2015-08-11 20:06   ` Junio C Hamano
2015-08-11 20:20     ` Junio C Hamano
2015-08-10  9:47 ` [PATCH v2 14/16] gc: use tempfile module to handle gc.pid file Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 15/16] credential-cache--daemon: delete socket from main() Michael Haggerty
2015-08-10  9:47 ` [PATCH v2 16/16] credential-cache--daemon: use tempfile module Michael Haggerty
2015-08-11 20:21 ` [PATCH v2 00/16] Introduce a " Junio C Hamano
2015-08-12 15:14   ` Michael Haggerty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1439198011.git.mhagger@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).