Skip to content
代码片段 群组 项目
未验证 提交 84d1c32e 编辑于 作者: Phillip Wells's avatar Phillip Wells 提交者: GitLab
浏览文件

Merge branch 'add-docs-for-collapsing-generated-files' into 'master'

Add docs for collapsing generated files

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/141452



Merged-by: default avatarPhillip Wells <pwells@gitlab.com>
Approved-by: default avatarAmy Qualls <aqualls@gitlab.com>
Approved-by: default avatarPhillip Wells <pwells@gitlab.com>
Reviewed-by: default avatarSincheol (David) Kim <dkim@gitlab.com>
Reviewed-by: default avatarPhillip Wells <pwells@gitlab.com>
Co-authored-by: default avatarDavid Kim <dkim@gitlab.com>
Co-authored-by: default avatarAmy Qualls <aqualls@gitlab.com>
Co-authored-by: default avatarKai Armstrong <karmstrong@gitlab.com>
No related branches found
No related tags found
无相关合并请求
...@@ -34,6 +34,66 @@ To view the diff of changes included in a merge request: ...@@ -34,6 +34,66 @@ To view the diff of changes included in a merge request:
Files with many changes are collapsed to improve performance. GitLab displays the message: Files with many changes are collapsed to improve performance. GitLab displays the message:
**Some changes are not shown**. To view the changes for that file, select **Expand file**. **Some changes are not shown**. To view the changes for that file, select **Expand file**.
### Collapse generated files **(FREE SELF)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/140180) in GitLab 16.8 [with a flag](../../../administration/feature_flags.md) named `collapse_generated_diff_files`. Disabled by default.
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available,
an administrator can [enable the feature flag](../../../administration/feature_flags.md)
named `collapse_generated_diff_files`.
On GitLab.com, this feature is not available.
To help reviewers focus on the files needed to perform a code review, GitLab collapses
several common types of generated files. These files are collapsed by default, because
they are unlikely to require code reviews:
1. Files with `.nib`, `.xcworkspacedata`, or `.xcurserstate` extensions.
1. Package lock files such as `package-lock.json` or `Gopkg.lock`.
1. Files in the `node_modules` folder.
1. Minified `js` or `css` files.
1. Source map reference files.
1. Generated Go files, including the generated files by protocol buffer compiler.
If you want to automatically collapse additional files or file types, you can use the `gitlab-generated` attribute. To mark or unmark certain files/paths as generated if the default doesn't suit
your preference. See [overriding syntax highlighting](../highlighting.md#override-syntax-highlighting-for-a-file-type) for more
detail on how to use override attributes.
#### View a collapsed file
1. On the left sidebar, select **Search or go to** and find your project.
1. Select **Code > Merge requests** and find your merge request.
1. Below the merge request title, select **Changes**.
1. Find the file you want to view, and select **Expand file**.
#### Configure collapse behavior for a file type
To change the default collapse behavior for a file type:
1. If a `.gitattributes` file does not exist in the root directory of your project,
create a blank file with this name.
1. For each file type you want to modify, add a line to the `.gitattributes` file
declaring the file extension and your desired behavior:
```conf
# Collapse all files with a .txt extension
*.txt gitlab-generated
# Collapse all files within the docs directory
docs/** gitlab-generated
# Do not collapse package-lock.json
package-json -gitlab-generated
```
1. Commit, push, and merge your changes into your default branch.
After the changes merge into your [default branch](../repository/branches/default.md),
all files of this type in your project use this behavior in merge requests.
For technical details about how generated files are detected, see the
[`go-enry`](https://github.com/go-enry/go-enry/blob/master/data/generated.go) repository.
## Show one file at a time ## Show one file at a time
For larger merge requests, you can review one file at a time. You can change this setting For larger merge requests, you can review one file at a time. You can change this setting
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册