Skip to content
Snippets Groups Projects
Commit 795b3442 authored by Jon Glassman's avatar Jon Glassman
Browse files

Apply style fixes to Create patches docs

parent bad19f3e
No related branches found
No related tags found
1 merge request!85Merged upstream 15.5.0+rc42.ce.0
......@@ -4,5 +4,7 @@
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments
---
# Creating Patches
# Create Patches
You can manually modify an external dependency to:
......@@ -8,6 +10,4 @@
It can happen that you may need to manually modify an external dependency for it
to work correctly in the context of a Omnibus embedded packaging, or even to
fix an issue that the upstream maintainer have not either accepted or still
taking longer to review and ship.
- Make sure that dependency works with Omnibus embedded packaging.
- Fix an issue that an upstream maintainer has not fixed.
......@@ -13,4 +13,4 @@
## Bootstrapping
## Bootstrap patch files
Omnibus has a specific [DSL](https://github.com/chef/omnibus#software) and
......@@ -15,5 +15,5 @@
Omnibus has a specific [DSL](https://github.com/chef/omnibus#software) and
conventions to ship and apply patches automatically as part of the building
conventions to ship and apply patches automatically as part of the build
process.
......@@ -18,10 +18,9 @@
process.
You will store `.patch` files that contain the changes in a specific
directory structure and with the help of the `patch` DSL method, will apply
the file(s) to reflect the desired changes:
To apply patch files, store `.patch` files that contain the changes in a
specific directory structure using the `patch` DSL method:
```plaintext
config/patches/<software-name>
```
......@@ -23,12 +22,12 @@
```plaintext
config/patches/<software-name>
```
As example, for a patch that will be applied during the execution of
`gitlab-rails`, you will store `.patch` files in:
For example, for a patch applied during the execution of
`gitlab-rails`, store the `.patch` files in:
```plaintext
config/patches/gitlab-rails
```
......@@ -30,7 +29,12 @@
```plaintext
config/patches/gitlab-rails
```
## Creating a patch
## Create a patch
To create a patch file, you can use:
- The `diff` command to compare an original file with a modified file.
- Git to output a patch based one or more commits.
......@@ -36,6 +40,3 @@
There are two easy ways to create a patch file. You can use the `diff` command
and compare a original with a modified file (i.e. `target.rb` with
`target.rb.original`) or you can use Git to output a patch based one or more
commits.
### Use `diff` to create a patch
......@@ -41,3 +42,3 @@
### Diff command
To create a patch file using the `diff` command:
......@@ -43,5 +44,5 @@
To create a patch file using the diff and the previous example, duplicate the
file you are changing with a new name, and make the change to the old one.
1. Duplicate the file you are changing and give the new file a new name.
1. Change the original file.
```shell
......@@ -46,5 +47,5 @@
```shell
diff -Naur target.rb.original target.rb > my_awesome_change.patch
diff -Naur <original_file> <new_file> > <patch_filename>.patch
```
......@@ -49,4 +50,7 @@
```
### Git command
### Use Git to create a patch
Use the `git diff` command to create a patch file between two Git commits.
You must know both commit IDs.
......@@ -52,5 +56,8 @@
To create a patch file based on Git commits, you must get the hash from both
(or just the earliest one if you are comparing with base HEAD).
```shell
git diff <commitid1> <commitid2 > <patch_filename>.patch
```
You can also create a patch file based on one Git commit and the base HEAD.
```shell
......@@ -55,9 +62,5 @@
```shell
# to generate a patch between two commits
git diff commitid1 commitid2 > my_awesome_change.patch
# to generate a patch between the HEAD and a specific commits
git diff commitid1 > my_awesome_change.patch
git diff <commitid1> > <patch_filename>.patch
```
......@@ -62,4 +65,6 @@
```
## Using the patch
## Use the patch
To patch one or more files:
......@@ -65,5 +70,4 @@
To patch one or more files, you must first execute any operation in your
software definition that provides the original files like downloading,
bundle installing etc, and then add something similar to:
1. Get the original files by downloading, bundle installing, or using a similar method.
1. Add the following line to each original file:
......@@ -69,4 +73,4 @@
```shell
patch source: 'my_awesome_change.patch', target: "#{install_dir}/embedded/target_file.txt"
```
```shell
patch source: '<patch_filename>.patch', target: "#{<install_directory>}/embedded/<target_file>.txt"
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment