gitlab_git 7.2.1 → 7.2.2

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 +43 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fae0b1341f604f59f18a7fb8a8d256e123fb5409
4
- data.tar.gz: 78734448bfa9189d3b3aaee517cec75fee280002
3
+ metadata.gz: a79a788ed1b01dd6745f14f8b4bdd751cbb81f4c
4
+ data.tar.gz: d3c8736e04433cd4e2631de49b74600e098a551e
5
5
  SHA512:
6
- metadata.gz: c3856125002df53a5224b06e08cbb4cc2588c5f9b36376a55cfc06b5a5943540f02141485744d5ce2cec3578150e1f337ad716ba6b213737fe8389f297f4d913
7
- data.tar.gz: d0c404bc3c75008d6850ad16607589080296ca43db9d6418394cf988ebcb8eba1fcc27958e2ca5efe4e586774e73a339d4bec1b6f7aa893a2fe01b09c9384e9c
6
+ metadata.gz: 7dd22814ea99a800d59f262c561b38bff37ff9955dfc331ecb7e6acf333ddf5cada2335cf94cf09ce32917b88eefb4962073e1de41b6b2a4c9e71c907bc8f4b6
7
+ data.tar.gz: abcb49969f9cdba0a25ee9b8014ccf2376517b451fb12acad28602449b97c47cb98515ee9e5ca87892fdcddba1a646efede07c375757d54fd6e39414bd338d33
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.2.1
1
+ 7.2.2
@@ -128,6 +128,49 @@ module Gitlab
128
128
 
129
129
  Rugged::Commit.create(repo, opts)
130
130
  end
131
+
132
+ # Remove file from repository and return commit sha
133
+ #
134
+ # options should contain next structure:
135
+ # file: {
136
+ # path: 'documents/story.txt'
137
+ # },
138
+ # author: {
139
+ # email: 'user@example.com',
140
+ # name: 'Test User',
141
+ # time: Time.now
142
+ # },
143
+ # committer: {
144
+ # email: 'user@example.com',
145
+ # name: 'Test User',
146
+ # time: Time.now
147
+ # },
148
+ # commit: {
149
+ # message: 'Remove FILENAME',
150
+ # branch: 'master'
151
+ # }
152
+ #
153
+ def remove(repository, options)
154
+ file = options[:file]
155
+ author = options[:author]
156
+ committer = options[:committer]
157
+ commit = options[:commit]
158
+ repo = repository.rugged
159
+
160
+ index = repo.index
161
+ index.read_tree(repo.head.target.tree) unless repo.empty?
162
+ index.remove(file[:path])
163
+
164
+ opts = {}
165
+ opts[:tree] = index.write_tree(repo)
166
+ opts[:author] = author
167
+ opts[:committer] = committer
168
+ opts[:message] = commit[:message]
169
+ opts[:parents] = repo.empty? ? [] : [ repo.head.target ].compact
170
+ opts[:update_ref] = 'refs/heads/' + commit[:branch]
171
+
172
+ Rugged::Commit.create(repo, opts)
173
+ end
131
174
  end
132
175
 
133
176
  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.2.1
4
+ version: 7.2.2
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-06-01 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab-linguist