Commit 41e7f385 authored by Thong Kuah's avatar Thong Kuah

Merge branch 'cz-clean-up-code-comments-backend' into 'master'

Clarified some backend code comments

See merge request gitlab-org/gitlab!70227
parents 9a887738 b92c6d36
...@@ -34,7 +34,6 @@ module Projects ...@@ -34,7 +34,6 @@ module Projects
# We need `.connected_to_user` here otherwise when a group has an # We need `.connected_to_user` here otherwise when a group has an
# invitee, it would make the following query return 0 rows since a NULL # invitee, it would make the following query return 0 rows since a NULL
# user_id would be present in the subquery # user_id would be present in the subquery
# See http://stackoverflow.com/questions/129077/not-in-clause-and-null-values
non_null_user_ids = project.project_members.connected_to_user.select(:user_id) non_null_user_ids = project.project_members.connected_to_user.select(:user_id)
GroupMembersFinder.new(project.group).execute.where.not(user_id: non_null_user_ids) GroupMembersFinder.new(project.group).execute.where.not(user_id: non_null_user_ids)
end end
......
...@@ -17,9 +17,8 @@ ...@@ -17,9 +17,8 @@
# 3: high priority # 3: high priority
# 5: _super_ high priority, this should only be used for _very_ important queues # 5: _super_ high priority, this should only be used for _very_ important queues
# #
# As per http://stackoverflow.com/a/21241357/290102 the formula for calculating # The formula for calculating the likelihood of a job being popped off a queue
# the likelihood of a job being popped off a queue (given all queues have work # (given all queues have work to perform) is:
# to perform) is:
# #
# chance = (queue weight / total weight of all queues) * 100 # chance = (queue weight / total weight of all queues) * 100
--- ---
......
...@@ -53,7 +53,6 @@ module Security ...@@ -53,7 +53,6 @@ module Security
# environment. # environment.
# This is easier to address from within the class rather than from tests because this leads to bad class design # This is easier to address from within the class rather than from tests because this leads to bad class design
# and exposing too much of its implementation details to the test suite. # and exposing too much of its implementation details to the test suite.
# See also https://stackoverflow.com/questions/15442298/is-sort-in-ruby-stable.
Gitlab::Utils.stable_sort_by(findings) { |x| [-x.severity_value, -x.confidence_value] } Gitlab::Utils.stable_sort_by(findings) { |x| [-x.severity_value, -x.confidence_value] }
end end
......
...@@ -114,7 +114,7 @@ module Gitlab ...@@ -114,7 +114,7 @@ module Gitlab
# If child commit is a direct ancestor, its first parent is also a direct ancestor. # If child commit is a direct ancestor, its first parent is also a direct ancestor.
# We assume direct ancestors matches the trail of the target branch over time, # We assume direct ancestors matches the trail of the target branch over time,
# This assumption is correct most of the time, especially for gitlab managed merges, # This assumption is correct most of the time, especially for gitlab managed merges,
# but there are exception cases which can't be solved (https://stackoverflow.com/a/49754723/474597) # but there are exception cases which can't be solved.
def mark_all_direct_ancestors(commit) def mark_all_direct_ancestors(commit)
loop do loop do
commit = get_commit(commit.parent_ids.first) commit = get_commit(commit.parent_ids.first)
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# #
# The deploy stage copies the exe and msi from build stage to a network drive # The deploy stage copies the exe and msi from build stage to a network drive
# You need to have the network drive mapped as Local System user for gitlab-runner service to see it # You need to have the network drive mapped as Local System user for gitlab-runner service to see it
# The best way to persist the mapping is via a scheduled task (see: https://stackoverflow.com/a/7867064/1288473), # The best way to persist the mapping is via a scheduled task
# running the following batch command: net use P: \\x.x.x.x\Projects /u:your_user your_pass /persistent:yes # running the following batch command: net use P: \\x.x.x.x\Projects /u:your_user your_pass /persistent:yes
# place project specific paths in variables to make the rest of the script more generic # place project specific paths in variables to make the rest of the script more generic
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
module Gitlab module Gitlab
module Ci module Ci
class Trace class Trace
# This was inspired from: http://stackoverflow.com/a/10219411/1520132
class Stream class Stream
BUFFER_SIZE = 4096 BUFFER_SIZE = 4096
LIMIT_SIZE = 500.kilobytes LIMIT_SIZE = 500.kilobytes
......
...@@ -5,7 +5,6 @@ require_dependency 'gitlab/encoding_helper' ...@@ -5,7 +5,6 @@ require_dependency 'gitlab/encoding_helper'
module Gitlab module Gitlab
module Git module Git
# The ID of empty tree. # The ID of empty tree.
# See http://stackoverflow.com/a/40884093/1856239 and
# https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012 # https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012
EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904' EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
BLANK_SHA = ('0' * 40).freeze BLANK_SHA = ('0' * 40).freeze
......
# GitLab logrotate settings # GitLab logrotate settings
# based on: http://stackoverflow.com/a/4883967
/home/git/gitlab/log/*.log { /home/git/gitlab/log/*.log {
su git git su git git
......
...@@ -86,9 +86,8 @@ namespace :gitlab do ...@@ -86,9 +86,8 @@ namespace :gitlab do
# 3: high priority # 3: high priority
# 5: _super_ high priority, this should only be used for _very_ important queues # 5: _super_ high priority, this should only be used for _very_ important queues
# #
# As per http://stackoverflow.com/a/21241357/290102 the formula for calculating # The formula for calculating the likelihood of a job being popped off a queue
# the likelihood of a job being popped off a queue (given all queues have work # (given all queues have work to perform) is:
# to perform) is:
# #
# chance = (queue weight / total weight of all queues) * 100 # chance = (queue weight / total weight of all queues) * 100
BANNER BANNER
......
...@@ -17,7 +17,6 @@ class BareRepoOperations ...@@ -17,7 +17,6 @@ class BareRepoOperations
commit_id[0] commit_id[0]
end end
# Based on https://stackoverflow.com/a/25556917/1856239
def commit_file(file, dst_path, branch = 'master') def commit_file(file, dst_path, branch = 'master')
head_id = execute(['show', '--format=format:%H', '--no-patch', branch], allow_failure: true)[0] || Gitlab::Git::EMPTY_TREE_ID head_id = execute(['show', '--format=format:%H', '--no-patch', branch], allow_failure: true)[0] || Gitlab::Git::EMPTY_TREE_ID
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment