From: Stefan Sperling Subject: Re: Unnecessary check after got_object_id_by_path() To: Martin Pieuchot Cc: gameoftrees@openbsd.org Date: Sun, 19 Jan 2020 14:47:23 +0100 On Sun, Jan 19, 2020 at 02:33:34PM +0100, Martin Pieuchot wrote: > To my understanding got_object_id_by_path() always return an error code > if `obj_id' is NULL. That means the checks below are redundant. > > ok? Yes, that's right. And tests are still passing with this. ok. > diff --git got/got.c got/got.c > index 5490ed3..f52a257 100644 > --- got/got.c > +++ got/got.c > @@ -2726,10 +2726,6 @@ cmd_blame(int argc, char *argv[]) > error = got_object_id_by_path(&obj_id, repo, commit_id, in_repo_path); > if (error) > goto done; > - if (obj_id == NULL) { > - error = got_error(GOT_ERR_NO_OBJ); > - goto done; > - } > > error = got_object_get_type(&obj_type, repo, obj_id); > if (error) > diff --git tog/tog.c tog/tog.c > index fc01887..8892f4b 100644 > --- tog/tog.c > +++ tog/tog.c > @@ -3616,8 +3616,6 @@ run_blame(struct tog_blame *blame, struct tog_view *view, int *blame_complete, > err = got_object_id_by_path(&obj_id, repo, commit_id, path); > if (err) > return err; > - if (obj_id == NULL) > - return got_error(GOT_ERR_NO_OBJ); > > err = got_object_get_type(&obj_type, repo, obj_id); > if (err) > >