git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Jeff King <peff@peff.net>, Stefan Beller <sbeller@google.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Ronnie Sahlberg" <ronniesahlberg@gmail.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	"git@vger.kernel.org" <git@vger.kernel.org>,
	"Shawn Pearce" <spearce@spearce.org>
Subject: Re: [PATCH 3/8] lock_ref_sha1_basic(): do not set force_write for missing references
Date: Thu, 12 Feb 2015 13:09:59 +0100	[thread overview]
Message-ID: <54DC9817.7050309@alum.mit.edu> (raw)
In-Reply-To: <20150211000520.GA30561@peff.net>

On 02/11/2015 01:05 AM, Jeff King wrote:
> On Tue, Feb 10, 2015 at 03:24:47PM -0800, Stefan Beller wrote:
> 
>> On Mon, Feb 9, 2015 at 1:12 AM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
>>> If a reference is missing, its SHA-1 will be null_sha1, which can't
>>> possibly match a new value that ref_transaction_commit() is trying to
>>> update it to. So there is no need to set force_write in this scenario.
>>>
>>
>> This commit reverts half the lines of 5bdd8d4a3062a (2008-11, do not
>> force write of packed refs). And reading both commit messages, they
>> seem to contradict each other. (Both agree on  "If a reference is
>> missing, its SHA-1 will be null_sha1 as provided by resolve_ref", but
>> the conclusion seems to be different.)
> 
> Most of the lines of 5bdd8d4a3062a that are being reverted here are
> caching the is_null_sha1() check in the "missing" variable. And that's
> a cleanup in this patch that is not strictly necessary ("missing" would
> only be used once, so it becomes noise).
> 
> The interesting thing in the earlier commit was to use the null sha1 to
> cause a force-write, rather than lstat()ing the filesystem. And here we
> are saying the force-write is not necessary at all, no matter what
> storage scheme is used. So I don't think there is any contradiction
> between the two.
> 
> Is this patch correct that the force-write is not necessary? I think so.
> The force-write flag comes from:
> 
> commit 732232a123e1e61e38babb1c572722bb8a189ba3
> Author: Shawn Pearce <spearce@spearce.org>
> Date:   Fri May 19 03:29:05 2006 -0400
> 
>     Force writing ref if it doesn't exist.
>     
>     Normally we try to skip writing a ref if its value hasn't changed
>     but in the special case that the ref doesn't exist but the new
>     value is going to be 0{40} then force writing the ref anyway.
> 
> but I am not sure that logic still holds (if it ever did). We do not ever write
> 0{40} into a ref value.

I don't understand that old commit, either. Maybe there was an idea of
storing 0{40} in a loose ref file to mark a packed reference as deleted?
CC to Shawn Pearce in case he can shed some light on the situation.

I still think that my change is OK, because we definitely don't want to
write 0{40} to any loose reference file. The reference-reading code
can't deal with it, so this would break the repository.

Michael

-- 
Michael Haggerty
mhagger@alum.mit.edu

  parent reply	other threads:[~2015-02-12 12:10 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09  9:12 [PATCH 0/8] Fix some problems with reflog expiration Michael Haggerty
2015-02-09  9:12 ` [PATCH 1/8] write_ref_sha1(): remove check for lock == NULL Michael Haggerty
2015-02-10 22:52   ` Stefan Beller
2015-02-11  0:06     ` Jeff King
2015-02-09  9:12 ` [PATCH 2/8] write_ref_sha1(): Move write elision test to callers Michael Haggerty
2015-02-12 19:58   ` Junio C Hamano
2015-02-09  9:12 ` [PATCH 3/8] lock_ref_sha1_basic(): do not set force_write for missing references Michael Haggerty
2015-02-10 23:24   ` Stefan Beller
2015-02-11  0:05     ` Jeff King
2015-02-11  0:07       ` Stefan Beller
2015-02-12 12:09       ` Michael Haggerty [this message]
2015-02-09  9:12 ` [PATCH 4/8] reflog: fix documentation Michael Haggerty
2015-02-10 23:25   ` Stefan Beller
2015-02-09  9:12 ` [PATCH 5/8] reflog: rearrange the manpage Michael Haggerty
2015-02-10 23:42   ` Stefan Beller
2015-02-12 15:17     ` Michael Haggerty
2015-02-12 20:09       ` Junio C Hamano
2015-02-09  9:12 ` [PATCH 6/8] reflog_expire(): ignore --updateref for symbolic references Michael Haggerty
2015-02-11  0:44   ` Stefan Beller
2015-02-12 16:08     ` Michael Haggerty
2015-02-12 17:04       ` Stefan Beller
2015-02-12 20:16       ` Junio C Hamano
2015-02-12 21:54   ` Jeff King
2015-02-13 14:34     ` Michael Haggerty
2015-02-09  9:12 ` [PATCH 7/8] reflog_expire(): never update a reference to null_sha1 Michael Haggerty
2015-02-09 20:55   ` Eric Sunshine
2015-02-12 11:51     ` Michael Haggerty
2015-02-09  9:12 ` [PATCH 8/8] reflog_expire(): lock symbolic refs themselves, not their referent Michael Haggerty
2015-02-11  0:49   ` Stefan Beller
2015-02-11 22:49     ` Junio C Hamano
2015-02-11 23:25       ` Stefan Beller
2015-02-12 16:52         ` Michael Haggerty
2015-02-12 18:04           ` Stefan Beller
2015-02-13 16:26             ` Michael Haggerty
2015-02-13 17:16               ` Stefan Beller
2015-02-13 18:05               ` Junio C Hamano
2015-02-13 18:21                 ` Stefan Beller
2015-02-13 18:26                   ` Junio C Hamano
2015-02-13 18:32                     ` Stefan Beller
2015-02-13 19:12                       ` Junio C Hamano
2015-02-13 20:11                         ` Michael Haggerty
2015-02-13 21:53                           ` Junio C Hamano
2015-02-14  5:58                             ` Michael Haggerty
2015-02-09 18:57 ` [PATCH 0/8] Fix some problems with reflog expiration Stefan Beller
2015-02-10 23:12 ` [PATCH] refs.c: get rid of force_write flag Stefan Beller
2015-02-12 15:35   ` 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

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

  git send-email \
    --in-reply-to=54DC9817.7050309@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=ronniesahlberg@gmail.com \
    --cc=sbeller@google.com \
    --cc=spearce@spearce.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.
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).