Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
4bd833592f
commit
1064667302
8 changed files with 112 additions and 40 deletions
|
@ -289,11 +289,11 @@ Example response:
|
|||
|
||||
```
|
||||
|
||||
## Cherry pick a commit
|
||||
## Cherry-pick a commit
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/8047) in GitLab 8.15.
|
||||
|
||||
Cherry picks a commit to a given branch.
|
||||
Cherry-picks a commit to a given branch.
|
||||
|
||||
```plaintext
|
||||
POST /projects/:id/repository/commits/:sha/cherry_pick
|
||||
|
|
|
@ -35,6 +35,15 @@ To enable 2FA for all users:
|
|||
If you want 2FA enforcement to take effect during the next sign-in attempt,
|
||||
change the grace period to `0`.
|
||||
|
||||
## Disabling 2FA enforcement through rails console
|
||||
|
||||
Using the [rails console](../administration/operations/rails_console.md), enforcing 2FA for
|
||||
all user can be disabled. Connect to the rails console and run:
|
||||
|
||||
```ruby
|
||||
Gitlab::CurrentSettings.update!('require_two_factor_authentication': false)
|
||||
```
|
||||
|
||||
## Enforcing 2FA for all users in a group
|
||||
|
||||
> [Introduced in](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/24965) GitLab 12.0, 2FA settings for a group are also applied to subgroups.
|
||||
|
|
|
@ -5,49 +5,76 @@ info: To determine the technical writer assigned to the Stage/Group associated w
|
|||
comments: false
|
||||
---
|
||||
|
||||
# Cherry pick **(FREE)**
|
||||
# Cherry-pick a Git commit **(FREE)**
|
||||
|
||||
Given an existing commit on one branch, apply the change to another branch.
|
||||
In Git, you can *cherry-pick* a commit (a set of changes) from an existing branch,
|
||||
and apply those changes to another branch. Cherry-picks can help you:
|
||||
|
||||
This can be useful for backporting bug fixes to previous release branches. Make
|
||||
the commit on the default branch, and then cherry pick it into the release branch.
|
||||
- Backport bug fixes from the default branch to previous release branches.
|
||||
- Copy changes from a fork
|
||||
[to the upstream repository](../../user/project/merge_requests/cherry_pick_changes.md#cherry-pick-into-a-project).
|
||||
|
||||
## Sample workflow
|
||||
You can cherry-pick commits from the command line. In the GitLab user interface,
|
||||
you can also:
|
||||
|
||||
1. Check out a new `stable` branch from the default branch:
|
||||
- Cherry-pick [all changes from a merge request](../../user/project/merge_requests/cherry_pick_changes.md#cherry-pick-a-merge-request).
|
||||
- Cherry-pick [a single commit](../../user/project/merge_requests/cherry_pick_changes.md#cherry-pick-a-commit).
|
||||
- Cherry-pick [from a fork to the upstream repository](../../user/project/merge_requests/cherry_pick_changes.md#cherry-pick-into-a-project).
|
||||
|
||||
## Cherry-pick from the command line
|
||||
|
||||
These instructions explain how to cherry-pick a commit from the default branch (`main`)
|
||||
into a different branch (`stable`):
|
||||
|
||||
1. Check out the default branch, then check out a new `stable` branch based on it:
|
||||
|
||||
```shell
|
||||
git checkout master
|
||||
git checkout main
|
||||
git checkout -b stable
|
||||
```
|
||||
|
||||
1. Change back to the default branch:
|
||||
|
||||
```shell
|
||||
git checkout master
|
||||
git checkout main
|
||||
```
|
||||
|
||||
1. Make any required changes, then commit the changes:
|
||||
1. Make your changes, then commit them:
|
||||
|
||||
```shell
|
||||
git add changed_file.rb
|
||||
git commit -m 'Fix bugs in changed_file.rb'
|
||||
```
|
||||
|
||||
1. Review the commit log and copy the SHA of the latest commit:
|
||||
1. Display the commit log:
|
||||
|
||||
```shell
|
||||
git log
|
||||
$ git log
|
||||
|
||||
commit 0000011111222223333344444555556666677777
|
||||
Merge: 88888999999 aaaaabbbbbb
|
||||
Author: user@example.com
|
||||
Date: Tue Aug 31 21:19:41 2021 +0000
|
||||
```
|
||||
|
||||
1. Check out the `stable` branch:
|
||||
1. Identify the `commit` line, and copy the string of letters and numbers on that line.
|
||||
This information is the SHA (Secure Hash Algorithm) of the commit. The SHA is
|
||||
a unique identifier for this commit, and you need it in a future step.
|
||||
|
||||
1. Now that you know the SHA, check out the `stable` branch again:
|
||||
|
||||
```shell
|
||||
git checkout stable
|
||||
```
|
||||
|
||||
1. Cherry pick the commit by using the SHA copied previously:
|
||||
1. Cherry-pick the commit into the `stable` branch, and change `SHA` to your commit
|
||||
SHA:
|
||||
|
||||
```shell
|
||||
git cherry-pick <commit SHA>
|
||||
git cherry-pick <SHA>
|
||||
```
|
||||
|
||||
## Related links
|
||||
|
||||
- Cherry-pick commits with [the Commits API](../../api/commits.md#cherry-pick-a-commit)
|
||||
- Git documentation [for cherry-picks](https://git-scm.com/docs/git-cherry-pick)
|
||||
|
|
|
@ -58,7 +58,7 @@ The following are resources on version control concepts:
|
|||
You can do many Git tasks from the command line:
|
||||
|
||||
- [Bisect](bisect.md).
|
||||
- [Cherry pick](cherry_picking.md).
|
||||
- [Cherry-pick](cherry_picking.md).
|
||||
- [Feature branching](feature_branching.md).
|
||||
- [Getting started with Git](getting_started.md).
|
||||
- [Git add](git_add.md).
|
||||
|
|
|
@ -9,6 +9,15 @@ info: To determine the technical writer assigned to the Stage/Group associated w
|
|||
This page contains information about the settings that are used on GitLab.com, available to
|
||||
[GitLab SaaS](https://about.gitlab.com/pricing/) customers.
|
||||
|
||||
## Password requirements
|
||||
|
||||
GitLab.com has the following requirements for passwords on new accounts and password changes:
|
||||
|
||||
- Minimum character length 8 characters.
|
||||
- Maximum character lenght 128 characters.
|
||||
- All characters are accepted. For example, `~`, `!`, `@`, `#`, `$`, `%`, `^`, `&`, `*`, `()`,
|
||||
`[]`, `_`, `+`, `=`, and `-`.
|
||||
|
||||
## SSH key restrictions
|
||||
|
||||
GitLab.com uses the default [SSH key restrictions](../../security/ssh_keys_restrictions.md).
|
||||
|
|
|
@ -145,7 +145,7 @@ For a web developer writing a webpage for your company's website:
|
|||
1. You request your web designers for their implementation.
|
||||
1. You request the [approval](approvals/index.md) from your manager.
|
||||
1. Once approved, your merge request is [squashed and merged](squash_and_merge.md), and [deployed to staging with GitLab Pages](https://about.gitlab.com/blog/2021/02/05/ci-deployment-and-environments/).
|
||||
1. Your production team [cherry picks](cherry_pick_changes.md) the merge commit into production.
|
||||
1. Your production team [cherry-picks](cherry_pick_changes.md) the merge commit into production.
|
||||
|
||||
## Related topics
|
||||
|
||||
|
|
|
@ -1,17 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# :nocov:
|
||||
module DeliverNever
|
||||
def deliver_later
|
||||
self
|
||||
end
|
||||
end
|
||||
|
||||
module MuteNotifications
|
||||
def new_note(note)
|
||||
end
|
||||
end
|
||||
|
||||
module Gitlab
|
||||
class Seeder
|
||||
extend ActionView::Helpers::NumberHelper
|
||||
|
@ -82,18 +70,22 @@ module Gitlab
|
|||
Project.include(ProjectSeed)
|
||||
User.include(UserSeed)
|
||||
|
||||
mute_notifications
|
||||
mute_mailer
|
||||
old_perform_deliveries = ActionMailer::Base.perform_deliveries
|
||||
ActionMailer::Base.perform_deliveries = false
|
||||
|
||||
SeedFu.quiet = true
|
||||
|
||||
without_statement_timeout do
|
||||
yield
|
||||
without_new_note_notifications do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
SeedFu.quiet = false
|
||||
ActiveRecord::Base.logger = old_logger
|
||||
puts "\nOK".color(:green)
|
||||
ensure
|
||||
SeedFu.quiet = false
|
||||
ActionMailer::Base.perform_deliveries = old_perform_deliveries
|
||||
ActiveRecord::Base.logger = old_logger
|
||||
end
|
||||
|
||||
def self.without_gitaly_timeout
|
||||
|
@ -109,12 +101,14 @@ module Gitlab
|
|||
ApplicationSetting.expire
|
||||
end
|
||||
|
||||
def self.mute_notifications
|
||||
NotificationService.prepend(MuteNotifications)
|
||||
end
|
||||
def self.without_new_note_notifications
|
||||
NotificationService.alias_method :original_new_note, :new_note
|
||||
NotificationService.define_method(:new_note) { |note| }
|
||||
|
||||
def self.mute_mailer
|
||||
ActionMailer::MessageDelivery.prepend(DeliverNever)
|
||||
yield
|
||||
ensure
|
||||
NotificationService.alias_method :new_note, :original_new_note
|
||||
NotificationService.remove_method :original_new_note
|
||||
end
|
||||
|
||||
def self.without_statement_timeout
|
||||
|
|
33
spec/lib/gitlab/seeder_spec.rb
Normal file
33
spec/lib/gitlab/seeder_spec.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
RSpec.describe Gitlab::Seeder do
|
||||
describe '.quiet' do
|
||||
it 'disables mail deliveries' do
|
||||
expect(ActionMailer::Base.perform_deliveries).to eq(true)
|
||||
|
||||
described_class.quiet do
|
||||
expect(ActionMailer::Base.perform_deliveries).to eq(false)
|
||||
end
|
||||
|
||||
expect(ActionMailer::Base.perform_deliveries).to eq(true)
|
||||
end
|
||||
|
||||
it 'disables new note notifications' do
|
||||
note = create(:note_on_issue)
|
||||
|
||||
notification_service = NotificationService.new
|
||||
|
||||
expect(notification_service).to receive(:send_new_note_notifications).twice
|
||||
|
||||
notification_service.new_note(note)
|
||||
|
||||
described_class.quiet do
|
||||
expect(notification_service.new_note(note)).to eq(nil)
|
||||
end
|
||||
|
||||
notification_service.new_note(note)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue