gitlab_git 7.1.13 → 7.2.0
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/gitlab_git/blob.rb +45 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 364b0b25711ddfd083fcd21d9d69a6ca06d056a9
|
4
|
+
data.tar.gz: 1142f7c28fab2fb5bb14e0c44d7eb17c4e318d55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 189362edbcfdc6f4a474c74a126bfe0e60c23b9e7f133b5849377625683f3022b49b3f73a1f8924c414d2964a41e07c5cc2ad2cf433dab6ebd7bab4a54438ae3
|
7
|
+
data.tar.gz: 419dc4f8e1b4523d9f583d8ef5ce63ce75de0af3af953360dfb5eafd9d968eb7f388a9dbc2f306ab29136bf992940d9e2424f180d17e945b6fcb93c2834fd7e0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.2.0
|
data/lib/gitlab_git/blob.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab-linguist
|