git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Ronnie Sahlberg <sahlberg@google.com>, git@vger.kernel.org
Subject: Re: [PATCH] add a reflog_exists and delete_reflog abstraction
Date: Tue, 06 May 2014 17:23:10 +0200	[thread overview]
Message-ID: <5368FE5E.7020009@alum.mit.edu> (raw)
In-Reply-To: <1399330677-17930-1-git-send-email-sahlberg@google.com>

On 05/06/2014 12:57 AM, Ronnie Sahlberg wrote:
> This is a single patch that adds two new functions to try to hide the reflog
> implementation details from the callers in checkout.c and reflog.c.
> It adds new functions to test if a reflog exists and to delete it, thus
> allowing checkout.c to perform this if-test-then-delete operation without
> having to know the internal implementation of reflogs (i.e. that they are files
> that live unde r.git/logs)
> 
> It also changes checkout.c to use ref_exists when checking for whether a ref
> exists or not instead of checking if the loose ref file exists or not.
> Using ref_exists instead both hides the reflog implementation details from
> checkout.c as well as making the code more robust against future changes.
> It currently has a hard assumption that the loose ref file must exist at this
> stage or else it would end up deleting the reflog which is true today, as far
> as I can tell, but would break if git would change such that we could have
> a branch checked out without having a loose ref file for that branch.

For single patches, people usually don't send a separate cover letter.
Any comments that you want to make that are not suitable for the commit
message can go between the "---" line and the diffstat of the patch email.

Regarding this change, I think before too long we will also need an API
to turn reflogs on for a reference.  We might want to add a flag to ref
transaction entries that cause the reflog to be created if it doesn't
already exist.  Reflogs can currently be created for a reference via the
config setting "core.logAllRefUpdates" or (for branches) by "git branch
--create-reflog" (maybe there are others).

Several tests in the test suite currently create reflog files by hand.
Thus we might also need a way to create reflogs at the command line by
the time we implement pluggable reference backends.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/

  parent reply	other threads:[~2014-05-06 16:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-05 22:57 [PATCH] add a reflog_exists and delete_reflog abstraction Ronnie Sahlberg
2014-05-05 22:57 ` [PATCH] refs.c: add new functions reflog_exists and delete_reflog Ronnie Sahlberg
2014-05-06 15:55   ` Michael Haggerty
2014-05-06 18:21     ` Ronnie Sahlberg
2014-05-06 15:23 ` Michael Haggerty [this message]
2014-05-07 20:47   ` [PATCH] add a reflog_exists and delete_reflog abstraction Ronnie Sahlberg
2014-05-06 19:15 ` Junio C Hamano
2014-05-06 19:29   ` Ronnie Sahlberg

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=5368FE5E.7020009@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    --cc=sahlberg@google.com \
    /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 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 NNTP newsgroup(s).