diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-17 11:24:25 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-08-17 11:24:25 +0300 |
commit | 3b93856e131c3539650444356a259dd93f65cd26 (patch) | |
tree | 86a1da8836b1e21822f12b75131c7ace18cec577 | |
parent | a608e45e6b662df438a0884a997c53c5c9125a47 (diff) |
save repo empty state into variable for proper result
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/models/repository.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index f2f75e0e0f6..a1f2ea1d7e9 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -494,12 +494,13 @@ class Repository oldrev = Gitlab::Git::BLANK_SHA ref = Gitlab::Git::BRANCH_REF_PREFIX + branch gl_id = Gitlab::ShellEnv.gl_id(current_user) + was_empty = empty? # Create temporary ref random_string = SecureRandom.hex tmp_ref = "refs/tmp/#{random_string}/head" - unless empty? + unless was_empty oldrev = find_branch(branch).target rugged.references.create(tmp_ref, oldrev) end @@ -516,7 +517,7 @@ class Repository status = pre_receive_hook.trigger(gl_id, oldrev, newrev, ref) if status - if empty? + if was_empty # Create branch rugged.references.create(ref, newrev) else |