Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
14798b8e
Commit
14798b8e
authored
Apr 16, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
symbolize keys for Gitlab::Git::Diff & Gitlab::Git::Commit
parent
d7d8edf3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+4
-2
lib/gitlab/git/diff.rb
lib/gitlab/git/diff.rb
+5
-5
No files found.
lib/gitlab/git/commit.rb
View file @
14798b8e
...
...
@@ -25,7 +25,7 @@ module Gitlab
end
def
serialize_keys
%w(id authored_date committed_date author_name author_email committer_name committer_email message parent_ids
)
@serialize_keys
||=
%w(id authored_date committed_date author_name author_email committer_name committer_email message parent_ids)
.
map
(
&
:to_sym
)
end
def
sha
...
...
@@ -116,8 +116,10 @@ module Gitlab
end
def
init_from_hash
(
hash
)
raw_commit
=
hash
.
symbolize_keys
serialize_keys
.
each
do
|
key
|
send
(
:"
#{
key
}
="
,
hash
[
key
])
send
(
:"
#{
key
}
="
,
raw_commit
[
key
.
to_sym
])
end
end
end
...
...
lib/gitlab/git/diff.rb
View file @
14798b8e
...
...
@@ -14,7 +14,7 @@ module Gitlab
# Stats properties
attr_accessor
:new_file
,
:renamed_file
,
:deleted_file
def
initialize
(
raw_diff
,
head
=
nil
)
def
initialize
(
raw_diff
)
raise
"Nil as raw diff passed"
unless
raw_diff
if
raw_diff
.
is_a?
(
Hash
)
...
...
@@ -22,12 +22,10 @@ module Gitlab
else
init_from_grit
(
raw_diff
)
end
@head
=
head
end
def
serialize_keys
%w(diff new_path old_path a_mode b_mode new_file renamed_file deleted_file
)
@serialize_keys
||=
%w(diff new_path old_path a_mode b_mode new_file renamed_file deleted_file)
.
map
(
&
:to_sym
)
end
def
to_hash
...
...
@@ -53,8 +51,10 @@ module Gitlab
end
def
init_from_hash
(
hash
)
raw_diff
=
hash
.
symbolize_keys
serialize_keys
.
each
do
|
key
|
send
(
:"
#{
key
}
="
,
hash
[
key
])
send
(
:"
#{
key
}
="
,
raw_diff
[
key
.
to_sym
])
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment