remote: add a new 'origin' variable to the struct
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Miklos Vajna committed
Nov 10, 2008 at 21:43 UTC
89cf4c7004ec329c3171448a154d050c8f75874e
2 files changed
+10
remote.c
+3
@@ -201,6 +201,7 @@ static void read_remotes_file(struct remote *remote)
201
202
if (!f)
203
return;
204
+ remote->origin = REMOTE_REMOTES;
205
while (fgets(buffer, BUF_SIZE, f)) {
206
int value_list;
207
char *s, *p;
@@ -261,6 +262,7 @@ static void read_branches_file(struct remote *remote)
262
s++;
263
if (!*s)
264
return;
265
+ remote->origin = REMOTE_BRANCHES;
266
p = s + strlen(s);
267
while (isspace(p[-1]))
268
*--p = 0;
@@ -350,6 +352,7 @@ static int handle_config(const char *key, const char *value, void *cb)
352
if (!subkey)
353
return error("Config with no key for remote %s", name);
354
remote = make_remote(name, subkey - name);
355
+ remote->origin = REMOTE_CONFIG;
356
if (!strcmp(subkey, ".mirror"))
357
remote->mirror = git_config_bool(key, value);
358
else if (!strcmp(subkey, ".skipdefaultupdate"))
remote.h
+7
@@ -1,8 +1,15 @@
1
#ifndef REMOTE_H
2
#define REMOTE_H
3
4
+enum {
5
+ REMOTE_CONFIG,
6
+ REMOTE_REMOTES,
7
+ REMOTE_BRANCHES
8
+};
9
+
10
struct remote {
11
const char *name;
12
+ int origin;
13
14
const char **url;
15
int url_nr;