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

[RFCv2 05/12] Use a function to determine whether a remote is valid

From
Johan Herland <johan@herland.net>
Date
Jul 31, 2009, 10:00 UTC
Message-ID
<1249034432-31437-6-git-send-email-johan@herland.net>
In-Reply-To
<1249034432-31437-1-git-send-email-johan@herland.net>
From: Daniel Barkalow <barkalow@iabervon.org>
Currently, it only checks url, but it will allow other things in the future.
Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Johan Herland <johan@herland.net>
---
 remote.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/remote.c b/remote.c
index 758727c..106151f 100644
--- a/remote.c
+++ b/remote.c
@@ -48,6 +48,11 @@ static int rewrite_nr;
 #define BUF_SIZE (2048)
 static char buffer[BUF_SIZE];
 
+static int valid_remote(const struct remote *remote)
+{
+	return !!remote->url;
+}
+
 static const char *alias_url(const char *url)
 {
 	int i, j;
@@ -669,14 +674,14 @@ struct remote *remote_get(const char *name)
 
 	ret = make_remote(name, 0);
 	if (valid_remote_nick(name)) {
-		if (!ret->url)
+		if (!valid_remote(ret))
 			read_remotes_file(ret);
-		if (!ret->url)
+		if (!valid_remote(ret))
 			read_branches_file(ret);
 	}
-	if (name_given && !ret->url)
+	if (name_given && !valid_remote(ret))
 		add_url_alias(ret, name);
-	if (!ret->url)
+	if (!valid_remote(ret))
 		return NULL;
 	ret->fetch = parse_fetch_refspec(ret->fetch_refspec_nr, ret->fetch_refspec);
 	ret->push = parse_push_refspec(ret->push_refspec_nr, ret->push_refspec);
-- 
1.6.4.rc3.138.ga6b98.dirty
Previous: Johan HerlandNext: Johan Herland
Message 6 of 12 in “[RFCv2 00/12] Foreign VCS helper program for CVS repositories”
  1. Johan HerlandJul 31, 2009
  2. 01/12 Allow late reporting of fetched hashesJohan Herland, Jul 31, 2009
  3. 02/12 Document details of transport function APIsJohan Herland, Jul 31, 2009
  4. 03/12 Add option for using a foreign VCSJohan Herland, Jul 31, 2009
  5. 04/12 Add specification of git-vcs-* helper programsJohan Herland, Jul 31, 2009
  6. 05/12 Use a function to determine whether a remote is validJohan Herland, Jul 31, 2009
  7. 06/12 Allow programs to not depend on remotes having urlsJohan Herland, Jul 31, 2009
  8. 07/12 Add a transport implementation using git-vcs-* helpersJohan Herland, Jul 31, 2009
  9. 08/12 Preliminary clarifications to git-vcs documentationJohan Herland, Jul 31, 2009
  10. 09/12 Teach foreign transport code to perform the "capabilities" commandJohan Herland, Jul 31, 2009
  11. 10/12 Introduce a 'marks <filename>' feature to the foreign transport codeJohan Herland, Jul 31, 2009
  12. 12/12 Add simple test cases of git-vcs-cvs functionalityJohan Herland, Jul 31, 2009

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.