From c916f293cecf3d112f0338aec0a9dc9e3577f17e Mon Sep 17 00:00:00 2001
From: Lin Jen-Shin <godfat@godfat.org>
Date: Fri, 25 Nov 2016 15:07:27 +0800
Subject: [PATCH] Add some explanation to Repository#update_branch_with_hooks

---
 app/models/repository.rb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/models/repository.rb b/app/models/repository.rb
index 6abe498ebde..09e8cc060c7 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -1146,8 +1146,11 @@ class Repository
     fetch_ref(path_to_repo, ref, ref_path)
   end
 
-  # Whenever `source_branch` is passed, if `branch` doesn't exist, it would
-  # be created from `source_branch`.
+  # Whenever `source_branch` or `source_commit` is passed, if `branch`
+  # doesn't exist, it would be created from `source_branch` or
+  # `source_commit`. Should only pass one of them, not both.
+  # If `source_project` is passed, and the branch doesn't exist,
+  # it would try to find the source from it instead of current repository.
   def update_branch_with_hooks(
     current_user, branch,
     source_branch: nil, source_commit: nil, source_project: project)
-- 
GitLab