Re: [PATCH v2 11/41] builtin/rm.c: use warning_errno()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 3, 2016, 19:58 UTC
- Message-ID
- <xmqqa8k6ncb1.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1462277054-5943-12-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 17 quoted lines
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> builtin/rm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/rm.c b/builtin/rm.c
> index 8829b09..13b9639 100644
> --- a/builtin/rm.c
> +++ b/builtin/rm.c
> @@ -152,7 +152,7 @@ static int check_local_mod(unsigned char *head, int index_only)
>
> if (lstat(ce->name, &st) < 0) {
> if (errno != ENOENT && errno != ENOTDIR)
> - warning("'%s': %s", ce->name, strerror(errno));
> + warning_errno("'%s'", ce->name);
> /* It already vanished from the working tree */
> continue;Not a new problem with this patch, but this would say
warning: 'Makefile': Permission denied.
or whatever error we may happen to have hit.
I think we show strerror(errno) as an additional explanation and there must be something _else_ that is the primary thing we would want to say, e.g.
warning: cannot remove 'Makefile': Permission denied.
Without that primary message from us, it looks somewhat wrong.