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

[PATCH 1/4] remote: add a new 'origin' variable to the struct

From
Miklos Vajna <vmiklos@frugalware.org>
Date
Nov 10, 2008, 20:43 UTC
Message-ID
<95e56b46e30b41af31da86789625c93511f1faef.1226349595.git.vmiklos@frugalware.org>
In-Reply-To
<cover.1226349595.git.vmiklos@frugalware.org>

This allows one to track where was the remote's original source, so that it's possible to decide if it makes sense to migrate it to the config format or not.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 remote.c |    3 +++
 remote.h |    7 +++++++
 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/remote.c b/remote.c
index e530a21..cbb3e48 100644
--- a/remote.c
+++ b/remote.c
@@ -201,6 +201,7 @@ static void read_remotes_file(struct remote *remote)
 
 	if (!f)
 		return;
+	remote->origin = REMOTE_REMOTES;
 	while (fgets(buffer, BUF_SIZE, f)) {
 		int value_list;
 		char *s, *p;
@@ -261,6 +262,7 @@ static void read_branches_file(struct remote *remote)
 		s++;
 	if (!*s)
 		return;
+	remote->origin = REMOTE_BRANCHES;
 	p = s + strlen(s);
 	while (isspace(p[-1]))
 		*--p = 0;
@@ -350,6 +352,7 @@ static int handle_config(const char *key, const char *value, void *cb)
 	if (!subkey)
 		return error("Config with no key for remote %s", name);
 	remote = make_remote(name, subkey - name);
+	remote->origin = REMOTE_CONFIG;
 	if (!strcmp(subkey, ".mirror"))
 		remote->mirror = git_config_bool(key, value);
 	else if (!strcmp(subkey, ".skipdefaultupdate"))
diff --git a/remote.h b/remote.h
index d2e170c..a46a5be 100644
--- a/remote.h
+++ b/remote.h
@@ -1,8 +1,15 @@
 #ifndef REMOTE_H
 #define REMOTE_H
 
+enum {
+	REMOTE_CONFIG,
+	REMOTE_REMOTES,
+	REMOTE_BRANCHES
+};
+
 struct remote {
 	const char *name;
+	int origin;
 
 	const char **url;
 	int url_nr;
-- 
1.6.0.2
Previous: Miklos VajnaNext: Miklos Vajna
Message 9 of 15 in “Implement git remote mv”
  1. Implement git remote mvMiklos Vajna, Oct 22, 2008
  2. Brandon CaseyOct 22, 2008
  3. Implement git remote mvMiklos Vajna, Oct 23, 2008
  4. Jeff KingOct 23, 2008
  5. Implement git remote renameMiklos Vajna, Oct 23, 2008
  6. Junio C HamanoOct 24, 2008
  7. Implement git remote renameMiklos Vajna, Nov 3, 2008
  8. Miklos VajnaNov 10, 2008
  9. 1/4 remote: add a new 'origin' variable to the structMiklos Vajna, Nov 10, 2008
  10. 2/4 git-remote rename: support remotes->config migrationMiklos Vajna, Nov 10, 2008
  11. 3/4 git-remote rename: support branches->config migrationMiklos Vajna, Nov 10, 2008
  12. 4/4 git-remote: document the migration feature of the rename subcommandMiklos Vajna, Nov 10, 2008
  13. Junio C HamanoNov 12, 2008
  14. Miklos VajnaNov 12, 2008
  15. Junio C HamanoNov 12, 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.