X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fsolver_git.t;h=ad0c295b5526dcf24e2ff62b9fdbdd6f78755e42;hb=274d3476320aebc93ead7c5da4f716a12d43167f;hp=75387b2a2e913b351f1a5c747ff2fb8bedd3eb65;hpb=64886302aea5b329a1ec0227d209c14b4a5dda96;p=public-inbox.git diff --git a/t/solver_git.t b/t/solver_git.t index 75387b2a..ad0c295b 100644 --- a/t/solver_git.t +++ b/t/solver_git.t @@ -27,12 +27,17 @@ 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'; my $non_existent = 'ee5e32211bf62ab6531bdf39b84b6920d0b6775a'; -test_lei({tmpdir => $tmpdir}, sub { +test_lei({tmpdir => "$tmpdir/blob"}, sub { lei_ok('blob', '--mail', $patch2_oid, '-I', $ibx->{inboxdir}, \'--mail works for existing oid'); is($lei_out, $patch2->as_string, 'blob matches'); @@ -64,6 +69,30 @@ test_lei({tmpdir => $tmpdir}, sub { lei_ok('blob', $v1_0_0_tag_short, '-I', $ibx->{inboxdir}); }); +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); $ibx->{-repo_objs} = [ $git ]; my $res;