git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: drafnel@gmail.com
Cc: git@vger.kernel.org, spearce@spearce.org, nico@cam.org, ae@op5.se
Subject: Re: recognize loose local objects during repack
Date: Mon, 10 Nov 2008 13:03:10 -0800	[thread overview]
Message-ID: <7vtzaf47ld.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 2390436.1226296705080.JavaMail.teamon@b307.teamon.com

drafnel@gmail.com writes:

> This was developed on top of the previous repack/pack-objects series.

Thanks.  Looked alright from a cursory reading.

By the way, I've been meaning to suggest that we should straighten out the
semantics of "unpacked" vs "incremental".

What the latter means is quite clear.  We are creating a new packfile to
bundle loose ones into one, and after the new packfile is installed we can
remove the loose objects.

But what --unpacked means often confuses people, primarily because it is a
performance heuristics that makes certain assumptions on how the objects
are packed.

Namely, "unpacked" is about discovery process of objects to be packed.
Without the option, we enumerate all objects that are reachable from the
commits in the given range, excluding the trees and blobs that should
exist in commits that are excluded (e.g, if you say "--objects A..B", we
exclude trees and blobs referenced by commit A).

With the option, we also omit commits that are packed.  What's funny is
that their trees and blobs are omitted, even if they are loose ;-)

This is typically not an issue, because you do not say "pack only this
commit object, without its trees or blobs" when repacking, and because you
must have all the trees and blobs necessary for a commit available when
you pack a commit; for these reasons, the trees and blobs are typically
packed together with the commit.  It is not an issue that the rev-list
with --unpacked option does not list loose trees and blobs that belong to
a packed commit for this reason.

You could however arrange so that a commit itself is packed but some of
the tree and blob objects it refers to are loose, in which case these
loose objects may not ever get repacked incrementally.

In an empty directory, try this:

        git init &&
        echo 0 >file && git add file && git commit -m initial &&

        P=$(git rev-list HEAD | git pack-objects pack) &&
        mv pack-$P.* .git/objects/pack/ &&
        git prune && git count-objects -v

        git repack && git count-objects -v

It packs only the commit object (and prunes it), leaving a tree and a blob
loose.  The repack won't find anything to pack.

This is not so bad in the sense that it will never corrupt your
repository, but it is confusing.  Admittedly, not peeking into a commit
that is packed is a reasonable good heuristics for performance reasons.

