Subject: Re: [PATCH v2 0/25] prune-safety

From: Jeff King <[email-masked]>
Date: Sat, 18 Oct 2014 08:31:06 -0400

On Thu, Oct 16, 2014 at 05:39:18PM -0400, Jeff King wrote:

> @@ -301,6 +297,14 @@ static struct commit *handle_commit(struct rev_info *revs,
>  			die("bad object %s", sha1_to_hex(tag->tagged->sha1));
>  		}
>  		object->flags |= flags;
> +		/*
> +		 * We'll handle the tagged object by looping or dropping
> +		 * through to the non-tag handlers below. Do not
> +		 * propagate data from the tag's pending entry.
> +		 */
> +		name = NULL;
> +		path = NULL;
> +		mode = 0;

Hmm. On second thought (and after seeing a warning from Coverity), this
should be:

diff --git a/revision.c b/revision.c
index 8030fc8..ebe3e93 100644
--- a/revision.c
+++ b/revision.c
@@ -302,7 +302,7 @@ static struct commit *handle_commit(struct rev_info *revs,
 		 * through to the non-tag handlers below. Do not
 		 * propagate data from the tag's pending entry.
 		 */
-		name = NULL;
+		name = "";
 		path = NULL;
 		mode = 0;
 	}

The rest of the function assumes that name is not NULL (which I'm not
sure is entirely safe, as add_pending_object can take a NULL; presumably
every "add" uses the empty string instead of NULL. But either way,
setting it to NULL here is definite wrong).

The "path" field is explicitly OK to be NULL.

-Peff