From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.7 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 26BC2202A0 for ; Wed, 1 Nov 2017 22:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933490AbdKAWMx (ORCPT ); Wed, 1 Nov 2017 18:12:53 -0400 Received: from mout.gmx.net ([212.227.17.20]:60759 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933402AbdKAWMv (ORCPT ); Wed, 1 Nov 2017 18:12:51 -0400 Received: from virtualbox ([37.201.193.73]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MYbFe-1deeSm3Yvq-00VQut; Wed, 01 Nov 2017 23:12:42 +0100 Date: Wed, 1 Nov 2017 23:12:40 +0100 (CET) From: Johannes Schindelin X-X-Sender: virtualbox@virtualbox To: Jacob Keller cc: Stefan Beller , Junio C Hamano , git , Kevin Daudt Subject: Re: [PATCHv2 6/7] builtin/describe.c: describe a blob In-Reply-To: Message-ID: References: <20171031003351.22341-1-sbeller@google.com> <20171031211852.13001-1-sbeller@google.com> <20171031211852.13001-7-sbeller@google.com> User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K0:uwAqZQjpEYi90OQqdPR7REw7RDYMQ4nHMYcao4zs8BqJBNLmcoZ hzgXY94qWpk+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.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi, On Wed, 1 Nov 2017, Jacob Keller wrote: > On November 1, 2017 10:59:08 AM PDT, Stefan Beller wrote: > >>> Does the code describe a9dbc3f12c as v2.15.0:GIT-VERSION-GEN, or > >>> would it always be :? > >> > >> As the blob is described using this function: > >> > >> static void process_object(struct object *obj, const char *path, void > >*data) > >> { > >> struct process_commit_data *pcd = data; > >> > >> if (!oidcmp(&pcd->looking_for, &obj->oid) && !pcd->dst->len) { > >> reset_revision_walk(); > >> describe_commit(&pcd->current_commit, pcd->dst); > >> strbuf_addf(pcd->dst, ":%s", path); > >> } > >> } > >> > >> i.e. as `describe_commit()` is used on the commit part, the answer to > >your > >> question is: the former. I guess that is why Stefan wrote > >`commit-ish` > >> instead of `commit` ;-) > > > >$ ./git describe a9dbc3f12c > >warning: reflog of 'HEAD' references pruned commits > >v2.15.0-7-g980e40477f:GIT-VERSION-GEN > > > >So as noted below, this output is less than ideal, but technically > >correct as > >v2.15.0-7-g980e40477f contains that blob as well (you don't have these; > >it is this very series consisting of 7 patches on top of 2.15, none of > >them > >touching GIT-VERSION-GEN, hence that blob stays intact.) > > > >The way Junio asked, we actually may prefer the commit-ish to give > >that commit that introduced the blob for the first time, i.e. add the > >--reverse to the graph walking. > > I know id prefer the first commit that introduced the blob. That's what > describing a commit does, it finds the oldest tag prior to the commit, > while --contains finds the first tag that contains the commit as an > ancestor. It is very easy to wish for "the oldest commit introducing a blob". But since we're in a DAG, this question is not necessarily easy to answer: - A - B - C \ / D Let's assume that all commits except A have the blob, and that B and D (for some reason) have the same author/committer dates. Do you identify B or D as the commit introducing the blob? Ciao, Dscho