{"thread":{"id":"10292","subject":"[PATCH] Make the output of \"git svn clone\" less confusing.","startedAt":"2007-10-15T15:21:10Z","lastAt":"2007-10-18T17:14:43Z","messageCount":6,"participants":["David Kågedal","Eric Wong","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"55879","messageId":"87k5poflp5.fsf@lysator.liu.se","threadId":"10292","inReplyTo":null,"subject":"[PATCH] Make the output of \"git svn clone\" less confusing.","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-10-15T15:21:10Z","receivedAt":"2007-10-15T15:21:10Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"The problem is that the first thing it prints is\n\n  Initialized empty Git repository in .git/\n\neven if actually created a subdirectory and changed into it first. But to the\nuser, it looks like it is creating a .git/ dir in the directory he/she is\nstarted git from.\n---\n git-svn.perl |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\nThis change makes it more chatty, which might not be a good thing. But\nI think the previous output was worse.\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 777e436..d4450ca 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -286,6 +286,7 @@ sub do_git_init_db {\n \n sub init_subdir {\n \tmy $repo_path = shift or return;\n+\tprint \"Creating directory $repo_path\\n\";\n \tmkpath([$repo_path]) unless -d $repo_path;\n \tchdir $repo_path or die \"Couldn't chdir to $repo_path: $!\\n\";\n \t$ENV{GIT_DIR} = '.git';\n-- \n1.5.3.4.213.gb3127-dirty\n\n-- \nDavid Kågedal\n"},{"id":"55996","messageId":"20071016093228.GA30503@soma","threadId":"10292","inReplyTo":"87k5poflp5.fsf@lysator.liu.se","subject":"Re: [PATCH] Make the output of \"git svn clone\" less confusing.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-10-16T09:32:28Z","receivedAt":"2007-10-16T09:32:28Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"David Kågedal <davidk@lysator.liu.se> wrote:\n> The problem is that the first thing it prints is\n> \n>   Initialized empty Git repository in .git/\n> \n> even if actually created a subdirectory and changed into it first. But to the\n> user, it looks like it is creating a .git/ dir in the directory he/she is\n> started git from.\n\nThanks for bringing it up I just noticed this the other day myself and\nthought it might be confusing.\n\n> ---\n>  git-svn.perl |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n> \n> This change makes it more chatty, which might not be a good thing. But\n> I think the previous output was worse.\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 777e436..d4450ca 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -286,6 +286,7 @@ sub do_git_init_db {\n>  \n>  sub init_subdir {\n>  \tmy $repo_path = shift or return;\n> +\tprint \"Creating directory $repo_path\\n\";\n>  \tmkpath([$repo_path]) unless -d $repo_path;\n>  \tchdir $repo_path or die \"Couldn't chdir to $repo_path: $!\\n\";\n\nSince mkpath() isn't guaranteed to get called, maybe putting a\n\n\tprint \"Entering directory $repo_path\\n\"\n\nright before the chdir is better.\n\nThe other option would be to alter git-init to print the absolute path\nof the repository being initialized...\n\n-- \nEric Wong\n"},{"id":"56013","messageId":"87ejfv1g0e.fsf@lysator.liu.se","threadId":"10292","inReplyTo":"20071016093228.GA30503@soma","subject":"Re: [PATCH] Make the output of \"git svn clone\" less confusing.","fromName":"David Kågedal","fromEmail":"davidk@lysator.liu.se","sentAt":"2007-10-16T11:00:01Z","receivedAt":"2007-10-16T11:00:01Z","isPatch":true,"sender":{"key":"davidk@lysator.liu.se","avatar":"https://avatars.githubusercontent.com/u/60530?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n>> diff --git a/git-svn.perl b/git-svn.perl\n>> index 777e436..d4450ca 100755\n>> --- a/git-svn.perl\n>> +++ b/git-svn.perl\n>> @@ -286,6 +286,7 @@ sub do_git_init_db {\n>>  \n>>  sub init_subdir {\n>>  \tmy $repo_path = shift or return;\n>> +\tprint \"Creating directory $repo_path\\n\";\n>>  \tmkpath([$repo_path]) unless -d $repo_path;\n>>  \tchdir $repo_path or die \"Couldn't chdir to $repo_path: $!\\n\";\n>\n> Since mkpath() isn't guaranteed to get called, maybe putting a\n>\n> \tprint \"Entering directory $repo_path\\n\"\n>\n> right before the chdir is better.\n\nYou're probably right.\n\n> The other option would be to alter git-init to print the absolute path\n> of the repository being initialized...\n\nAbsolute paths don't sound like a great idea to me. Ideally, I'd like\nto see the path I gave it, or something relative to the working\ndirectory. That is, *my* working directory, and not some internal one\nbecause one of the tools did a chdir.\n\nCan't we make init_subdir in git-svn not chdir, instead?  Like this,\nhighly untested?\n\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -288,8 +288,7 @@ sub init_subdir {\n \tmy $repo_path = shift or return;\n \tprint \"Creating directory $repo_path\\n\";\n \tmkpath([$repo_path]) unless -d $repo_path;\n-\tchdir $repo_path or die \"Couldn't chdir to $repo_path: $!\\n\";\n-\t$ENV{GIT_DIR} = '.git';\n+\t$ENV{GIT_DIR} = '$repo_path/.git';\n }\n \n sub cmd_clone {\n\n\n-- \nDavid Kågedal\n"},{"id":"56366","messageId":"20071018070617.GA29238@spearce.org","threadId":"10292","inReplyTo":"87k5poflp5.fsf@lysator.liu.se","subject":"Re: [PATCH] Make the output of \"git svn clone\" less confusing.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-18T07:06:17Z","receivedAt":"2007-10-18T07:06:17Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"David Kgedal <davidk@lysator.liu.se> wrote:\n> The problem is that the first thing it prints is\n> \n>   Initialized empty Git repository in .git/\n> \n> even if actually created a subdirectory and changed into it first. But to the\n> user, it looks like it is creating a .git/ dir in the directory he/she is\n> started git from.\n\nEric, ack/nack?\n\n> ---\n>  git-svn.perl |    1 +\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n> \n> This change makes it more chatty, which might not be a good thing. But\n> I think the previous output was worse.\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 777e436..d4450ca 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -286,6 +286,7 @@ sub do_git_init_db {\n>  \n>  sub init_subdir {\n>  \tmy $repo_path = shift or return;\n> +\tprint \"Creating directory $repo_path\\n\";\n>  \tmkpath([$repo_path]) unless -d $repo_path;\n>  \tchdir $repo_path or die \"Couldn't chdir to $repo_path: $!\\n\";\n>  \t$ENV{GIT_DIR} = '.git';\n> -- \n> 1.5.3.4.213.gb3127-dirty\n\n-- \nShawn.\n"},{"id":"56381","messageId":"20071018103301.GA21121@soma","threadId":"10292","inReplyTo":"20071018070617.GA29238@spearce.org","subject":"Re: [PATCH] Make the output of \"git svn clone\" less confusing.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-10-18T10:33:01Z","receivedAt":"2007-10-18T10:33:01Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> David Kågedal <davidk@lysator.liu.se> wrote:\n> > The problem is that the first thing it prints is\n> > \n> >   Initialized empty Git repository in .git/\n> > \n> > even if actually created a subdirectory and changed into it first. But to the\n> > user, it looks like it is creating a .git/ dir in the directory he/she is\n> > started git from.\n> \n> Eric, ack/nack?\n\nNack, here's (hopefully) a better patch.\n\nDavid: agree/disagree?\n\nFrom 62648d512a27a546707da160c939d665e6da57b4 Mon Sep 17 00:00:00 2001\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Thu, 18 Oct 2007 03:29:28 -0700\nSubject: [PATCH] git-svn: make the output of \"git svn clone\" less confusing\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\nOriginal patch by David Kågedal:\n> The problem is that the first thing it prints is\n>\n>   Initialized empty Git repository in .git/\n>\n> even if actually created a subdirectory and changed into it\n> first. But to the user, it looks like it is creating a .git/ dir\n> in the directory he/she is started git from.\n\nInstead of using a relative path, I'm capturing the\noutput of git-init and adding the absolute path to it.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n\n I've actually just noticed that setting GIT_DIR= before running\n git-svn clone is very broken, and I probably won't get a chance\n to fix it for at least 24 hours (if I'm even awake)...\n\n Johannes/Benoit/all: git-svn submodules will probably have to\n wait till the weekend...\n\n git-svn.perl |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 777e436..4873bad 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3,6 +3,7 @@\n # License: GPL v2 or later\n use warnings;\n use strict;\n+use Cwd qw/getcwd/;\n use vars qw/\t$AUTHOR $VERSION\n \t\t$sha1 $sha1_short $_revision\n \t\t$_q $_authors %users/;\n@@ -272,7 +273,9 @@ sub do_git_init_db {\n \t\t\t\tpush @init_db, \"--shared\";\n \t\t\t}\n \t\t}\n-\t\tcommand_noisy(@init_db);\n+\t\tmy $init_out = command(@init_db);\n+\t\t$init_out =~ s!(\\.git)!getcwd .  \"/$1\"!e;\n+\t\tprint $init_out, \"\\n\";\n \t}\n \tmy $set;\n \tmy $pfx = \"svn-remote.$Git::SVN::default_repo_id\";\n-- \nEric Wong\n"},{"id":"56417","messageId":"20071018171443.GA13040@untitled","threadId":"10292","inReplyTo":"87abqgiqsj.fsf@lysator.liu.se","subject":"Re: [PATCH] Make the output of \"git svn clone\" less confusing.","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2007-10-18T17:14:43Z","receivedAt":"2007-10-18T17:14:43Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"David Kågedal <davidk@lysator.liu.se> wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n> \n> > \"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> >> David Kågedal <davidk@lysator.liu.se> wrote:\n> >> > The problem is that the first thing it prints is\n> >> > \n> >> >   Initialized empty Git repository in .git/\n> >> > \n> >> > even if actually created a subdirectory and changed into it first. But to the\n> >> > user, it looks like it is creating a .git/ dir in the directory he/she is\n> >> > started git from.\n> >> \n> >> Eric, ack/nack?\n> >\n> > Nack, here's (hopefully) a better patch.\n> >\n> > David: agree/disagree?\n> \n> I don't really like this. Now you added a dependency on exactly how\n> git-init-db will format its output.  So if e.g. it is updated to use\n> the absolute path your patch will create bogus output.\n\nYes, it's quite ugly :/   I think the best solution would be to fix all\nGIT_DIR= setting issues and getting git-svn to always respect it for\ninit/clone/fetch (and tests, of course!).  I probably won't get around\nto doing any of this until Friday night or Saturday (PST), however...\n\nShawn: feel free to ignore this series for now\n\n> Did you consider my suggestion of not doing the chdir befor running\n> git-init-db?\n\nThat would likely break clone, and also this (from my message\nunder the commit message).\n\n>  I've actually just noticed that setting GIT_DIR= before running\n>  git-svn clone is very broken, and I probably won't get a chance\n>  to fix it for at least 24 hours (if I'm even awake)...\n\n-- \nEric Wong\n"}]}