From: Jeff King <peff@peff.net>
To: Nicolas Pitre <nico@fluxnic.net>
Cc: Ted Ts'o <tytso@mit.edu>, Thomas Rast <trast@student.ethz.ch>,
Hallvard B Furuseth <h.b.furuseth@usit.uio.no>,
git@vger.kernel.org
Subject: Re: Keeping unreachable objects in a separate pack instead of loose?
Date: Mon, 11 Jun 2012 13:46:28 -0400 [thread overview]
Message-ID: <20120611174628.GA20134@sigill.intra.peff.net> (raw)
In-Reply-To: <alpine.LFD.2.02.1206111249270.23555@xanadu.home>
On Mon, Jun 11, 2012 at 01:04:07PM -0400, Nicolas Pitre wrote:
> IIRC, the 2 weeks number was instored when there wasn't any reflog on
> HEAD and the only way to salvage lost commits was to use 'git fsck
> --lost-found'. These days, this is used only as a safety measure
> because there is always a tiny window during which objects are dangling
> before they're finally all referenced as you say. But someone would
> have to work hard to hit that race even if the delay was only 30
> seconds. So realistically this could even be set to 1 hour.
Nope, the HEAD reflog dates back to bd104db (enable separate reflog for
HEAD, 2007-01-26), whereas the discussion leading to gc.pruneExpire was
in 2008. See this sub-thread for the discussion on the time limit:
http://thread.gmane.org/gmane.comp.version-control.git/76899/focus=76943
The interesting points from that thread are:
1. You might care about object prune times if your session is
interrupted. So imagine you are working on something, do not
commit, go home for the weekend, and then come back.
I think we are OK with most in-progress operations, because any
blobs added to the index will of course be considered reachable and
not pruned. What would hurt most is that you could do:
$ hack hack hack
$ git add foo
$ hack hack hack
$ git add foo
$ hack hack hack
[oops! I realized I really wanted the initial version of foo!]
$ git fsck --lost-found
If your session is interrupted during the third "hack hack hack"
bit, a short prune might lose the initial version. Of course,
that's _if_ a gc is run in the middle. So I find it possible, but
somewhat unlikely.
2. If a branch is deleted, all of its reflogs go away immediately. A
short expiration time would mean that the objects will probably go
away at the next "gc".
In many cases, you will be saved by the HEAD reflog, which stays
around until the real expiration is reached. But not always (e.g.,
server-side reflogs).
I'd much rather address this in the general case by saving
deleted-branch reflogs, though I know you and I have disagreed on
that in the past.
One issue not brought up in that thread is that of bare repositories,
which do not have reflogs enabled by default. In that case, the 2-week
prune window is really doing something.
I really wonder if there is a good reason not to turn on reflogs for all
repositories, bare included. We have them on for all of the server-side
repositories at github, and they have been invaluable for resolving
many support tickets from people who forced a push without realizing
what they were doing.
-Peff
next prev parent reply other threads:[~2012-06-11 17:46 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-10 12:31 Keeping unreachable objects in a separate pack instead of loose? Theodore Ts'o
2012-06-10 23:24 ` Hallvard B Furuseth
2012-06-11 14:44 ` Thomas Rast
2012-06-11 15:31 ` Ted Ts'o
2012-06-11 16:08 ` Jeff King
2012-06-11 17:04 ` Nicolas Pitre
2012-06-11 17:45 ` Ted Ts'o
2012-06-11 17:54 ` Jeff King
2012-06-11 18:20 ` Ted Ts'o
2012-06-11 18:43 ` Jeff King
2012-06-11 17:46 ` Jeff King [this message]
2012-06-11 17:27 ` Ted Ts'o
2012-06-11 18:34 ` Jeff King
2012-06-11 20:44 ` Hallvard Breien Furuseth
2012-06-11 21:14 ` Jeff King
2012-06-11 21:41 ` Hallvard Breien Furuseth
2012-06-11 21:14 ` Ted Ts'o
2012-06-11 21:39 ` Jeff King
2012-06-11 22:14 ` Ted Ts'o
2012-06-11 22:23 ` Jeff King
2012-06-11 22:28 ` Ted Ts'o
2012-06-11 22:35 ` Jeff King
2012-06-12 0:41 ` Nicolas Pitre
2012-06-12 17:10 ` Jeff King
2012-06-12 17:30 ` Nicolas Pitre
2012-06-12 17:32 ` Jeff King
2012-06-12 17:45 ` Shawn Pearce
2012-06-12 17:50 ` Jeff King
2012-06-12 17:57 ` Nicolas Pitre
2012-06-12 18:43 ` Andreas Schwab
2012-06-12 19:07 ` Jeff King
2012-06-12 19:09 ` Nicolas Pitre
2012-06-12 19:23 ` Jeff King
2012-06-12 19:39 ` Nicolas Pitre
2012-06-12 19:41 ` Jeff King
2012-06-12 17:55 ` Nicolas Pitre
2012-06-12 17:49 ` Nicolas Pitre
2012-06-12 17:54 ` Jeff King
2012-06-12 18:25 ` Nicolas Pitre
2012-06-12 18:37 ` Ted Ts'o
2012-06-12 19:15 ` Nicolas Pitre
2012-06-12 19:19 ` Ted Ts'o
2012-06-12 19:35 ` Nicolas Pitre
2012-06-12 19:43 ` Ted Ts'o
2012-06-12 19:15 ` Jeff King
2012-06-13 18:17 ` Martin Fick
2012-06-13 21:27 ` Johan Herland
2012-06-11 15:40 ` Junio C Hamano
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=20120611174628.GA20134@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=h.b.furuseth@usit.uio.no \
--cc=nico@fluxnic.net \
--cc=trast@student.ethz.ch \
--cc=tytso@mit.edu \
/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).