summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-11-21 07:44:29 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-11-21 07:44:29 +0000
commit5d8d38aa609bb65c0d29a9c9047b482480043508 (patch)
tree7584306d51c46cfb00216af3a4ec52625ec93e18 /test
parent7048f666199b36266dbc288da3c6ac8220c24b9a (diff)
downloadredmine-5d8d38aa609bb65c0d29a9c9047b482480043508.tar.gz
redmine-5d8d38aa609bb65c0d29a9c9047b482480043508.zip
scm: git: fix changesets aren't read after clear_changesets call (#12409)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10856 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/repository_git_test.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb
index cfb0f486c..fa2f8bce6 100644
--- a/test/unit/repository_git_test.rb
+++ b/test/unit/repository_git_test.rb
@@ -217,6 +217,40 @@ class RepositoryGitTest < ActiveSupport::TestCase
assert_equal h1, h2
end
+ def test_keep_extra_report_last_commit_in_clear_changesets
+ assert_nil @repository.extra_info
+ h = {}
+ h["extra_report_last_commit"] = 1
+ @repository.merge_extra_info(h)
+ @repository.save
+ @project.reload
+
+ assert_equal 0, @repository.changesets.count
+ @repository.fetch_changesets
+ @project.reload
+
+ assert_equal NUM_REV, @repository.changesets.count
+ @repository.send(:clear_changesets)
+ assert_equal 1, @repository.extra_info.size
+ assert_equal 1, @repository.extra_info["extra_report_last_commit"]
+ end
+
+ def test_refetch_after_clear_changesets
+ assert_nil @repository.extra_info
+ assert_equal 0, @repository.changesets.count
+ @repository.fetch_changesets
+ @project.reload
+ assert_equal NUM_REV, @repository.changesets.count
+
+ @repository.send(:clear_changesets)
+ @project.reload
+ assert_equal 0, @repository.changesets.count
+
+ @repository.fetch_changesets
+ @project.reload
+ assert_equal NUM_REV, @repository.changesets.count
+ end
+
def test_parents
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets