From: Junio C Hamano Date: Tue, 16 Nov 2010 17:57:13 GMT Subject: Re: [PATCH 1/2] [RFC] Detect attempts at calling git init specifying a remote repository. Message-ID: <7vfwv1i22u.fsf@alter.siamese.dyndns.org> In-Reply-To: <3f7d07a2b3a02c1d3f864d2a17f3b8808890a4d1.1289561504.git.peter@softwolves.pp.se> Peter Krefting writes: > We can only initialize local repositories, so bail out immediately if the > user tries to specify a remote repository. > --- > builtin/init-db.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/builtin/init-db.c b/builtin/init-db.c > index 9d4886c..f80ff08 100644 > --- a/builtin/init-db.c > +++ b/builtin/init-db.c > @@ -435,7 +435,12 @@ int cmd_init_db(int argc, const char **argv, const char *prefix) > int mkdir_tried = 0; > retry: > if (chdir(argv[0]) < 0) { > - if (!mkdir_tried) { > + if (is_url(argv[0]) || strchr(argv[0], '@') != NULL || (strchr(argv[0], ':') != NULL && !has_dos_drive_prefix(argv[0]))) { > + /* > + * We were passed a remote repository specification. Or a directory with ':' in its pathname, no?