From 274d3476320aebc93ead7c5da4f716a12d43167f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 May 2021 17:49:43 +0000 Subject: lei rediff: capture and regenerate file modes Don't lose file mode information when regenerating a diff. --- t/solve/bare.patch | 8 ++++++++ t/solver_git.t | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 t/solve/bare.patch (limited to 't') diff --git a/t/solve/bare.patch b/t/solve/bare.patch new file mode 100644 index 00000000..25d7f344 --- /dev/null +++ b/t/solve/bare.patch @@ -0,0 +1,8 @@ +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 +@@ -4 +3,0 @@ +-# Basic tool to create a Xapian search index for a public-inbox. diff --git a/t/solver_git.t b/t/solver_git.t index 44cbbfdb..ad0c295b 100644 --- a/t/solver_git.t +++ b/t/solver_git.t @@ -73,6 +73,19 @@ 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 { -- cgit v1.2.3-24-ge0c7