git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Use "git_config_string" to simplify "remote.c" code in "handle_config"

From
David Bryson <david@statichacks.org>
Date
Oct 6, 2008, 19:53 UTC
Message-ID
<20081006195352.GS5774@eratosthenes.cryptobackpack.org>
In-Reply-To
<alpine.DEB.1.00.0810061610400.22125@pacific.mpi-cbg.de.mpi-cbg.de>
Johannes,
On Mon, Oct 06, 2008 at 04:13:17PM +0200 or thereabouts, Johannes Schindelin wrote:
Show 14 quoted lines
> Hi,
> 
> On Thu, 2 Oct 2008, David Bryson wrote:
> 
> > 
> > Signed-off-by: David Bryson <david@statichacks.org>
> > 
> > I tried to keep with the naming/coding conventions that I found in
> > remote.c.  Feedback welcome.
> > 
> > ---
> 
> Usually this comment goes after the --- but other than that, the form is 
> as perfect as you can wish for.

I see, still trying to remember all the little tricks for proper submission, thanks.

Show 15 quoted lines
> > @@ -314,15 +315,15 @@ static int handle_config(const char *key, const char *value, void *cb)
> >  			return 0;
> >  		branch = make_branch(name, subkey - name);
> >  		if (!strcmp(subkey, ".remote")) {
> > -			if (!value)
> > -				return config_error_nonbool(key);
> > -			branch->remote_name = xstrdup(value);
> > +			if (git_config_string(&v, key, value) ) 
> > +				return -1;
> > +			branch->remote_name = v;
> 
> What is the reason not to write
> 
> 			if (git_config_string(&branch->remote_name, key, value))
> 				return -1;

The only reason is it did not come to mind ;-) But it does make the statement somewhat clearer.

> ?  (Also note that we do not like the space between the two closing 
> parentheses.)

An oversight to be sure and not intentional, I read the CodingGuidelines very carefully ;-)

Dave
Previous: Johannes Schindelin
Message 7 of 7 in “Use "git_config_string" to simplify "remote.c" code in "handle_config"”
  1. Use "git_config_string" to simplify "remote.c" code in "handle_config"David Bryson, Oct 3, 2008
  2. Andreas EricssonOct 3, 2008
  3. David BrysonOct 3, 2008
  4. Alex RiesenOct 4, 2008
  5. David BrysonOct 6, 2008
  6. Johannes SchindelinOct 6, 2008
  7. David BrysonOct 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.