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

Re: [PATCH v2] Fix remote.<remote>.vcs

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 27, 2010, 20:22 UTC
Message-ID
<7vk4v3pabr.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20100127185927.GA22630@Knoppix>
Ilari Liusvaara <ilari.liusvaara@elisanet.fi> writes:
Show 16 quoted lines
> On Wed, Jan 27, 2010 at 01:39:00PM -0500, Daniel Barkalow wrote:
>> On Wed, 27 Jan 2010, Ilari Liusvaara wrote:
>> >  
>> >  	if (!remote)
>> >  		die("No remote provided to transport_get()");
>> >  
>> >  	ret->remote = remote;
>> > +	helper = remote->foreign_vcs;
>> 
>> Needs to be "helper = remote ? remote->foreign_vcs : NULL", for the same 
>> reason that the test below had been "remote && remote->foreign_vcs".
>
> Few lines above that:
>
>      if (!remote)
>              die("No remote provided to transport_get()");
Perhaps we would want this micro-clean-up on top then.
-- >8 --
Subject: transport_get(): drop unnecessary check for !remote

At the beginning of the function we make sure remote is not NULL, and the remainder of the funciton already depends on it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
diff --git a/transport.c b/transport.c
index 87581b8..3846aac 100644
--- a/transport.c
+++ b/transport.c
@@ -921,7 +921,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
 	ret->remote = remote;
 	helper = remote->foreign_vcs;
 
-	if (!url && remote && remote->url)
+	if (!url && remote->url)
 		url = remote->url[0];
 	ret->url = url;
 
Previous: Ilari LiusvaaraNext: Daniel Barkalow
Message 5 of 7 in “Fix remote.<remote>.vcs”
  1. Fix remote.<remote>.vcsIlari Liusvaara, Jan 27, 2010
  2. Sverre RabbelierJan 27, 2010
  3. Daniel BarkalowJan 27, 2010
  4. Ilari LiusvaaraJan 27, 2010
  5. Junio C HamanoJan 27, 2010
  6. Daniel BarkalowJan 27, 2010
  7. Junio C HamanoJan 27, 2010

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.