gitlab_git 7.2.2 → 7.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/gitlab_git/blob.rb +19 -25
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a79a788ed1b01dd6745f14f8b4bdd751cbb81f4c
4
- data.tar.gz: d3c8736e04433cd4e2631de49b74600e098a551e
3
+ metadata.gz: 7ad3eba0dfcc190e467ced575b45ff76ecda8341
4
+ data.tar.gz: d84427c2959020528eb4e95ddb0ce0695233fdf8
5
5
  SHA512:
6
- metadata.gz: 7dd22814ea99a800d59f262c561b38bff37ff9955dfc331ecb7e6acf333ddf5cada2335cf94cf09ce32917b88eefb4962073e1de41b6b2a4c9e71c907bc8f4b6
7
- data.tar.gz: abcb49969f9cdba0a25ee9b8014ccf2376517b451fb12acad28602449b97c47cb98515ee9e5ca87892fdcddba1a646efede07c375757d54fd6e39414bd338d33
6
+ metadata.gz: a02da9782146a7c55c5ebce0104962b23bed7539917b18a2837e1014f168b76bcd41cad602be7eca5c66d3c0addf79f734494962633769fa5dbe48b49bca0916
7
+ data.tar.gz: e4e5dd0c64f93ba15e2668e98599b6cd8a292cd4b2a21f0d274ba0a2d2c149dd031f7f03acfc0c0524037d0388ec1fd4f296d6f351e7f802471fae982ca9f5e2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.2.2
1
+ 7.2.3
@@ -106,25 +106,37 @@ module Gitlab
106
106
  # branch: 'master'
107
107
  # }
108
108
  #
109
- def commit(repository, options)
109
+ def commit(repository, options, action = :add)
110
110
  file = options[:file]
111
111
  author = options[:author]
112
112
  committer = options[:committer]
113
113
  commit = options[:commit]
114
114
  repo = repository.rugged
115
+ ref = 'refs/heads/' + commit[:branch]
116
+ parents = []
115
117
 
116
- oid = repo.write(file[:content], :blob)
117
118
  index = repo.index
118
- index.read_tree(repo.head.target.tree) unless repo.empty?
119
- index.add(path: file[:path], oid: oid, mode: 0100644)
119
+
120
+ unless repo.empty?
121
+ last_commit = repo.references[ref].target
122
+ index.read_tree(last_commit.tree)
123
+ parents = [last_commit]
124
+ end
125
+
126
+ if action == :remove
127
+ index.remove(file[:path])
128
+ else
129
+ oid = repo.write(file[:content], :blob)
130
+ index.add(path: file[:path], oid: oid, mode: 0100644)
131
+ end
120
132
 
121
133
  opts = {}
122
134
  opts[:tree] = index.write_tree(repo)
123
135
  opts[:author] = author
124
136
  opts[:committer] = committer
125
137
  opts[:message] = commit[:message]
126
- opts[:parents] = repo.empty? ? [] : [ repo.head.target ].compact
127
- opts[:update_ref] = 'refs/heads/' + commit[:branch]
138
+ opts[:parents] = parents
139
+ opts[:update_ref] = ref
128
140
 
129
141
  Rugged::Commit.create(repo, opts)
130
142
  end
@@ -151,25 +163,7 @@ module Gitlab
151
163
  # }
152
164
  #
153
165
  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)
166
+ commit(repository, options, :remove)
173
167
  end
174
168
  end
175
169
 
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.2
4
+ version: 7.2.3
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-02 00:00:00.000000000 Z
11
+ date: 2015-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab-linguist