From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id B4A771F97E for ; Sun, 7 Oct 2018 18:36:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727969AbeJHBoN (ORCPT ); Sun, 7 Oct 2018 21:44:13 -0400 Received: from bsmtp7.bon.at ([213.33.87.19]:42242 "EHLO bsmtp7.bon.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726233AbeJHBoM (ORCPT ); Sun, 7 Oct 2018 21:44:12 -0400 Received: from dx.site (unknown [93.83.142.38]) by bsmtp7.bon.at (Postfix) with ESMTPSA id 42SsdC0WvGz5tm4; Sun, 7 Oct 2018 20:35:58 +0200 (CEST) Received: from [IPv6:::1] (localhost [IPv6:::1]) by dx.site (Postfix) with ESMTP id D3DB3416F; Sun, 7 Oct 2018 20:35:57 +0200 (CEST) Subject: Re: What's so special about objects/17/ ? To: =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Cc: Junio C Hamano , Nicolas Pitre , Nix , Steven Grimm , Linus Torvalds , Git Mailing List References: <7vr6lcj2zi.fsf@gitster.siamese.dyndns.org> <20070905074206.GA31750@artemis.corp> <87odgh0zn6.fsf@hades.wkstn.nix> <46DEF1FA.4050500@midwinter.com> <877in50y7p.fsf@hades.wkstn.nix> <87k1mta9x5.fsf@evledraar.gmail.com> From: Johannes Sixt Message-ID: Date: Sun, 7 Oct 2018 20:35:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <87k1mta9x5.fsf@evledraar.gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Am 07.10.18 um 20:28 schrieb Ævar Arnfjörð Bjarmason: > In 2007 Junio wrote > (https://public-inbox.org/git/7vr6lcj2zi.fsf@gitster.siamese.dyndns.org/): > > +static int need_to_gc(void) > +{ > + /* > + * Quickly check if a "gc" is needed, by estimating how > + * many loose objects there are. Because SHA-1 is evenly > + * distributed, we can check only one and get a reasonable > + * estimate. > + */ > 1. We still have this check of objects/17/ in builtin/gc.c today. Why > objects/17/ and not e.g. objects/00/ to go with other 000* magic such > as the 0000000000000000000000000000000000000000 SHA-1? Statistically > it doesn't matter, but 17 seems like an odd thing to pick at random > out of 00..ff, does it have any significance? The reason is explained in the comment. And, BTW, you do know about this one: https://xkcd.com/221/ don't you? (TLDR: the title is "Random Number") > 2. It seems overly paranoid to be checking that the files in > .git/objects/17/ look like a SHA-1. If we have stuff not generated by > git in .git/objects/??/ we probably have bigger problems than > prematurely triggering auto gc, can this just be removed as > redundant. Was this some check e.g. expecting that this would need to > deal with tempfiles in these directories that we created at the time > (but no longer do?)? It's not about that there are SHA-1s in there, it's about how many there are. -- Hannes