From: Paul-Sebastian Ungureanu Date: Wed, 18 Jul 2018 23:11:49 GMT Subject: Re: [RFC PATCH 2/6] tree-walk: Add three new gentle helpers Message-ID: In-Reply-To: Hello, On 17.07.2018 21:55, Junio C Hamano wrote: > 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