From: Junio C Hamano <gitster@pobox.com>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH 07/14] register_tempfile(): new function to handle an existing temporary file
Date: Wed, 10 Jun 2015 10:55:43 -0700 [thread overview]
Message-ID: <xmqqioavla74.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <d0507ec9bdc63b9532bbb348e4505d311ef3c5dc.1433751986.git.mhagger@alum.mit.edu> (Michael Haggerty's message of "Mon, 8 Jun 2015 11:07:38 +0200")
Michael Haggerty <mhagger@alum.mit.edu> writes:
> Allow an existing file to be registered with the tempfile-handling
> infrastructure; in particular, arrange for it to be deleted on program
> exit.
>
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---
Hmph. Where does such a tempfile that is not on list come from?
Puzzled, but let's read on---this could for example become an
internal implementation detail for create_tempfile(). Also I cannot
tell which one of register_tempfile() and register_tempfile_object()
I should be calling when updating the implementation of this API
from their names.
> diff --git a/tempfile.c b/tempfile.c
> index 890075f..235fc85 100644
> --- a/tempfile.c
> +++ b/tempfile.c
> @@ -82,6 +82,15 @@ int create_tempfile(struct tempfile *tempfile, const char *path)
> return tempfile->fd;
> }
>
> +void register_tempfile(struct tempfile *tempfile, const char *path)
> +{
> + register_tempfile_object(tempfile, path);
> +
> + strbuf_add_absolute_path(&tempfile->filename, path);
> + tempfile->owner = getpid();
> + tempfile->active = 1;
> +}
> +
> int mks_tempfile_sm(struct tempfile *tempfile,
> const char *template, int suffixlen, int mode)
> {
> diff --git a/tempfile.h b/tempfile.h
> index 6276156..18ff963 100644
> --- a/tempfile.h
> +++ b/tempfile.h
> @@ -145,6 +145,14 @@ struct tempfile {
> */
> extern int create_tempfile(struct tempfile *tempfile, const char *path);
>
> +/*
> + * Register an existing file as a tempfile, meaning that it will be
> + * deleted when the program exits. The tempfile is considered closed,
> + * but it can be worked with like any other closed tempfile (for
> + * example, it can be opened using reopen_tempfile()).
> + */
> +extern void register_tempfile(struct tempfile *tempfile, const char *path);
> +
>
> /*
> * mks_tempfile functions
next prev parent reply other threads:[~2015-06-10 17:55 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-08 9:07 [PATCH 00/14] Introduce a tempfile module Michael Haggerty
2015-06-08 9:07 ` [PATCH 01/14] Move lockfile API documentation to lockfile.h Michael Haggerty
2015-06-08 9:07 ` [PATCH 02/14] tempfile: a new module for handling temporary files Michael Haggerty
2015-06-10 17:36 ` Junio C Hamano
2015-06-10 20:56 ` Michael Haggerty
2015-06-10 21:35 ` Junio C Hamano
2015-06-08 9:07 ` [PATCH 03/14] lockfile: remove some redundant functions Michael Haggerty
2015-06-10 17:40 ` Junio C Hamano
2015-06-10 18:27 ` Johannes Sixt
2015-06-08 9:07 ` [PATCH 04/14] commit_lock_file(): use get_locked_file_path() Michael Haggerty
2015-06-08 9:07 ` [PATCH 05/14] register_tempfile_object(): new function, extracted from create_tempfile() Michael Haggerty
2015-06-08 9:07 ` [PATCH 06/14] tempfile: add several functions for creating temporary files Michael Haggerty
2015-06-10 17:48 ` Junio C Hamano
2015-08-10 3:08 ` Michael Haggerty
2015-06-08 9:07 ` [PATCH 07/14] register_tempfile(): new function to handle an existing temporary file Michael Haggerty
2015-06-10 17:55 ` Junio C Hamano [this message]
2015-08-10 3:40 ` Michael Haggerty
2015-06-08 9:07 ` [PATCH 08/14] write_shared_index(): use tempfile module Michael Haggerty
2015-06-10 17:56 ` Junio C Hamano
2015-06-08 9:07 ` [PATCH 09/14] setup_temporary_shallow(): " Michael Haggerty
2015-06-08 9:07 ` [PATCH 10/14] diff: " Michael Haggerty
2015-06-08 9:07 ` [PATCH 11/14] lock_repo_for_gc(): compute the path to "gc.pid" only once Michael Haggerty
2015-06-08 9:07 ` [PATCH 12/14] gc: use tempfile module to handle gc.pid file Michael Haggerty
2015-06-08 9:07 ` [PATCH 13/14] credential-cache--daemon: delete socket from main() Michael Haggerty
2015-06-08 9:07 ` [PATCH 14/14] credential-cache--daemon: use tempfile module Michael Haggerty
2015-06-10 18:34 ` [PATCH 00/14] Introduce a " Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqioavla74.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
--cc=peff@peff.net \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.