Skip to content

Commit 3ff56af

Browse files
chriscoolgitster
authored andcommitted
revision: clarify a 'return NULL' in get_reference()
When we know a pointer variable is NULL, it's clearer to explicitly return NULL than to return that variable. In get_reference(), when 'object' is NULL, we already return NULL when 'revs->exclude_promisor_objects && is_promisor_object(oid)' is true, but we return 'object' when 'revs->ignore_missing' is true. Let's make the code clearer and more uniform by also explicitly returning NULL when 'revs->ignore_missing' is true. Helped-by: Eric Sunshine <[email protected]> Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 75389e2 commit 3ff56af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

revision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ static struct object *get_reference(struct rev_info *revs, const char *name,
385385

386386
if (!object) {
387387
if (revs->ignore_missing)
388-
return object;
388+
return NULL;
389389
if (revs->exclude_promisor_objects && is_promisor_object(oid))
390390
return NULL;
391391
die("bad object %s", name);

0 commit comments

Comments
 (0)