Re: [PATCH v4 3/4] last-modified: remove double error message
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 23, 2026, 17:07 UTC
- Message-ID
- <xmqqh5sci7go.fsf@gitster.g>
- In-Reply-To
- <20260123-toon-last-modified-tree-v4-3-86bf97bad4e2@iotcl.com>
Toon Claes <toon@iotcl.com> writes:
Show 8 quoted lines
> When the user passes two revisions, they get the following output: > > $ git last-modified HEAD HEAD~ > error: last-modified can only operate on one revision at a time > error: unable to setup last-modified > > The error message about "unable to setup" is not very informative, > remove it.
We can see that an error message is always given when populate_paths_from_revs() returns negative, so this change is safe (i.e., if there is a code path in the function that returns negative without giving any message, this change will lead to a silent failure in such a code path). Looking good.
Thanks.
Show 18 quoted lines
> Signed-off-by: Toon Claes <toon@iotcl.com>
> ---
> builtin/last-modified.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/last-modified.c b/builtin/last-modified.c
> index 06e3f79aec..0df85be318 100644
> --- a/builtin/last-modified.c
> +++ b/builtin/last-modified.c
> @@ -495,7 +495,7 @@ static int last_modified_init(struct last_modified *lm, struct repository *r,
> lm->rev.bloom_filter_settings = get_bloom_filter_settings(lm->rev.repo);
>
> if (populate_paths_from_revs(lm) < 0)
> - return error(_("unable to setup last-modified"));
> + return -1;
>
> CALLOC_ARRAY(lm->all_paths, hashmap_get_size(&lm->paths));
> lm->all_paths_nr = 0;