]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/solver_git.t
lei rediff: capture and regenerate file modes
[public-inbox.git] / t / solver_git.t
index e566efb31674f444fa44698554057922a696127b..ad0c295b5526dcf24e2ff62b9fdbdd6f78755e42 100644 (file)
@@ -27,6 +27,11 @@ my $ibx = create_inbox 'v2', version => 2,
        $im->add(eml_load 't/solve/0001-simple-mod.patch') or BAIL_OUT;
        $im->add($patch2) or BAIL_OUT;
 };
+my $md = "$tmpdir/md";
+File::Path::mkpath([map { $md.$_ } (qw(/ /cur /new /tmp))]);
+symlink(abs_path('t/solve/0001-simple-mod.patch'), "$md/cur/foo:2,") or
+       xbail "symlink: $!";
+
 my $v1_0_0_tag = 'cb7c42b1e15577ed2215356a2bf925aef59cdd8d';
 my $v1_0_0_tag_short = substr($v1_0_0_tag, 0, 16);
 my $expect = '69df7d565d49fbaaeb0a067910f03dc22cd52bd0';
@@ -68,6 +73,24 @@ test_lei({tmpdir => "$tmpdir/rediff"}, sub {
        lei_ok(qw(rediff -q -U9 t/solve/0001-simple-mod.patch));
        like($lei_out, qr!^\Q+++\E b/TODO\n@@ -103,9 \+103,11 @@!sm,
                'got more context with -U9');
+       lei_ok(qw(rediff -q -U9 t/solve/bare.patch));
+       my $exp = <<'EOM';
+diff --git a/script/public-inbox-extindex b/script/public-inbox-extindex
+old mode 100644
+new mode 100755
+index 15ac20eb..771486c4
+--- a/script/public-inbox-extindex
++++ b/script/public-inbox-extindex
+@@ -1,13 +1,12 @@
+ #!perl -w
+EOM
+       ok(index($lei_out, $exp) >= 0,
+               'preserve mode, regen header + context from -U0 patch');
+});
+
+test_lei({tmpdir => "$tmpdir/index-eml-only"}, sub {
+       lei_ok(qw(index), $md);
+       lei_ok(qw(blob 69df7d5)); # hits LeiSearch->smsg_eml -> lms->local_blob
 });
 
 my $git = PublicInbox::Git->new($git_dir);