gitlab_git 7.1.13 → 7.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/gitlab_git/blob.rb +45 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9e1f777c21710d108e09c07e7b6598e1902173c
4
- data.tar.gz: c6244528159758470b887b6d7f715fe30d20bec2
3
+ metadata.gz: 364b0b25711ddfd083fcd21d9d69a6ca06d056a9
4
+ data.tar.gz: 1142f7c28fab2fb5bb14e0c44d7eb17c4e318d55
5
5
  SHA512:
6
- metadata.gz: 8bc7976fc0a7c56dec4436b131dbfec37f656456d56d3635913d0a0a053fb31d7af6916a314cb0f5f052ba9e294cfce6d11631826bb8d1c1931d2ab80de09167
7
- data.tar.gz: ffcb0c325ad437b20474293e4aa07e8ccf9f9e13bb095d21e91bc7d52a406a7564ad9b87cb160f6409c8c72c4cce503513c6a4573e6123f94685836f321a586f
6
+ metadata.gz: 189362edbcfdc6f4a474c74a126bfe0e60c23b9e7f133b5849377625683f3022b49b3f73a1f8924c414d2964a41e07c5cc2ad2cf433dab6ebd7bab4a54438ae3
7
+ data.tar.gz: 419dc4f8e1b4523d9f583d8ef5ce63ce75de0af3af953360dfb5eafd9d968eb7f388a9dbc2f306ab29136bf992940d9e2424f180d17e945b6fcb93c2834fd7e0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.1.13
1
+ 7.2.0
@@ -83,6 +83,51 @@ module Gitlab
83
83
  commit_id: sha,
84
84
  )
85
85
  end
86
+
87
+ # Commit file in repository and return commit sha
88
+ #
89
+ # options should contain next structure:
90
+ # file: {
91
+ # content: 'Lorem ipsum...',
92
+ # path: 'documents/story.txt'
93
+ # },
94
+ # author: {
95
+ # email: 'user@example.com',
96
+ # name: 'Test User',
97
+ # time: Time.now
98
+ # },
99
+ # committer: {
100
+ # email: 'user@example.com',
101
+ # name: 'Test User',
102
+ # time: Time.now
103
+ # },
104
+ # commit: {
105
+ # message: 'Wow such commit',
106
+ # branch: 'master'
107
+ # }
108
+ #
109
+ def commit(repository, options)
110
+ file = options[:file]
111
+ author = options[:author]
112
+ committer = options[:committer]
113
+ commit = options[:commit]
114
+ repo = repository.rugged
115
+
116
+ oid = repo.write(file[:content], :blob)
117
+ index = repo.index
118
+ index.read_tree(repo.head.target.tree)
119
+ index.add(path: file[:path], oid: oid, mode: 0100644)
120
+
121
+ opts = {}
122
+ opts[:tree] = index.write_tree(repo)
123
+ opts[:author] = author
124
+ opts[:committer] = committer
125
+ opts[:message] = commit[:message]
126
+ opts[:parents] = repo.empty? ? [] : [ repo.head.target ].compact
127
+ opts[:update_ref] = 'refs/heads/' + commit[:branch]
128
+
129
+ Rugged::Commit.create(repo, opts)
130
+ end
86
131
  end
87
132
 
88
133
  def initialize(options)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab_git
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.13
4
+ version: 7.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Zaporozhets
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-19 00:00:00.000000000 Z
11
+ date: 2015-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab-linguist