Re: [PATCHv2 6/7] builtin/describe.c: describe a blob
- From
Stefan Beller <sbeller@google.com>
- Date
- Nov 1, 2017, 17:59 UTC
- Message-ID
- <CAGZ79kZPNiNnSJd6CNYb7XkTVsT2ONLQLhwAQxt6_SPFTSwMcw@mail.gmail.com>
- In-Reply-To
- <alpine.DEB.2.21.1.1711011329300.6482@virtualbox>
Show 19 quoted lines
>> Does the code describe a9dbc3f12c as v2.15.0:GIT-VERSION-GEN, or
>> would it always be <commit>:<path>?
>
> 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.