diff options
author | Markus Koller <mkoller@gitlab.com> | 2019-06-13 12:44:41 +0200 |
---|---|---|
committer | Markus Koller <mkoller@gitlab.com> | 2019-07-18 09:19:18 +0200 |
commit | f8cecafb07792bcaf9d7ffa85766c3b33c1dd252 (patch) | |
tree | abafa6e9dbbb602f61b83abff508acbae074ceee /spec/lib | |
parent | b921b2d1fb0c1cb3e6d4f3c88806855b48827855 (diff) | |
download | gitlab-ce-f8cecafb07792bcaf9d7ffa85766c3b33c1dd252.tar.gz |
Add start_sha to commits API
When passing start_branch on committing from the WebIDE, it's possible
that the branch has changed since editing started, which results in the
change being applied on top of the latest commit in the branch and
overwriting the new changes.
By passing the start_sha instead we can make sure that the change is
applied on top of the commit which the user started editing from.
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/git_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git_spec.rb b/spec/lib/gitlab/git_spec.rb index ce15057dd7d..6515be85ae3 100644 --- a/spec/lib/gitlab/git_spec.rb +++ b/spec/lib/gitlab/git_spec.rb @@ -39,6 +39,26 @@ describe Gitlab::Git do end end + describe '.commit_id?' do + using RSpec::Parameterized::TableSyntax + + where(:sha, :result) do + '' | false + 'foobar' | false + '4b825dc' | false + 'zzz25dc642cb6eb9a060e54bf8d69288fbee4904' | false + + '4b825dc642cb6eb9a060e54bf8d69288fbee4904' | true + Gitlab::Git::BLANK_SHA | true + end + + with_them do + it 'returns the expected result' do + expect(described_class.commit_id?(sha)).to eq(result) + end + end + end + describe '.shas_eql?' do using RSpec::Parameterized::TableSyntax |