summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-06-21 11:39:41 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2017-06-21 11:42:08 -0300
commitbe108ae6f042311f0836f2425023fd74d8cfa97d (patch)
tree3261505655042fcca80f3eae8108a3486413c67d
parent7c85d6af96721e23bc36b23fc3576beaa06223e1 (diff)
downloadgitlab-ce-be108ae6f042311f0836f2425023fd74d8cfa97d.tar.gz
Add a comment explaining how the branch clean up happens
-rw-r--r--lib/github/representation/pull_request.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/github/representation/pull_request.rb b/lib/github/representation/pull_request.rb
index cbe3dd18e9d..55461097e8a 100644
--- a/lib/github/representation/pull_request.rb
+++ b/lib/github/representation/pull_request.rb
@@ -103,6 +103,12 @@ module Github
end
def remove_source_branch!
+ # We should remove the source/target branches only if they were
+ # restored. Otherwise, we'll remove branches like 'master' that
+ # target_branch_exists? returns true. In other words, we need
+ # to clean up only the restored branches that (source|target)_branch_exists?
+ # returns false for the first time it has been called, because of
+ # this that is important to memoize these values.
source_branch.remove!(source_branch_name) unless source_branch_exists?
end