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=-3.3 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,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 3836B1F453 for ; Wed, 24 Oct 2018 08:38:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727261AbeJXRGD (ORCPT ); Wed, 24 Oct 2018 13:06:03 -0400 Received: from mout.gmx.net ([212.227.17.21]:58029 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726732AbeJXRGD (ORCPT ); Wed, 24 Oct 2018 13:06:03 -0400 Received: from [192.168.0.129] ([37.201.193.149]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LpPg1-1fdA6n2aTF-00f9Zj; Wed, 24 Oct 2018 10:38:40 +0200 Received: from [192.168.0.129] ([37.201.193.149]) by mail.gmx.com (mrgmx102 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LpPg1-1fdA6n2aTF-00f9Zj; Wed, 24 Oct 2018 10:38:40 +0200 Date: Wed, 24 Oct 2018 10:38:43 +0200 (DST) From: Johannes Schindelin X-X-Sender: virtualbox@gitforwindows.org To: Junio C Hamano cc: Johannes Schindelin via GitGitGadget , git@vger.kernel.org, Duy Nguyen , Jeff King Subject: Re: [PATCH v3 1/3] repack: point out a bug handling stale shallow info In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset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fwWAX84IX8irShrz224DF6eamiL3490KnhO+D HZlC5CjfbJsxLW+nm+W2F3H/7D3bdLBuvwXLHJrpvVCyRM1PVA= Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Junio, me again. I was wrong. On Wed, 24 Oct 2018, Johannes Schindelin wrote: > On Wed, 24 Oct 2018, Junio C Hamano wrote: > > > "Johannes Schindelin via GitGitGadget" > > writes: > > > > > +... > > > + d="$(git -C shallow-server rev-parse --verify D)" && > > > + git -C shallow-server checkout master && > > > + > > > +... > > > + ! grep $d shallow-client/.git/shallow && > > > > We know D (and $d) is not a tag, > > Actually, it is... the `test_commit D` creates that tag, and that is what > I use here. > > > but perhaps the place that assigns to $d (way above) can do the > > rev-parse of D^0, not D, to make it more clear what is going on, > > especially given that... > > ... that the `grep` really wants to test for the absence of the *commit*, > not the *tag* in .git/shallow? > > Yes, you are right ;-) > > So why did my test do the right thing, if it looked at a tag, but did not > dereference it via ^0? The answer is: the `test_commit` function creates > light-weight tags, i.e. no tag objects. And therefore, the $d^0 you found > below, that's just confusing. What I was referring to was the call test_must_fail git -C shallow-client rev-parse --verify $d^0 However, here we *have* to append ^0, otherwise `rev-parse --verify` will (and quite confusingly so) *succeed*. I *repeatedly* fall into that trap that `git rev-parse --verify 0000000000000000000000000000000000000000` will succeed. Why? Because that is a valid 40-digit hex string. Not because the object exists. Because it does not. So I managed to confuse myself again into believing that I only need to append ^0 to the earlier rev-parse call, but can remove it from this one, when in reality, I have to append it to both. In the first case, to avoid having to think about dereferencing a tag, in the second case, to force rev-parse to look for the object. Ciao, Dscho > > I will change it so that the `rev-parse` call uses ^0 (even if it is > technically not necessary), to avoid said confusion. > > Thanks, > Dscho > > > > > > + git -C shallow-server branch branch-orig D^0 && > > > > ... this does that D^0 thing here to makes us wonder if D needs > > unwrapping before using it as a commit (not commit-ish). > > > > If we did so, we could use $d here instead of D^0. > > > > > + git -C shallow-client fetch --prune --depth=2 \ > > > + origin "+refs/heads/*:refs/remotes/origin/*" > > > +' > > > + > > > . "$TEST_DIRECTORY"/lib-httpd.sh > > > start_httpd > > > > >