Re: [PATCH 1/8] write_ref_sha1(): remove check for lock == NULL
- From
Stefan Beller <sbeller@google.com>
- Date
- Feb 10, 2015, 22:52 UTC
- Message-ID
- <CAGZ79kbCHAS3kbF_rwiGFxNCG1movygkcyOddELM7ikOM+wKBQ@mail.gmail.com>
- In-Reply-To
- <1423473164-6011-2-git-send-email-mhagger@alum.mit.edu>
On Mon, Feb 9, 2015 at 1:12 AM, Michael Haggerty <mhagger@alum.mit.edu> wrote:
> None of the callers pass NULL to this function, and there doesn't seem > to be any usefulness to allowing them to do so.
Usually I'd oppose this change, as it seems to be a good defensive measure. (I cannot assume future me or anybody knows what they're doing), but as this function (write_ref_sha1) is not widely exposed any more since aae383db8 (Apr 28, refs.c: make write_ref_sha1 static), I think it's safe to assume changes affecting this call are well understood in the future.
so Reviewed-by: Stefan Beller <sbeller@google.com>
Show 24 quoted lines
>
> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
> ---
> refs.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index c5fa709..d1130e2 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -3080,10 +3080,6 @@ static int write_ref_sha1(struct ref_lock *lock,
> static char term = '\n';
> struct object *o;
>
> - if (!lock) {
> - errno = EINVAL;
> - return -1;
> - }
> if (!lock->force_write && !hashcmp(lock->old_sha1, sha1)) {
> unlock_ref(lock);
> return 0;
> --
> 2.1.4
>