git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tobias Schulte <tobias.schulte@gliderpilot.de>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-svn: introduce --parents parameter for commands branch and tag
Date: Wed, 15 May 2013 21:51:40 +0200	[thread overview]
Message-ID: <5193E74C.6000705@gliderpilot.de> (raw)
In-Reply-To: <20130515023547.GA21987@dcvr.yhbt.net>

On 15.05.2013 04:35, Eric Wong wrote:
>> +	if (!eval{$ctx->ls($parent, 'HEAD', 0)}) {
>> +		mk_parent_dirs($ctx, $parent);
>> +		print "Creating parent folder ${parent} ...\n";
>> +		$ctx->mkdir($parent)
>> +			unless $_dry_run;
> 
> The newline is confusing, I prefer:
> 
> 		$ctx->mkdir($parent) unless $_dry_run;

In fact, this was a copy/paste from a few lines above

	print "Copying ${src} at r${rev} to ${dst}...\n";
	$ctx->copy($src, $rev, $dst)
		unless $_dry_run;

> Howeve :
> 
> 	if (!$_dry_run) {
> 		$ctx->mkdir($parent);
> 	}
> 
> May be preferred, too (especially for the non-Perl-fluent)

I am a non-Perl-fluent, as I come from the Java world with some
knowledge of C and C++. But to be able to create the patch I had to
gather some Perl knowledge, and by doing this, I learned enough to
understand, that there is more than one way, ... Especially the
constructs if (condition) foo(); vs foo() if (condition); and the same
for unless. And since the dry_run is the exception in this case, I think
unless is a valid choice -- and is used often in git-svn.perl. So I will
stick to it, but remove the newline.

> 
>> +++ b/t/t9167-git-svn-cmd-branch-subproject.sh
> 
>> +test_expect_success 'initialize svnrepo' '
>> +    mkdir import &&
>> +    (
>> +        (cd import &&
>> +        mkdir -p trunk/project branches tags &&
>> +        (cd trunk/project &&
>> +        echo foo > foo
>> +        ) &&
> 
> Tabs for all indentation, and indent consistently for subshells:
> 
> 	mkdir import &&
> 	(
> 		cd import &&
> 		mkdir .. &&
> 		(
> 			cd .. &&
> 			..
> 		)
> 	)
> 
> We use subshells + cd like this so it's easier to read/maintain.

Again, this was a copy/paste from t9128-git-svn-cmd-branch.sh. So this
file needs some cosmetics, too. And t9127... as well...

> 
> Thanks again, looking forward to applying v2.
> 

I will send v2 soon.

Tobias

  reply	other threads:[~2013-05-15 19:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-13 20:22 [PATCH] git-svn: introduce --parents parameter for commands branch and tag Tobias Schulte
2013-05-15  2:35 ` Eric Wong
2013-05-15 19:51   ` Tobias Schulte [this message]
2013-05-15 20:14 ` [PATCH v2] " Tobias Schulte
2013-05-20 22:13   ` Eric Wong
2013-05-20 22:37     ` Junio C Hamano
2013-05-20 22:46       ` Eric Wong
2013-05-20 23:10         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5193E74C.6000705@gliderpilot.de \
    --to=tobias.schulte@gliderpilot.de \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).