git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* Two issues with mark_reachable_objects
@ 2021-04-27 10:45 David Emett
  2021-04-27 14:41 ` Jeff King
  2021-04-27 15:43 ` [PATCH] prune: save reachable-from-recent objects with bitmaps Jeff King
  0 siblings, 2 replies; 10+ messages in thread
From: David Emett @ 2021-04-27 10:45 UTC (permalink / raw)
  To: git

Hi all,

I ran into an issue yesterday with a script that effectively does this:

    set -e
    git fetch origin refs/blah/blah
    git checkout FETCH_HEAD

The checkout failed a few times with a "fatal: unable to read tree" error.

I noticed that this only happened when the fetch triggered an automatic GC at
the end. After a bit of digging I discovered two separate issues:

1) It seems that FETCH_HEAD is not considered a root by mark_reachable_objects.

2) If the bitmap_git branch in mark_reachable_objects is taken, the mark_recent
   argument is ignored. This doesn't _completely_ break "git prune"'s --expire
   option, as it turns out there is another explicit mtime check in
   prune_object (prune.c). If that check passes this is not propagated to
   referenced objects though. So even if a dangling commit is recent, a prune
   can discard old objects it references.

(1) has been discussed before on this mailing list [1], but it doesn't look
like there was a conclusion.

I assume (2) is not intentional, given that "git gc --help" explicitly says
"Any object with modification time newer than the --prune date is kept, along
with everything reachable from it." Is it safe to just run the mark_recent
block after the bitmap_git block? Could add_unseen_recent_objects_to_traversal
just be called at the start of the bitmap_git block if mark_recent?

[1] https://lore.kernel.org/git/20160708025948.GA3226@x/

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-04-29  1:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27 10:45 Two issues with mark_reachable_objects David Emett
2021-04-27 14:41 ` Jeff King
2021-04-27 15:13   ` Jeff King
2021-04-27 15:43 ` [PATCH] prune: save reachable-from-recent objects with bitmaps Jeff King
2021-04-28 12:20   ` David Emett
2021-04-28 15:13     ` Jeff King
2021-04-28 15:41       ` [PATCH v2 0/2] " Jeff King
2021-04-28 15:42         ` [PATCH v2 1/2] pack-bitmap: clean up include_check after use Jeff King
2021-04-28 15:42         ` [PATCH v2 2/2] prune: save reachable-from-recent objects with bitmaps Jeff King
2021-04-29  1:37           ` Junio C Hamano

Code repositories for project(s) associated with this 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).