git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCHv5 7/7] builtin/describe.c: describe a blob

From
Stefan Beller <sbeller@google.com>
Date
Nov 16, 2017, 19:34 UTC
Message-ID
<CAGZ79kaGGUJSGG6OdfaTepDrvGBGFd17paBNNYuQt7t8XnDfHw@mail.gmail.com>
In-Reply-To
<xmqqwp2qx5w6.fsf@gitster.mtv.corp.google.com>
On Wed, Nov 15, 2017 at 7:24 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> I am not sure if "And if there is ..." is adding much value here (I
> do not think it is even technically correct for that matter).  If
> there are more than one tag that point at the commit the user is
> interested in, we use one of the tags, as tags conceptually sit at a
> higher level.  And we use a heuristic to use one or the other tag to
> make up a name for the commit, so the same commit can have two valid
> names. ---So what?  Neither of these two valid names is "ambigous";
> the commit object the user wanted to name _is_ correctly identified
> (I would assume that we are not discussing a hash collision).
>
> Lucikly, if we remove "And if...precisely", the logic still flows
> nicely, if not more, to the next paragraph.
fixed.
Show 12 quoted lines
>> When describing a blob, we want to describe the blob from a higher layer
>> as well, which is a tuple of (commit, deep/path) as the tree objects
>> involved are rather uninteresting.  The same blob can be referenced by
>> multiple commits, so how we decide which commit to use?  This patch
>> implements a rather naive approach on this: As there are no back pointers
>> from blobs to commits in which the blob occurs, we'll start walking from
>> any tips available, listing the blobs in-order of the commit and once we
>
> Is "any tips" still the case?  I was wondering why you start your
> traversal at HEAD and nothing else in this iteration.  There seems
> to be no mention of this design decision in the documentation and no
> justification in the log.

fixed the text. The design decision to reverse walk HEAD is tied to your observation below:

> The reversing may improve the chance of an older commit to be chosen
> rather than the newer one, but it does not even guarantee to show the
> "introduction".

This is what I realized when we started walking all refs including reflog. The introduction can only be found when we take the commit-parents into account and look at the diffs. I noticed you started origin/jc/diff-blobfind which may be helpful to find the introduction correctly, which I'll play around with that and see if I can get that working.

> What this guarantees is that a long history will be traversed fully
> before we start considering which commit has the blob of interest, I
> am afraid.  Is this a sensible trade-off?

I am not fully convinced all descriptions are in recent history, but I tend to agree that most are, so probably the trade off is a wash.

Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 19 in “[PATCHv5 0/7] describe blob”
  1. Stefan BellerNov 16, 2017
  2. 1/7 t6120: fix typo in test nameStefan Beller, Nov 16, 2017
  3. 2/7 list-objects.c: factor out traverse_trees_and_blobsStefan Beller, Nov 16, 2017
  4. 3/7 revision.h: introduce blob/tree walking in order of the commitsStefan Beller, Nov 16, 2017
  5. 4/7 builtin/describe.c: rename `oid` to avoid variable shadowingStefan Beller, Nov 16, 2017
  6. 5/7 builtin/describe.c: print debug statements earlierStefan Beller, Nov 16, 2017
  7. 6/7 builtin/describe.c: factor out describe_commitStefan Beller, Nov 16, 2017
  8. 7/7 builtin/describe.c: describe a blobStefan Beller, Nov 16, 2017
  9. Junio C HamanoNov 16, 2017
  10. Stefan BellerNov 16, 2017
  11. Junio C HamanoNov 22, 2017
  12. Stefan BellerNov 22, 2017
  13. Junio C HamanoNov 24, 2017
  14. Stefan BellerNov 27, 2017
  15. Junio C HamanoNov 27, 2017
  16. Philip OakleyNov 20, 2017
  17. Junio C HamanoDec 19, 2017
  18. Stefan BellerDec 19, 2017
  19. Junio C HamanoDec 22, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.