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

Re: [RFC PATCH 2/6] tree-walk: Add three new gentle helpers

From
Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Date
Jul 18, 2018, 23:11 UTC
Message-ID
<ba38bdd0-c1c3-cded-0e18-f21e0d7fd9a8@gmail.com>
In-Reply-To
<xmqqin5dofor.fsf@gitster-ct.c.googlers.com>
Hello,
On 17.07.2018 21:55, Junio C Hamano wrote:
Show 13 quoted lines
> I wonder if the GENTLY option should apply to update_tree_entry()
> the same way as it would to the other codepaths that currently die
> to express "we were handed this string by the caller and told to
> give back object ID the string represents, and we found no good
> answer".  In this one (and the "bad ref" one), the existing failures
> in these two codepaths are not "we got a string and that does not
> resolve to an object name", but "we didn't have the data to work on
> to begin with (either a corrupt tree object or a corrupt ref").
> 
> In other words, it's not like "We were given HEAD:no-such-path and
> there is no such path in that tree"; it is "We tried to read HEAD:
> tree for no-such-path in it, but the tree was corrupt and we couldn't
> even tell if such a path is or is not in it", no?

I can definitely say there is a clear difference between these two cases, but I am not entirely sure how `GENTLY` should apply to `update_tree_entry()`.

On one side, even before this patch, there was the gentle version of this function, `update_tree_entry_gently()`, which could still die. And it makes sense. It should be ok to call `die()` when there was detected a "bigger" issue.

On the other side, in some cases like `read_ref_at()` I think that it could be useful if the caller could handle any error (which is what patches 3/6 and 4/6 try to accomplish).

I really do not know which way would be the best in this particular case.

Best, Paul

Previous: Junio C HamanoNext: Paul-Sebastian Ungureanu
Message 10 of 13 in “Add gentle alternative for `get_oid()`”
  1. 0/6 Add gentle alternative for `get_oid()`Paul-Sebastian Ungureanu, Jul 17, 2018
  2. 5/6 sha1-name: Teach `get_oid_with_context[_1]()` to be gentlePaul-Sebastian Ungureanu, Jul 17, 2018
  3. Junio C HamanoJul 17, 2018
  4. Paul-Sebastian UngureanuJul 18, 2018
  5. 6/6 sha1-name: Add gentle alternative for `get_oid()`Paul-Sebastian Ungureanu, Jul 17, 2018
  6. 4/6 sha1-name: Teach `get_oid_basic()` to be gentlePaul-Sebastian Ungureanu, Jul 17, 2018
  7. 3/6 refs.c: Teach `read_ref_at()` to accept `GET_OID_GENTLY` flagPaul-Sebastian Ungureanu, Jul 17, 2018
  8. 2/6 tree-walk: Add three new gentle helpersPaul-Sebastian Ungureanu, Jul 17, 2018
  9. Junio C HamanoJul 17, 2018
  10. Paul-Sebastian UngureanuJul 18, 2018
  11. 1/6 sha1-name: Add `GET_OID_GENTLY` flagPaul-Sebastian Ungureanu, Jul 17, 2018
  12. Duy NguyenJul 17, 2018
  13. Paul-Sebastian UngureanuJul 18, 2018

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.