diff options
author | Go MAEDA <maeda@farend.jp> | 2018-04-27 09:14:36 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2018-04-27 09:14:36 +0000 |
commit | b1781507617d9386c8545a28941fac163afd50fa (patch) | |
tree | b3d2d5ef8fb427b99f50861bb092363fc78ee24f /test/unit/lib | |
parent | 087067678eef6655fac3a33e0fa695f69915acc2 (diff) | |
download | redmine-b1781507617d9386c8545a28941fac163afd50fa.tar.gz redmine-b1781507617d9386c8545a28941fac163afd50fa.zip |
Show renames in diff preview (#28295).
Patch by Gregor Schmidt.
git-svn-id: http://svn.redmine.org/redmine/trunk@17313 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/lib')
-rw-r--r-- | test/unit/lib/redmine/unified_diff_test.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/unified_diff_test.rb b/test/unit/lib/redmine/unified_diff_test.rb index eb373abe6..0a09a0fb4 100644 --- a/test/unit/lib/redmine/unified_diff_test.rb +++ b/test/unit/lib/redmine/unified_diff_test.rb @@ -189,6 +189,56 @@ DIFF assert_equal "test1.txt", diff[0].file_name end + def test_previous_file_name_with_git + diff = Redmine::UnifiedDiff.new(<<-DIFF) +From 585da9683fb5ed7bf7cb438492e3347cdf3d83df Mon Sep 17 00:00:00 2001 +From: Gregor Schmidt <schmidt@nach-vorne.eu> +Date: Mon, 5 Mar 2018 14:12:13 +0100 +Subject: [PATCH] changes including a rename, rename+modify and addition + +--- + one.markdown => one.md | 0 + three.md | 2 ++ + two.markdown => two.md | 1 + + 3 files changed, 3 insertions(+) + rename one.markdown => one.md (100%) + create mode 100644 three.md + rename two.markdown => two.md (50%) + +diff --git a/one.markdown b/one.md +similarity index 100% +rename from one.markdown +rename to one.md +diff --git a/three.md b/three.md +new file mode 100644 +index 0000000..288012f +--- /dev/null ++++ b/three.md +@@ -0,0 +1,2 @@ ++three ++===== +diff --git a/two.markdown b/two.md +similarity index 50% +rename from two.markdown +rename to two.md +index f719efd..6a268ed 100644 +--- a/two.markdown ++++ b/two.md +@@ -1 +1,2 @@ + two ++=== +-- +2.14.1 +DIFF + + assert_equal 2, diff.size + assert_equal "three.md", diff[0].file_name + assert_nil diff[0].previous_file_name + + assert_equal "two.md", diff[1].file_name + assert_equal "two.markdown", diff[1].previous_file_name + end + def test_include_a_b_slash diff = Redmine::UnifiedDiff.new(<<-DIFF --- test1.txt |