git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Make the output of "git svn clone" less confusing.
@ 2007-10-15 15:21 David Kågedal
  2007-10-16  9:32 ` Eric Wong
  2007-10-18  7:06 ` Shawn O. Pearce
  0 siblings, 2 replies; 6+ messages in thread
From: David Kågedal @ 2007-10-15 15:21 UTC (permalink / raw)
  To: git

The problem is that the first thing it prints is

  Initialized empty Git repository in .git/

even if actually created a subdirectory and changed into it first. But to the
user, it looks like it is creating a .git/ dir in the directory he/she is
started git from.
---
 git-svn.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

This change makes it more chatty, which might not be a good thing. But
I think the previous output was worse.

diff --git a/git-svn.perl b/git-svn.perl
index 777e436..d4450ca 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -286,6 +286,7 @@ sub do_git_init_db {
 
 sub init_subdir {
 	my $repo_path = shift or return;
+	print "Creating directory $repo_path\n";
 	mkpath([$repo_path]) unless -d $repo_path;
 	chdir $repo_path or die "Couldn't chdir to $repo_path: $!\n";
 	$ENV{GIT_DIR} = '.git';
-- 
1.5.3.4.213.gb3127-dirty

-- 
David Kågedal

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make the output of "git svn clone" less confusing.
  2007-10-15 15:21 [PATCH] Make the output of "git svn clone" less confusing David Kågedal
@ 2007-10-16  9:32 ` Eric Wong
  2007-10-16 11:00   ` David Kågedal
  2007-10-18  7:06 ` Shawn O. Pearce
  1 sibling, 1 reply; 6+ messages in thread
From: Eric Wong @ 2007-10-16  9:32 UTC (permalink / raw)
  To: David Kågedal; +Cc: git

David Kågedal <davidk@lysator.liu.se> wrote:
> The problem is that the first thing it prints is
> 
>   Initialized empty Git repository in .git/
> 
> even if actually created a subdirectory and changed into it first. But to the
> user, it looks like it is creating a .git/ dir in the directory he/she is
> started git from.

Thanks for bringing it up I just noticed this the other day myself and
thought it might be confusing.

> ---
>  git-svn.perl |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> This change makes it more chatty, which might not be a good thing. But
> I think the previous output was worse.
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index 777e436..d4450ca 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -286,6 +286,7 @@ sub do_git_init_db {
>  
>  sub init_subdir {
>  	my $repo_path = shift or return;
> +	print "Creating directory $repo_path\n";
>  	mkpath([$repo_path]) unless -d $repo_path;
>  	chdir $repo_path or die "Couldn't chdir to $repo_path: $!\n";

Since mkpath() isn't guaranteed to get called, maybe putting a

	print "Entering directory $repo_path\n"

right before the chdir is better.

The other option would be to alter git-init to print the absolute path
of the repository being initialized...

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make the output of "git svn clone" less confusing.
  2007-10-16  9:32 ` Eric Wong
@ 2007-10-16 11:00   ` David Kågedal
  0 siblings, 0 replies; 6+ messages in thread
From: David Kågedal @ 2007-10-16 11:00 UTC (permalink / raw)
  To: Eric Wong; +Cc: git

Eric Wong <normalperson@yhbt.net> writes:

>> diff --git a/git-svn.perl b/git-svn.perl
>> index 777e436..d4450ca 100755
>> --- a/git-svn.perl
>> +++ b/git-svn.perl
>> @@ -286,6 +286,7 @@ sub do_git_init_db {
>>  
>>  sub init_subdir {
>>  	my $repo_path = shift or return;
>> +	print "Creating directory $repo_path\n";
>>  	mkpath([$repo_path]) unless -d $repo_path;
>>  	chdir $repo_path or die "Couldn't chdir to $repo_path: $!\n";
>
> Since mkpath() isn't guaranteed to get called, maybe putting a
>
> 	print "Entering directory $repo_path\n"
>
> right before the chdir is better.

You're probably right.

> The other option would be to alter git-init to print the absolute path
> of the repository being initialized...

Absolute paths don't sound like a great idea to me. Ideally, I'd like
to see the path I gave it, or something relative to the working
directory. That is, *my* working directory, and not some internal one
because one of the tools did a chdir.

Can't we make init_subdir in git-svn not chdir, instead?  Like this,
highly untested?

--- a/git-svn.perl
+++ b/git-svn.perl
@@ -288,8 +288,7 @@ sub init_subdir {
 	my $repo_path = shift or return;
 	print "Creating directory $repo_path\n";
 	mkpath([$repo_path]) unless -d $repo_path;
-	chdir $repo_path or die "Couldn't chdir to $repo_path: $!\n";
-	$ENV{GIT_DIR} = '.git';
+	$ENV{GIT_DIR} = '$repo_path/.git';
 }
 
 sub cmd_clone {


-- 
David Kågedal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make the output of "git svn clone" less confusing.
  2007-10-15 15:21 [PATCH] Make the output of "git svn clone" less confusing David Kågedal
  2007-10-16  9:32 ` Eric Wong
@ 2007-10-18  7:06 ` Shawn O. Pearce
  2007-10-18 10:33   ` Eric Wong
  1 sibling, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2007-10-18  7:06 UTC (permalink / raw)
  To: Eric Wong; +Cc: David Kågedal, git

David Kgedal <davidk@lysator.liu.se> wrote:
> The problem is that the first thing it prints is
> 
>   Initialized empty Git repository in .git/
> 
> even if actually created a subdirectory and changed into it first. But to the
> user, it looks like it is creating a .git/ dir in the directory he/she is
> started git from.

Eric, ack/nack?

> ---
>  git-svn.perl |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> This change makes it more chatty, which might not be a good thing. But
> I think the previous output was worse.
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index 777e436..d4450ca 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -286,6 +286,7 @@ sub do_git_init_db {
>  
>  sub init_subdir {
>  	my $repo_path = shift or return;
> +	print "Creating directory $repo_path\n";
>  	mkpath([$repo_path]) unless -d $repo_path;
>  	chdir $repo_path or die "Couldn't chdir to $repo_path: $!\n";
>  	$ENV{GIT_DIR} = '.git';
> -- 
> 1.5.3.4.213.gb3127-dirty

-- 
Shawn.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make the output of "git svn clone" less confusing.
  2007-10-18  7:06 ` Shawn O. Pearce
@ 2007-10-18 10:33   ` Eric Wong
       [not found]     ` <87abqgiqsj.fsf@lysator.liu.se>
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Wong @ 2007-10-18 10:33 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: David Kågedal, git

"Shawn O. Pearce" <spearce@spearce.org> wrote:
> David Kågedal <davidk@lysator.liu.se> wrote:
> > The problem is that the first thing it prints is
> > 
> >   Initialized empty Git repository in .git/
> > 
> > even if actually created a subdirectory and changed into it first. But to the
> > user, it looks like it is creating a .git/ dir in the directory he/she is
> > started git from.
> 
> Eric, ack/nack?

Nack, here's (hopefully) a better patch.

David: agree/disagree?

From 62648d512a27a546707da160c939d665e6da57b4 Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Thu, 18 Oct 2007 03:29:28 -0700
Subject: [PATCH] git-svn: make the output of "git svn clone" less confusing
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Original patch by David Kågedal:
> The problem is that the first thing it prints is
>
>   Initialized empty Git repository in .git/
>
> even if actually created a subdirectory and changed into it
> first. But to the user, it looks like it is creating a .git/ dir
> in the directory he/she is started git from.

Instead of using a relative path, I'm capturing the
output of git-init and adding the absolute path to it.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---

 I've actually just noticed that setting GIT_DIR= before running
 git-svn clone is very broken, and I probably won't get a chance
 to fix it for at least 24 hours (if I'm even awake)...

 Johannes/Benoit/all: git-svn submodules will probably have to
 wait till the weekend...

 git-svn.perl |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 777e436..4873bad 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3,6 +3,7 @@
 # License: GPL v2 or later
 use warnings;
 use strict;
+use Cwd qw/getcwd/;
 use vars qw/	$AUTHOR $VERSION
 		$sha1 $sha1_short $_revision
 		$_q $_authors %users/;
@@ -272,7 +273,9 @@ sub do_git_init_db {
 				push @init_db, "--shared";
 			}
 		}
-		command_noisy(@init_db);
+		my $init_out = command(@init_db);
+		$init_out =~ s!(\.git)!getcwd .  "/$1"!e;
+		print $init_out, "\n";
 	}
 	my $set;
 	my $pfx = "svn-remote.$Git::SVN::default_repo_id";
-- 
Eric Wong

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make the output of "git svn clone" less confusing.
       [not found]     ` <87abqgiqsj.fsf@lysator.liu.se>
@ 2007-10-18 17:14       ` Eric Wong
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2007-10-18 17:14 UTC (permalink / raw)
  To: David Kågedal; +Cc: Shawn O.Pearce, git

David Kågedal <davidk@lysator.liu.se> wrote:
> Eric Wong <normalperson@yhbt.net> writes:
> 
> > "Shawn O. Pearce" <spearce@spearce.org> wrote:
> >> David Kågedal <davidk@lysator.liu.se> wrote:
> >> > The problem is that the first thing it prints is
> >> > 
> >> >   Initialized empty Git repository in .git/
> >> > 
> >> > even if actually created a subdirectory and changed into it first. But to the
> >> > user, it looks like it is creating a .git/ dir in the directory he/she is
> >> > started git from.
> >> 
> >> Eric, ack/nack?
> >
> > Nack, here's (hopefully) a better patch.
> >
> > David: agree/disagree?
> 
> I don't really like this. Now you added a dependency on exactly how
> git-init-db will format its output.  So if e.g. it is updated to use
> the absolute path your patch will create bogus output.

Yes, it's quite ugly :/   I think the best solution would be to fix all
GIT_DIR= setting issues and getting git-svn to always respect it for
init/clone/fetch (and tests, of course!).  I probably won't get around
to doing any of this until Friday night or Saturday (PST), however...

Shawn: feel free to ignore this series for now

> Did you consider my suggestion of not doing the chdir befor running
> git-init-db?

That would likely break clone, and also this (from my message
under the commit message).

>  I've actually just noticed that setting GIT_DIR= before running
>  git-svn clone is very broken, and I probably won't get a chance
>  to fix it for at least 24 hours (if I'm even awake)...

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-10-18 17:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-15 15:21 [PATCH] Make the output of "git svn clone" less confusing David Kågedal
2007-10-16  9:32 ` Eric Wong
2007-10-16 11:00   ` David Kågedal
2007-10-18  7:06 ` Shawn O. Pearce
2007-10-18 10:33   ` Eric Wong
     [not found]     ` <87abqgiqsj.fsf@lysator.liu.se>
2007-10-18 17:14       ` Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).