diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-12 20:28:21 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-12 20:28:21 +0000 |
commit | b956605f9e5f95ded853d3458f0f132dbb5b892a (patch) | |
tree | dd1596c99ab5766e8749f45acb1e5a0d22e1a4d1 /spec/support/mentionable_shared_examples.rb | |
parent | 66dd61ef0f1f98f860bdef5aa2cdb1c6f2e1f83f (diff) | |
parent | b02c21df5cc0dcc795f71f8c11d05d61dc2ad897 (diff) | |
download | gitlab-ce-fondev.tar.gz |
Merge branch 'ambiguous-sha' into 'master'fondev
Fix ambiguous sha problem with mentioned commit
Before: write in database only 6 chars of commit sha. This cause to `Ambiguous SHA1 prefix` exception.
- [x] write full commit sha in db.
- [x] Standardise usage of sha truncation: 8 characters everywhere.
- [x] prevent exception when ambiguous sha requested in markdown
Fixes #1644
See merge request !1171
Diffstat (limited to 'spec/support/mentionable_shared_examples.rb')
-rw-r--r-- | spec/support/mentionable_shared_examples.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/support/mentionable_shared_examples.rb b/spec/support/mentionable_shared_examples.rb index 692834c9f29..ebd74206699 100644 --- a/spec/support/mentionable_shared_examples.rb +++ b/spec/support/mentionable_shared_examples.rb @@ -30,15 +30,15 @@ def common_mentionable_setup "!#{mentioned_mr.iid}, " + "#{ext_proj.path_with_namespace}##{ext_issue.iid}, " + "#{ext_proj.path_with_namespace}!#{ext_mr.iid}, " + - "#{ext_proj.path_with_namespace}@#{ext_commit.id[0..5]}, " + - "#{mentioned_commit.sha[0..5]} and itself as #{backref_text}" + "#{ext_proj.path_with_namespace}@#{ext_commit.short_id}, " + + "#{mentioned_commit.sha[0..10]} and itself as #{backref_text}" end before do # Wire the project's repository to return the mentioned commit, and +nil+ for any # unrecognized commits. - commitmap = { '123456' => mentioned_commit } - extra_commits.each { |c| commitmap[c.sha[0..5]] = c } + commitmap = { '1234567890a' => mentioned_commit } + extra_commits.each { |c| commitmap[c.short_id] = c } mproject.repository.stub(:commit) { |sha| commitmap[sha] } set_mentionable_text.call(ref_string) end @@ -54,7 +54,6 @@ shared_examples 'a mentionable' do it "extracts references from its reference property" do # De-duplicate and omit itself refs = subject.references(mproject) - refs.should have(6).items refs.should include(mentioned_issue) refs.should include(mentioned_mr) @@ -90,7 +89,7 @@ shared_examples 'an editable mentionable' do it 'creates new cross-reference notes when the mentionable text is edited' do new_text = "still mentions ##{mentioned_issue.iid}, " + - "#{mentioned_commit.sha[0..5]}, " + + "#{mentioned_commit.sha[0..10]}, " + "#{ext_issue.iid}, " + "new refs: ##{other_issue.iid}, " + "#{ext_proj.path_with_namespace}##{other_ext_issue.iid}" |