git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Paul Smith <paul@mad-scientist.net>
To: git@vger.kernel.org
Subject: Re: Fetching everything in another bare repo
Date: Thu, 09 Mar 2023 08:55:27 -0500	[thread overview]
Message-ID: <64282d0f99df59085a18585846d2086a652677e2.camel@mad-scientist.net> (raw)
In-Reply-To: <ZAl/lQMhaQ54BDXN@coredump.intra.peff.net>

On Thu, 2023-03-09 at 01:41 -0500, Jeff King wrote:
> On Wed, Mar 08, 2023 at 05:39:07PM -0500, Paul Smith wrote:
> 
> > I have a tool that wants to preserve every commit and never garbage
> > collect (there are references that need to be maintained to older
> > commits/branches that have been deleted).  This tool keeps its own
> > bare clone, and disables all GC and maintenance on it.
> 
> OK. It's not clear to me if this archive repo retains the old
> references, or if it simply has a bunch of unreachable objects.
> That distinction will matter below.

Sorry; I've been using Git for a long time but am still not totally
immersed in the terminology :).

Basically, these bare clones have "gc.pruneExpire=never" set, and have
never had any GC operations run so all commits are still present (when
you say "unreachable" I assume you mean, not reachable through any
reference).

There is a separate database of information containing SHAs for these
commits, that is used to find them, but there is nothing in Git itself
that references them so they are indeed unreachable as far as Git is
concerned.

> I think you probably want to treat the objects and references
> separately. It's safe to just copy all of the objects and packfiles
> from the old clone into the new one. You'll have duplicates, but you
> should be able to de-dup and get a single packfile with:
> 
>   git repack -ad --keep-unreachable

Oh interesting.  I did a quick verification and all of the objects /
packfiles in the old clone either don't exist in the new one, or are
identical.  I'm sure you expected that but I needed to reassure myself
I wouldn't be overwriting anything :).

One question: is the objects/info/packs file anything to be concerned
about or will git repack (or something) take care of handling it?

> And then you can do any ref updates in the new repository (since it
> now has all objects from both).

It's actually possible that I don't care about refs at all.  I might
only care about objects.  I'm not sure, I can check what exists in the
old clone.

But if I need them I can deal with them as you suggest (or something
similar).

Thanks Jeff!

  reply	other threads:[~2023-03-09 13:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 22:39 Fetching everything in another bare repo Paul Smith
2023-03-09  6:41 ` Jeff King
2023-03-09 13:55   ` Paul Smith [this message]
2023-03-09 15:35     ` Jeff King
2023-03-09 17:57       ` Konstantin Ryabitsev
2023-03-10  9:04         ` Jeff King
2023-03-09 18:15       ` Paul Smith

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=64282d0f99df59085a18585846d2086a652677e2.camel@mad-scientist.net \
    --to=paul@mad-scientist.net \
    --cc=git@vger.kernel.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).