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
Jérome Perrin
gitlab-ce
Commits
a07021fa
Commit
a07021fa
authored
Feb 12, 2016
by
Rubén Dávila
Committed by
Robert Speicher
Feb 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make more robust the test to see if a commit has been previously reverted.
parent
be54ba33
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
app/models/repository.rb
app/models/repository.rb
+5
-5
No files found.
app/models/repository.rb
View file @
a07021fa
...
@@ -628,11 +628,11 @@ class Repository
...
@@ -628,11 +628,11 @@ class Repository
args
=
[
commit
.
id
,
source_sha
]
args
=
[
commit
.
id
,
source_sha
]
args
<<
{
mainline:
1
}
if
commit
.
merge_commit?
args
<<
{
mainline:
1
}
if
commit
.
merge_commit?
return
false
unless
diff_exists?
(
source_sha
,
commit
.
id
)
revert_index
=
rugged
.
revert_commit
(
*
args
)
revert_index
=
rugged
.
revert_commit
(
*
args
)
tree_id
=
revert_index
.
write_tree
(
rugged
)
return
false
if
revert_index
.
conflicts?
return
false
if
revert_index
.
conflicts?
return
false
unless
diff_exists?
(
source_sha
,
tree_id
)
commit_with_hooks
(
user
,
target_branch
)
do
|
ref
|
commit_with_hooks
(
user
,
target_branch
)
do
|
ref
|
committer
=
user_to_committer
(
user
)
committer
=
user_to_committer
(
user
)
...
@@ -640,14 +640,14 @@ class Repository
...
@@ -640,14 +640,14 @@ class Repository
message:
commit
.
revert_message
,
message:
commit
.
revert_message
,
author:
committer
,
author:
committer
,
committer:
committer
,
committer:
committer
,
tree:
revert_index
.
write_tree
(
rugged
)
,
tree:
tree_id
,
parents:
[
rugged
.
lookup
(
source_sha
)],
parents:
[
rugged
.
lookup
(
source_sha
)],
update_ref:
ref
)
update_ref:
ref
)
end
end
end
end
def
diff_exists?
(
s
ource_sha
,
target_sha
)
def
diff_exists?
(
s
ha1
,
sha2
)
rugged
.
diff
(
s
ource_sha
,
target_sha
).
size
.
zero?
rugged
.
diff
(
s
ha1
,
sha2
).
size
>
0
end
end
def
merged_to_root_ref?
(
branch_name
)
def
merged_to_root_ref?
(
branch_name
)
...
...
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