Re: [RFC/PATCH v11 04/13] bisect--helper: `bisect_clean_state` shell function in C
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 4, 2016, 16:50 UTC
- Message-ID
- <xmqq1t245vhj.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <CAFZEwPMdOawVT6W6Ko=xkMLu4PcWkd0s_GiJA-T5uu-oY2m23g@mail.gmail.com>
Pranit Bauva <pranit.bauva@gmail.com> writes:
Show 22 quoted lines
> Hey Junio, > > On Thu, Aug 4, 2016 at 9:15 PM, Junio C Hamano <gitster@pobox.com> wrote: >> Pranit Bauva <pranit.bauva@gmail.com> writes: >> >>>> Also you do not seem to check the error from the function to smudge >>>> the "result" you are returning from this function. >>> >>> Yes I should combine the results from every removal. >>> >>>> Isn't unlink_or_warn() more correct helper to use here? >>> >>> The shell code uses rm -f which is silent and it removes only if >>> present. >> >> Isn't that what unlink_or_warn() do? Call unlink() and happily >> return if unlink() succeeds or errors with ENOENT (i.e. path didn't >> exist in the first place), but otherwise reports an error (imagine: >> EPERM). > > Umm, I am confused. I tried "rm -f" with a non-existing file and it > does not show any warning or error.
You are, or you were? I hope it is the latter, iow, you are no longer confused and now understand why unlink_or_warn() was suggested.