{"thread":{"id":"23127","subject":"[PATCH 2/2] clone: pass the remote name to remote_get","startedAt":"2010-03-21T20:19:48Z","lastAt":"2010-03-21T23:27:46Z","messageCount":3,"participants":["Sverre Rabbelier"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"137476","messageId":"1269202789-8833-1-git-send-email-srabbelier@gmail.com","threadId":"23127","inReplyTo":null,"subject":"[PATCH 1/2] Move setup_reference to after writing the config file","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-03-21T20:19:48Z","receivedAt":"2010-03-21T20:19:48Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Currently setup_reference calls remote_get before the remote is\nadded to the config file. This will result in an improperly\nconfigured remote (in memory) if later on remote_get is called\nwith an argument that is not equal to the initial remote_get call\nin setup_reference. Fix this by delaying the remote_get call until\nafter the remote has been added to the config file.\n---\n\n  It is also possible to split setup_reference so that the part that\n  calls remote_get is where the entire setup_referene call is moved\n  to now, this also works, and results in a far simpler patch.\n\n  This change is required for the next patch.\n\n builtin/clone.c |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex 05f8fb4..f878563 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -470,9 +470,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t */\n \tunsetenv(CONFIG_ENVIRONMENT);\n \n-\tif (option_reference)\n-\t\tsetup_reference(git_dir);\n-\n \tgit_config(git_default_config, NULL);\n \n \tif (option_bare) {\n@@ -504,6 +501,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t\tstrbuf_reset(&key);\n \t}\n \n+\tif (option_reference)\n+\t\tsetup_reference(git_dir);\n+\n \tfetch_pattern = value.buf;\n \trefspec = parse_fetch_refspec(1, &fetch_pattern);\n \n-- \n1.7.0.2.325.g634e5\n"},{"id":"137475","messageId":"1269202789-8833-2-git-send-email-srabbelier@gmail.com","threadId":"23127","inReplyTo":"1269202789-8833-1-git-send-email-srabbelier@gmail.com","subject":"[PATCH 2/2] clone: pass the remote name to remote_get","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-03-21T20:19:49Z","receivedAt":"2010-03-21T20:19:49Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Currently when using a remote helper to clone a repository, the\nremote helper will be passed the url of the target repository as\nfirst argument (which represents the name of the remote). This name\nis extracted from transport->remote->name, which is set by\nbuiltin/clone.c when it calls remote_get with argv[0] as argument.\n\nFix this by passing the name remote will be set up as instead.\n---\n\n  I've spent quite a few hours trying to figure out why this broke\n  t5700, so I would appreciate feedback from those with more\n  knowledge about hardlinking and clone/fetch in general as to\n  whether this couild cause any problems.\n\n builtin/clone.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex f878563..068d61f 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -513,7 +513,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)\n \t\trefs = clone_local(path, git_dir);\n \t\tmapped_refs = wanted_peer_refs(refs, refspec);\n \t} else {\n-\t\tstruct remote *remote = remote_get(argv[0]);\n+\t\tstruct remote *remote = remote_get(option_origin);\n \t\ttransport = transport_get(remote, remote->url[0]);\n \n \t\tif (!transport->get_refs_list || !transport->fetch)\n-- \n1.7.0.2.325.g634e5\n"},{"id":"137491","messageId":"fabb9a1e1003211627q7ea75194j941fe9ae23f77b66@mail.gmail.com","threadId":"23127","inReplyTo":"1269202789-8833-2-git-send-email-srabbelier@gmail.com","subject":"Re: [PATCH 2/2] clone: pass the remote name to remote_get","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-03-21T23:27:46Z","receivedAt":"2010-03-21T23:27:46Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sun, Mar 21, 2010 at 21:19, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n> Currently when using a remote helper to clone a repository, the\n> remote helper will be passed the url of the target repository as\n> first argument (which represents the name of the remote). This name\n> is extracted from transport->remote->name, which is set by\n> builtin/clone.c when it calls remote_get with argv[0] as argument.\n>\n> Fix this by passing the name remote will be set up as instead.\n\nAh, I forgot a sign-off it seems. Also, these two patches were a bit\nmore involved before (I didn't arrive at their current form for quite\na few hours), so I guess it could makes sense to just squash them into\none patch. Whichever is preferable.\n\n-- \nCheers,\n\nSverre Rabbelier\n"}]}