public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt•net>
To: Alfred Perlstein <alfred@freebsd•org>
Cc: git@vger•kernel.org, Jonathan Nieder <jrnieder@gmail•com>,
	Junio C Hamano <gitster@pobox•com>,
	"Michael G. Schwern" <schwern@pobox•com>,
	David Fraser <davidf@sjsoft•com>
Subject: Re: [PATCH] git-svn: Support for git-svn propset
Date: Mon, 8 Dec 2014 21:36:36 +0000	[thread overview]
Message-ID: <20141208213636.GA3743@dcvr.yhbt.net> (raw)
In-Reply-To: <20141207104723.GB54199@elvis.mu.org>

Alfred Perlstein <alfred@freebsd•org> wrote:
> Appearing here:
>   http://marc.info/?l=git&m=125259772625008&w=2

Probably better to use a mid URL here, too

http://mid.gmane.org/1927112650.1281253084529659.JavaMail.root@klofta.sjsoft.com

such a long URL, though...

> --- a/perl/Git/SVN/Editor.pm
> +++ b/perl/Git/SVN/Editor.pm
> @@ -288,6 +288,44 @@ sub apply_autoprops {
>  	}
>  }
>  
> +sub check_attr {
> +	my ($attr,$path) = @_;
> +	my $fh = command_output_pipe("check-attr", $attr, "--", $path);
> +	return undef if (!$fh);
> +
> +	my $val = <$fh>;
> +	close $fh;
> +	if ($val) { $val =~ s/^[^:]*:\s*[^:]*:\s*(.*)\s*$/$1/; }
> +	return $val;
> +}

I just noticed command_output_pipe didn't use a corresponding
command_close_pipe to check for errors, but command_oneline is even
better.  I'll squash the following:

--- a/perl/Git/SVN/Editor.pm
+++ b/perl/Git/SVN/Editor.pm
@@ -290,11 +290,7 @@ sub apply_autoprops {
 
 sub check_attr {
 	my ($attr,$path) = @_;
-	my $fh = command_output_pipe("check-attr", $attr, "--", $path);
-	return undef if (!$fh);
-
-	my $val = <$fh>;
-	close $fh;
+	my $val = command_oneline("check-attr", $attr, "--", $path);
 	if ($val) { $val =~ s/^[^:]*:\s*[^:]*:\s*(.*)\s*$/$1/; }
 	return $val;
 }

In your test, "local" isn't portable, unfortunately, but tests seem to
work fine without local so I've removed them:

--- a/t/t9148-git-svn-propset.sh
+++ b/t/t9148-git-svn-propset.sh
@@ -29,10 +29,9 @@ test_expect_success 'fetch revisions from svn' '
 	git svn fetch
 	'
 
-set_props()
-{
-	local subdir="$1"
-	local file="$2"
+set_props () {
+	subdir="$1"
+	file="$2"
 	shift;shift;
 	(cd "$subdir" &&
 		while [ $# -gt 0 ] ; do
@@ -43,10 +42,9 @@ set_props()
 		git commit -m "testing propset" "$file")
 }
 
-confirm_props()
-{
-	local subdir="$1"
-	local file="$2"
+confirm_props () {
+	subdir="$1"
+	file="$2"
 	shift;shift;
 	(set -e ; cd "svn_project/$subdir" &&
 		while [ $# -gt 0 ] ; do

Unless there's other improvements we missed, I'll push out your v3 with
my changes squashed in for Junio to pull in a day or two.  Thank you
again for working on this!

  reply	other threads:[~2014-12-08 21:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-07 10:47 [PATCH] git-svn: Support for git-svn propset Alfred Perlstein
2014-12-08 21:36 ` Eric Wong [this message]
2014-12-08 23:43   ` Alfred Perlstein
  -- strict thread matches above, loose matches on Subject: below --
2014-12-06 22:29 Alfred Perlstein
2014-12-07  5:42 ` Eric Wong
2014-12-07  9:52   ` Alfred Perlstein
2014-12-07  5:45 ` Torsten Bögershausen
2014-12-07  8:00   ` Torsten Bögershausen
2014-12-07  9:23     ` Eric Sunshine
2014-12-01  6:24 Alfred Perlstein
2014-12-01  9:49 ` Eric Wong

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=20141208213636.GA3743@dcvr.yhbt.net \
    --to=normalperson@yhbt$(echo .)net \
    --cc=alfred@freebsd$(echo .)org \
    --cc=davidf@sjsoft$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=jrnieder@gmail$(echo .)com \
    --cc=schwern@pobox$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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