Code

git-svn: set auto_props when renaming files
authorPaul Talacko <gnuruandstuff@yahoo.co.uk>
Sun, 7 Sep 2008 01:50:38 +0000 (18:50 -0700)
committerEric Wong <normalperson@yhbt.net>
Sun, 7 Sep 2008 01:58:59 +0000 (18:58 -0700)
Patch-by: Paul Talacko <gnuruandstuff@yahoo.co.uk>:
<http://article.gmane.org/gmane.comp.version-control.git/95006>
> Hello,
>
> There's an issue in git-svn as autoprops are not applied to
> renamed files, only to added files.
>
> This patch fixes the bug.

[ew: added test case]
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn.perl
t/t9124-git-svn-dcommit-auto-props.sh

index 2cc64876b236835b30156e502a300d20107db7fa..ee3f5edb60c756ba82e92389b9f77aae00c6768b 100755 (executable)
@@ -3657,6 +3657,7 @@ sub R {
        my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
                                $self->url_path($m->{file_a}), $self->{r});
        print "\tR\t$m->{file_a} => $m->{file_b}\n" unless $::_q;
+       $self->apply_autoprops($file, $fbat);
        $self->chg_file($fbat, $m);
        $self->close_file($fbat,undef,$self->{pool});
 
index 54276bf115222dca76d3879858db8bafe0618cdf..31193a382a728d39fbfd264593e22eb3fd2a27e1 100755 (executable)
@@ -81,4 +81,21 @@ test_expect_success 'check resulting svn repository' '
 )
 '
 
+test_expect_success 'check renamed file' '
+       test -d user &&
+       generate_auto_props yes > user/config &&
+       git mv foo foo.sh &&
+       git commit -m "foo => foo.sh" &&
+       git svn dcommit --config-dir=user &&
+       (
+               cd work/svnrepo &&
+               svn up &&
+               test ! -e foo &&
+               test -e foo.sh &&
+               test "x$(svn propget svn:mime-type foo.sh)" = \
+                    "xapplication/x-shellscript" &&
+               test "x$(svn propget svn:eol-style foo.sh)" = "xLF"
+       )
+'
+
 test_done