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

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:07

Ilari Liusvaara [off-list ref] writes:
On Wed, Jan 27, 2010 at 01:39:00PM -0500, Daniel Barkalow wrote:
quoted
On Wed, 27 Jan 2010, Ilari Liusvaara wrote:
quoted
 
 	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 <redacted>
---
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;
 

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

From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:48:07

On Wed, 27 Jan 2010, Junio C Hamano wrote:
Ilari Liusvaara [off-list ref] writes:
quoted
On Wed, Jan 27, 2010 at 01:39:00PM -0500, Daniel Barkalow wrote:
quoted
On Wed, 27 Jan 2010, Ilari Liusvaara wrote:
quoted
 
 	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.
I agree with both of these; there used to be code that used a NULL remote 
and just a URL, but that's gone now.
quoted hunk
Signed-off-by: Junio C Hamano <redacted>
---
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;
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help