Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs for new command dvc check-ignore #1629

Merged
merged 21 commits into from
Aug 7, 2020
Merged
Changes from 7 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
702172e
Docs for new command `dvc check-ignore`
karajan1001 Jul 26, 2020
214131d
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Jul 29, 2020
20cbcf5
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Jul 29, 2020
ead5f4f
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Jul 29, 2020
3b5e1a0
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Jul 29, 2020
2fe85d3
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Jul 29, 2020
98add0a
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Jul 29, 2020
feaa074
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Jul 29, 2020
545b263
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Jul 29, 2020
34fdb5f
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Jul 29, 2020
44277dc
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Aug 6, 2020
1288407
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Aug 6, 2020
d99e05c
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Aug 6, 2020
3ae42a8
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Aug 6, 2020
c61c42a
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Aug 6, 2020
f10806b
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Aug 6, 2020
6d3930d
Update content/docs/command-reference/check-ignore.md
jorgeorpinel Aug 7, 2020
a9a5242
Merge branch 'master' into fix_1628
jorgeorpinel Aug 7, 2020
1c32b8d
cmd: complete check-ignore ref.
jorgeorpinel Aug 7, 2020
524b01e
guide: anoter link from dvcignore guide to check-ignore cmd ref.
jorgeorpinel Aug 7, 2020
c759585
cmd: update check-ignore targets arg desc
jorgeorpinel Aug 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions content/docs/command-reference/check-ignore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# check-ignore

Check whether any given files or directories are excluded from DVC
due to the patterns found in [`.dvcignore`](/doc/user-guide/dvcignore).

## Synopsis

```usage
usage: usage: dvc check-ignore [-h] [-q | -v] [-d] [-n]
targets [targets ...]

positional arguments:
targets Input files/directories to check ignore patterns.
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved
```

## Description

For each pathname given via the command-line , check whether the file is excluded
by `.dvcignore` output the path if it is excluded.
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved

## Options

- `-h`, `--help` - prints the usage/help message, and exit.

- `-q`, `--quiet` - do not write anything to standard output. Exit with 0 if no
problems arise, otherwise 1.

- `-v`, `--verbose` - displays detailed tracing information.

- `-d`, `--details` - show the exclude pattern together with each target path.

- `-n`, `--non-matching` - show the target paths which don’t match any pattern.
Only usable when `--details` is also employed
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved

## Examples

First, let's create a `.dvcignore` file with some patterns in it, and some files
to check against it.

```dvc
$ echo "file*\n\!file2" >> .dvcignore
$ cat .dvcignore
file*
!file2
$ touch file1 file2 other
$ ls
file1 file2 other
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved
```

Then, let's check if they were excluded by `.dvcignore`
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved

```dvc
$ dvc check-ignore file1
file1
$ dvc check-ignore file2
file2
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved
$ dvc check-ignore other
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved
$ dvc check-ignore file*
file1
file2
```

If `--details` is specified, the output is a series of lines of the form:
`<source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname>`
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

@jorgeorpinel jorgeorpinel Jul 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`<source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname>`
`.dvcignore:<line number>:<pattern> <HT> <target path>`
  • Why <source>? It's always .dvcignore right? Or because of nested ones? If so maybe use <path/to/>.dvcignore
  • What's <HT>? Please replace with actual character.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karajan1001 actually I'm not sure what the answers are here, can you check it? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorgeorpinel,
Not always .dvcignore, might be data/.dvcignore as well. We didn't restrict .dvcignore to the root of the repo.

Copy link
Contributor

@jorgeorpinel jorgeorpinel Aug 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK so probably:

Suggested change
`<source> <COLON> <linenum> <COLON> <pattern> <HT> <pathname>`
`<path/to/.dvcignore>:<line_num>:<pattern> | <target_path>`

HT = horizontal tab, right?

UPDATE: Committed.


```dvc
$ dvc check-ignore -d file1
.dvcignore:1:file* file1
$ dvc check-ignore -d file2
.dvcignore:2:!file2 file2
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved
$ dvc check-ignore -d other
$ dvc check-ignore -d file*
.dvcignore:1:file* file1
.dvcignore:2:!file2 file2
```

If `--non-matching` is specified, non-matching pathnames will also be
output, in which case all fields in each output record except for
<pathname> will be empty
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved

```dvc
$ dvc check-ignore -d -n other
:: other
```