Re: [PATCH] Fix remote_get so it will return NULL when no remote is found.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johannes Schindelin
Date: Thursday, June 5, 2008 - 6:26 am

Hi,

[nice to go to sleep and see a patch in the morning]

On Thu, 5 Jun 2008, Victor Bogado da Silva Lins wrote:


Please imitate what you see on this list, especially by the Git regulars.  
They never include these headers.


This is a bit vague, a bit wrong, and it has the subjective "I" in it.  
remote_get() _is_ assumed to return NULL when no remote with that name was 
found.

And the function was fixed (3rd person, passive).  At least that is how I 
remember most of the rest of git.git's commit messages.


Hmm.  That sounds very dangerous, using a pointer without checking that it 
is NULL.

Besides, I think that the add_url_alias(ret, name) above is at 
fault.  Not the alias part about it, though.  This used to be an add_url() 
from the conception of remote.c, but then it was only used for fetching.

I think the proper solution is to add a parameter, or a function, to force 
NULL if the remote did not exist.

Of course, this involves a careful review of the existing callers, to find 
out which ones rely on getting a newly created remote when none was found.

In any case, thank you very much for finding that bug (the if() I pointed 
out was in remote.c from the very beginning, even then never being 
triggered).

Ciao,
Dscho

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Fix remote_get so it will return NULL when no remo ..., Victor Bogado da Sil ..., (Thu Jun 5, 5:48 am)
Re: [PATCH] Fix remote_get so it will return NULL when no ..., Johannes Schindelin, (Thu Jun 5, 6:26 am)