Interestingly enough, the object listing machinery do traverse into
parents of packed commits when --unpacked is given.  So if you pack a
commit and arrange to keep its parents unpacked, they are subject to the
incremental repacking.  In other words, the performance heuristics may not
be buying us very much --- we are traversing the history down to the root
commits regardless.

  reply	other threads:[~2008-11-10 21:05 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-31 19:32 getting list of objects for packing Brandon Casey
2008-10-31 20:40 ` Nicolas Pitre
2008-10-31 20:48   ` Brandon Casey
2008-10-31 21:30     ` Junio C Hamano
2008-10-31 21:40       ` Brandon Casey
2008-10-31 22:23         ` Jakub Narebski
2008-11-01  0:00         ` Brandon Casey
2008-11-02  3:35           ` [PATCH] t7700: demonstrate mishandling of objects in packs with a .keep file drafnel
2008-11-02 16:31             ` [PATCH 1/3] packed_git: convert pack_local flag into generic bit mask drafnel
2008-11-03 16:12               ` Shawn O. Pearce
2008-11-03 18:24                 ` Brandon Casey
2008-11-03 20:37                 ` [PATCH v2 1/3] t7700: demonstrate mishandling of objects in packs with a .keep file Brandon Casey
2008-11-03 20:41                   ` [PATCH v2 2/3] packed_git: convert pack_local flag into a bitfield and add pack_keep Brandon Casey
2008-11-03 20:43                     ` [PATCH v2 3/3] pack-objects: honor '.keep' files Brandon Casey
2008-11-03 20:49                       ` Shawn O. Pearce
2008-11-05 22:37                       ` Brandon Casey
2008-11-06 23:22                         ` Brandon Casey
2008-11-07  0:30                           ` Junio C Hamano
2008-11-07  1:17                             ` Brandon Casey
2008-11-07  8:12                               ` Andreas Ericsson
2008-11-07 19:25                                 ` Shawn O. Pearce
2008-11-10  5:59                             ` recognize loose local objects during repack drafnel
2008-11-10 21:03                               ` Junio C Hamano [this message]
     [not found]                             ` <1226296798-31522-1-git-send-email-foo@foo.com>
2008-11-10  5:59                               ` [PATCH 1/3] t7700: demonstrate mishandling of loose objects in an alternate ODB drafnel
     [not found]                               ` <1226296798-31522-2-git-send-email-foo@foo.com>
2008-11-10  5:59                                 ` [PATCH 2/3] sha1_file.c: split has_loose_object() into local and non-local counterparts drafnel
     [not found]                                 ` <1226296798-31522-3-git-send-email-foo@foo.com>
2008-11-10  5:59                                   ` [PATCH 3/3] pack-objects: extend --local to mean ignore non-local loose objects too drafnel
2008-11-07  1:52                           ` [PATCH 1/4] pack-objects: new option --honor-pack-keep Brandon Casey
2008-11-07  1:54                             ` [PATCH 2/4] repack: don't repack local objects in packs with .keep file Brandon Casey
2008-11-07  1:55                               ` [PATCH 3/4] repack: do not fall back to incremental repacking with [-a|-A] Brandon Casey
2008-11-07  1:56                                 ` [PATCH 4/4] builtin-gc.c: use new pack_keep bitfield to detect .keep file existence Brandon Casey
2008-11-07  8:14                               ` [PATCH 2/4] repack: don't repack local objects in packs with .keep file Andreas Ericsson
2008-11-07  8:13                             ` [PATCH 1/4] pack-objects: new option --honor-pack-keep Andreas Ericsson
2008-11-03 22:14                   ` [PATCH v3] t7700: demonstrate mishandling of objects in packs with a .keep file Brandon Casey
2008-11-04 19:17                   ` [PATCH v2 1/3] " Andreas Ericsson
2008-11-04 19:49                     ` Brandon Casey
2008-11-04 19:55                       ` Junio C Hamano
2008-11-04 20:01                         ` Brandon Casey
2008-11-04 20:21                       ` Andreas Ericsson
2008-11-04 23:55                   ` Junio C Hamano
2008-11-12  8:09                   ` Jeff King
2008-11-12 17:10                     ` Junio C Hamano
2008-11-12 19:17                       ` Jeff King
2008-11-12 17:30                     ` Brandon Casey
2008-11-12 17:59                       ` repack and .keep series Brandon Casey
2008-11-12 17:59                         ` [PATCH 1/6] t7700: demonstrate mishandling of objects in packs with a .keep file Brandon Casey
2008-11-12 17:59                           ` [PATCH 2/6] packed_git: convert pack_local flag into a bitfield and add pack_keep Brandon Casey
2008-11-12 17:59                             ` [PATCH 3/6] pack-objects: new option --honor-pack-keep Brandon Casey
2008-11-12 17:59                               ` [PATCH 4/6] repack: don't repack local objects in packs with .keep file Brandon Casey
2008-11-12 17:59                                 ` [PATCH 5/6] repack: do not fall back to incremental repacking with [-a|-A] Brandon Casey
2008-11-12 17:59                                   ` [PATCH 6/6] builtin-gc.c: use new pack_keep bitfield to detect .keep file existence Brandon Casey
2008-11-13  0:50                                   ` [PATCH] t7700: test that 'repack -a' packs alternate packed objects Brandon Casey
2008-11-12 18:10                       ` [PATCH v2 1/3] t7700: demonstrate mishandling of objects in packs with a .keep file Junio C Hamano
2008-11-12 18:19                         ` Junio C Hamano
     [not found]             ` <1225643477-32319-1-git-send-email-foo@foo.com>
2008-11-02 16:31               ` [PATCH 2/3] packed_git: add new PACK_KEEP flag and haspackkeep() access macro drafnel
     [not found]               ` <1225643477-32319-2-git-send-email-foo@foo.com>
2008-11-02 16:31                 ` [PATCH 3/3] pack-objects: honor '.keep' files drafnel
2008-11-03 16:17                   ` Shawn O. Pearce
2008-11-03 10:35             ` [PATCH] t7700: demonstrate mishandling of objects in packs with a .keep file Andreas Ericsson
2008-11-03 18:20               ` Brandon Casey
2008-11-03 20:25                 ` Andreas Ericsson
2008-11-03 22:02                   ` Brandon Casey
2008-11-04 19:25                     ` Andreas Ericsson

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=7vtzaf47ld.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=ae@op5.se \
    --cc=drafnel@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=nico@cam.org \
    --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).