git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-svn: Support for git-svn propset

From
APAlfred Perlstein <bright@mu.org>
Date
Dec 8, 2014, 23:43 UTC
Message-ID
<04BE232D-0198-4DEA-90ED-8C8E36456CC5@mu.org>
In-Reply-To
<20141208213636.GA3743@dcvr.yhbt.net>
Show 87 quoted lines
> On Dec 8, 2014, at 1:36 PM, Eric Wong <normalperson@yhbt.net> wrote:
> 
> 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!
> 
Eric,
All looks good to me. 
Thank you all very much for the feedback and help.  It's made this a very rewarding endeavor. 
-Alfred. 
Previous: Eric Wong
Message 3 of 3 in “git-svn: Support for git-svn propset”
  1. git-svn: Support for git-svn propsetAlfred Perlstein, Dec 7, 2014
  2. Eric WongDec 8, 2014
  3. Alfred PerlsteinDec 8, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.