git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Ryan Anderson <ryan@michonline.com>
Cc: git@vger.kernel.org, Junio C Hamano <junkio@cox.net>
Subject: Re: [PATCH] Add git-relink-script to fix up missing hardlinks
Date: Sun, 26 Jun 2005 12:07:58 -0700	[thread overview]
Message-ID: <7v7jghq6lt.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20050626181516.GC20369@mythryan2.michonline.com> (Ryan Anderson's message of "Sun, 26 Jun 2005 14:15:16 -0400")

Not that I think it matters that much anymore since I am
proposing removal of "delta" support and Linus seems to be
inclined in the same direction, but I said "most of the time" in
the earlier message on this same topic for a reason:

    Message-ID: <7vy89h36da.fsf@assigned-by-dhcp.cox.net>
    Subject: Re: RFE: git relink
    Date: Fri, 10 Jun 2005 20:44:01 -0700
    References: <42A88C07.5050907@pobox.com>

    Whoever is doing this script needs to be a bit careful.

    ...

    Ryan Anderson code will notice delta vs full object case most of
    the time because it checks and makes sure the sizes of
    corresponding files from two repositories match.  The problem
    with the code is that it dies, instead of just ignoring, when
    size differs....

Your latest version has an option not to die which is very good
[*1*], but in a very narrow corner case, without comparing the
file contents, I think the code would still do a wrong thing.
Two trees can store the same object both in delitified form but
based on different base objects, and the deltified
representation still having the same length, no?  And I suspect
you would end up linking them together, corrupting one of the
trees.

Of course, even when you do not have "delta", if an object in
one tree is corrupted (but has the correct size), you would end
up relinking the corrupt one into another tree, nuking a good
copy, if you do not compare the file contents.

If/when/after the proposed removal of "delta" support happens, I
think the correct way to do git-relink-script would be to keep
most of your latest version intact, except:

 (1) make it always die when you see differences in size.
     Without "delta" in the repository, SHA1 files that
     represent the same object must have the same size.

 (2) make --safe also check on file contents.  You do not need
     the flag for the "delta" reason anymore, so I am suggesting
     reusing the flag to detect file corruption, to be extra
     safe, when the user permits you to spend cycles to be more
     careful.

[Footnote]

*1* and other parts of the script all look nicely done.

  parent reply	other threads:[~2005-06-26 19:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-26 18:15 [PATCH] Add git-relink-script to fix up missing hardlinks Ryan Anderson
2005-06-26 18:36 ` Jeff Garzik
2005-06-26 19:07 ` Junio C Hamano [this message]
2005-06-26 19:31   ` Junio C Hamano
2005-06-26 19:44     ` Jeff Garzik
2005-06-27  1:11       ` Jan Harkes

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=7v7jghq6lt.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=ryan@michonline.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.
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).