Revert ignoring .git only when Git is discovered

And so on from other VCS. This causes confusion (ref #255) when watching
from outside a git repo, where the VCS type isn’t detected so the .git
folder is included in the watchset. While slightly incorrect, it’s more
expected that these folders be ignored regardless, and there’s always
--no-default-ignore to avoid those ignores if needed.
This commit is contained in:
Félix Saparelli 2022-02-07 16:55:11 +13:00
parent 94b21c2da3
commit 96a6a6e9d9
5 changed files with 166 additions and 93 deletions

View File

@ -13,7 +13,6 @@ use watchexec::{
Event, Tag,
},
filter::{globset::GlobsetFilterer, Filterer},
project::ProjectType,
};
pub async fn globset(args: &ArgMatches<'static>) -> Result<Arc<WatchexecFilterer>> {
@ -32,38 +31,17 @@ pub async fn globset(args: &ArgMatches<'static>) -> Result<Arc<WatchexecFilterer
(String::from(".*.kate-swp"), None),
(String::from(".*.sw?"), None),
(String::from(".*.sw?x"), None),
]);
if vcs_types.contains(&ProjectType::Git) {
ignores.push((format!("**{s}.git{s}**", s = MAIN_SEPARATOR), None));
}
if vcs_types.contains(&ProjectType::Mercurial) {
ignores.push((format!("**{s}.hg{s}**", s = MAIN_SEPARATOR), None));
}
if vcs_types.contains(&ProjectType::Subversion) {
ignores.push((format!("**{s}.svn{s}**", s = MAIN_SEPARATOR), None));
}
if vcs_types.contains(&ProjectType::Bazaar) {
ignores.push((format!("**{s}.bzr{s}**", s = MAIN_SEPARATOR), None));
}
if vcs_types.contains(&ProjectType::Darcs) {
ignores.push((format!("**{s}_darcs{s}**", s = MAIN_SEPARATOR), None));
}
if vcs_types.contains(&ProjectType::Fossil) {
ignores.push((
(format!("**{s}.bzr{s}**", s = MAIN_SEPARATOR), None),
(format!("**{s}_darcs{s}**", s = MAIN_SEPARATOR), None),
(
format!("**{s}.fossil-settings{s}**", s = MAIN_SEPARATOR),
None,
));
}
if vcs_types.contains(&ProjectType::Pijul) {
ignores.push((format!("**{s}.pijul{s}**", s = MAIN_SEPARATOR), None));
}
),
(format!("**{s}.git{s}**", s = MAIN_SEPARATOR), None),
(format!("**{s}.hg{s}**", s = MAIN_SEPARATOR), None),
(format!("**{s}.pijul{s}**", s = MAIN_SEPARATOR), None),
(format!("**{s}.svn{s}**", s = MAIN_SEPARATOR), None),
]);
}
let filters = args

View File

@ -10,7 +10,6 @@ use watchexec::{
Filter, Matcher, Op, Pattern, TaggedFilterer,
},
ignore::IgnoreFile,
project::ProjectType,
};
pub async fn tagged(args: &ArgMatches<'static>) -> Result<Arc<TaggedFilterer>> {
@ -69,35 +68,14 @@ pub async fn tagged(args: &ArgMatches<'static>) -> Result<Arc<TaggedFilterer>> {
Filter::from_glob_ignore(None, ".*.kate-swp"),
Filter::from_glob_ignore(None, ".*.sw?"),
Filter::from_glob_ignore(None, ".*.sw?x"),
Filter::from_glob_ignore(None, ".bzr"),
Filter::from_glob_ignore(None, "_darcs"),
Filter::from_glob_ignore(None, ".fossil-settings"),
Filter::from_glob_ignore(None, ".git"),
Filter::from_glob_ignore(None, ".hg"),
Filter::from_glob_ignore(None, ".pijul"),
Filter::from_glob_ignore(None, ".svn"),
]);
if vcs_types.contains(&ProjectType::Git) {
filters.push(Filter::from_glob_ignore(None, "/.git"));
}
if vcs_types.contains(&ProjectType::Mercurial) {
filters.push(Filter::from_glob_ignore(None, "/.hg"));
}
if vcs_types.contains(&ProjectType::Subversion) {
filters.push(Filter::from_glob_ignore(None, "/.svn"));
}
if vcs_types.contains(&ProjectType::Bazaar) {
filters.push(Filter::from_glob_ignore(None, "/.bzr"));
}
if vcs_types.contains(&ProjectType::Darcs) {
filters.push(Filter::from_glob_ignore(None, "/_darcs"));
}
if vcs_types.contains(&ProjectType::Fossil) {
filters.push(Filter::from_glob_ignore(None, "/.fossil-settings"));
}
if vcs_types.contains(&ProjectType::Pijul) {
filters.push(Filter::from_glob_ignore(None, "/.pijul"));
}
}
if args.is_present("no-meta") {

View File

@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "WATCHEXEC" "1" "July 2021" "" ""
.TH "WATCHEXEC" "1" "February 2022" "" ""
.
.SH "NAME"
\fBwatchexec\fR \- execute commands when watched files change
.
.SH "SYNOPSIS"
watchexec [\fB\-\-exts\fR | \fB\-e\fR \fIextensions\fR]\.\.\. [\fB\-\-filter\fR | \fB\-f\fR \fIpattern\fR]\.\.\. [\fB\-\-ignore\fR | \fB\-i\fR \fIpattern\fR]\.\.\. [\fB\-\-watch\fR | \fB\-w\fR \fIpath\fR]\.\.\. [\fB\-\-restart\fR | \fB\-r\fR] [\fB\-\-clear\fR | \fB\-c\fR] [\fB\-\-postpone\fR | \fB\-p\fR] [\fB\-\-force\-poll\fR \fIinterval\fR] [\fB\-\-debounce\fR | \fB\-d\fR \fIinterval\fR] [\fB\-\-no\-vcs\-ignore\fR] [\fB\-\-no\-default\-ignore\fR] [\fB\-\-verbose\fR | \fB\-v\fR] [\fB\-\-changes\-only\fR] [\fB\-\-version\fR | \fB\-V\fR] [\-\-] \fIcommand\fR [\fIargument\fR\.\.\.]
watchexec [\fB\-\-exts\fR | \fB\-e\fR \fIextensions\fR]\.\.\. [\fB\-\-filter\fR | \fB\-f\fR \fIpattern\fR]\.\.\. [\fB\-\-ignore\fR | \fB\-i\fR \fIpattern\fR]\.\.\. [\fB\-\-watch\fR | \fB\-w\fR \fIpath\fR]\.\.\. [\fB\-\-restart\fR | \fB\-r\fR] [\fB\-\-clear\fR | \fB\-c\fR] [\fB\-\-postpone\fR | \fB\-p\fR] [\fB\-\-force\-poll\fR \fIinterval\fR] [\fB\-\-debounce\fR | \fB\-d\fR \fIinterval\fR] [\fB\-\-no\-vcs\-ignore\fR] [\fB\-\-no\-default\-ignore\fR] [\fB\-\-verbose\fR | \fB\-v\fR | \fB\-vv\fR | \fB\-vvv\fR | \fB\-vvvv\fR] [\fB\-\-changes\-only\fR] [\fB\-\-version\fR | \fB\-V\fR] [\-\-] \fIcommand\fR [\fIargument\fR\.\.\.]
.
.SH "DESCRIPTION"
Recursively monitors the current directory for changes, executing the command when a filesystem change is detected\. By default, watchexec uses efficient kernel\-level mechanisms to watch for changes\.
@ -112,19 +112,31 @@ Set the timeout between detected change and command execution, to avoid restarti
.
.TP
\fB\-\-no\-vcs\-ignore\fR
Skip loading of version control system (VCS) ignore files\. By default, watchexec loads \.gitignore files in the current directory (or parent directories) and uses them to populate the ignore list\.
Skip loading of version control system (VCS) ignore files\. By default, watchexec loads \.gitignore, \.hgignore, and other such files in the current directory (or child directories as applicable) and uses them to filter change events\.
.
.TP
\fB\-\-no\-project\-ignore\fR, \fB\-\-no\-ignore\fR (deprecated alias)
Skip loading of project\-local ignore files (include VCS ignore files)\. By default, watchexec loads \.ignore, \.gitignore, \.hgignore, and other such files in the current directory (or child directories as applicable) and uses them to filter change events\.
.
.TP
\fB\-\-no\-default\-ignore\fR
Skip default ignore statements\. By default, watchexec ignores common temporary files for you, for example \fB*\.swp\fR, \fB*\.pyc\fR, and \fB\.DS_Store\fR\.
Skip default ignore statements\. By default, watchexec ignores common temporary files for you, for example \fB*\.swp\fR, \fB*\.pyc\fR, and \fB\.DS_Store\fR, as well as the data directories of known VCS: \fB\.bzr\fR, \fB_darcs\fR, \fB\.fossil\-settings\fR, \fB\.git\fR, \fB\.hg\fR, \fB\.pijul\fR, and \fB\.svn\fR\.
.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Prints diagnostic messages to STDERR\.
\fB\-\-no\-global\-ignore\fR
Skip loading of global ignore files\. By default, watchexec loads $HOME/\.gitignore and other such global files and uses them to filter change events\.
.
.TP
\fB\-\-changes\-only\fR
Prints the paths that have changed as diagnostics to STDERR, but not everything else that \fB\-\-verbose\fR prints\.
\fB\-v\fR, \fB\-\-verbose\fR, \fB\-vv\fR, etc
Prints diagnostic and debugging messages to STDERR\. Increase the amount of \fBv\fRs to get progressively more output: for bug reports use \fBthree\fR, and for deep debugging \fBfour\fR can be helpful\.
.
.TP
\fB\-\-print\-events\fR, \fB\-\-changes\-only\fR (deprecated alias)
Prints the events (changed paths, etc) that have triggered an action to STDERR\.
.
.TP
\fB\-N\fR, \fB\-\-notify\fR
Sends desktop notifications on command start and command end\.
.
.TP
\fB\-V\fR, \fB\-\-version\fR
@ -135,36 +147,99 @@ Print the version of watchexec\.
Print a help message\.
.
.SH "ENVIRONMENT"
Processes started by watchexec have environment variables set describing the modification(s) observed\. Which variable is set depends on how many modifications were observed and/or what type they were\.
In variables that contain lists of paths, the separator is as for the \fB$PATH\fR environment variable (a colon, or semicolon on Windows)\.
.
.SS "Set on child processes"
Processes started by watchexec have environment variables set describing the changes observed\.
.
.P
If a single file changed (depending on the event type):
\fB$WATCHEXEC_COMMON_PATH\fR is set to the longest common path of all of the below variables, and so should be prepended to each path to obtain the full/real path\.
.
.IP "\(bu" 4
\fB$WATCHEXEC_CREATED_PATH\fR, the path of the file that was created
\fB$WATCHEXEC_CREATED_PATH\fR is set when files/folders were created
.
.IP "\(bu" 4
\fB$WATCHEXEC_REMOVED_PATH\fR, the path of the file that was removed
\fB$WATCHEXEC_REMOVED_PATH\fR is set when files/folders were removed
.
.IP "\(bu" 4
\fB$WATCHEXEC_RENAMED_PATH\fR, the path of the file that was renamed
\fB$WATCHEXEC_RENAMED_PATH\fR is set when files/folders were renamed
.
.IP "\(bu" 4
\fB$WATCHEXEC_WRITTEN_PATH\fR, the path of the file that was modified
\fB$WATCHEXEC_WRITTEN_PATH\fR is set when files/folders were modified
.
.IP "\(bu" 4
\fB$WATCHEXEC_META_CHANGED_PATH\fR, the path of the file whose metadata changed
\fB$WATCHEXEC_META_CHANGED_PATH\fR is set when files/folders\' metadata were modified
.
.IP "\(bu" 4
\fB$WATCHEXEC_OTHERWISE_CHANGED_PATH\fR is set for every other kind of pathed event
.
.IP "" 0
.
.P
If multiple files changed:
This can be disabled or limited with \fB\-\-no\-environment\fR (doesn\'t set any of these variables) and \fB\-\-no\-meta\fR (ignores metadata changes)\.
.
.SS "Read upon startup"
.
.IP "\(bu" 4
\fB$WATCHEXEC_COMMON_PATH\fR, the longest common path of all of the files that triggered a change
\fB$WATCHEXEC_FILTERER\fR: select the filterer implementation: \fBglobset\fR (default), or \fBtagged\fR (experimental)\.
.
.IP "\(bu" 4
\fB$WATCHEXEC_IGNORE_FILES\fR: a list of paths to additional ignore files to be loaded\.
.
.IP "\(bu" 4
\fB$WATCHEXEC_FILTER_FILES\fR: a list of paths to additional "Tagged" filter files to be loaded (when enabled)\.
.
.IP "\(bu" 4
\fB$RUST_LOG\fR: use for advanced verbose logging configuration\. Refer to tracing\-subscriber for documentation\.
.
.IP "" 0
.
.SH "FILES"
.
.SS "Supported project ignore files"
.
.IP "\(bu" 4
Git: \fB\.gitignore\fR at project root and child directories, \fB\.git/info/exclude\fR, and the file pointed to by \fBcore\.excludesFile\fR in \fB\.git/config\fR\.
.
.IP "\(bu" 4
Mercurial: \fB\.hgignore\fR at project root and child directories\.
.
.IP "\(bu" 4
Bazaar: \fB\.bzrignore\fR at project root\.
.
.IP "\(bu" 4
Darcs: \fB_darcs/prefs/boring\fR
.
.IP "\(bu" 4
Fossil: \fB\.fossil\-settings/ignore\-glob\fR
.
.IP "\(bu" 4
Ripgrep/Watchexec/generic: \fB\.ignore\fR at project root and child directories\.
.
.IP "" 0
.
.P
Note that VCS ignore files (Git, Mercurial, Bazaar, Darcs, Fossil) are only used if the corresponding VCS is discovered to be in use for the project/origin\. For example, a \fB\.bzrignore\fR in a Git repository will be discarded\.
.
.SS "Supported global ignore files"
.
.IP "\(bu" 4
Git (if core\.excludesFile is set): the file at that path
.
.IP "\(bu" 4
Git (otherwise): the first found of \fB$XDG_CONFIG_HOME/git/ignore\fR, \fB%APPDATA%/\.gitignore\fR, \fB%USERPROFILE%/\.gitignore\fR, \fB$HOME/\.config/git/ignore\fR, \fB$HOME/\.gitignore\fR\.
.
.IP "\(bu" 4
Bazaar: the first found of \fB%APPDATA%/Bazzar/2\.0/ignore\fR, \fB$HOME/\.bazaar/ignore\fR\.
.
.IP "\(bu" 4
Watchexec: the first found of \fB$XDG_CONFIG_HOME/watchexec/ignore\fR, \fB%APPDATA%/watchexec/ignore\fR, \fB%USERPROFILE%/\.watchexec/ignore\fR, \fB$HOME/\.watchexec/ignore\fR\.
.
.IP "" 0
.
.P
Note that like for project files, Git and Bazaar global files will only be used for the corresponding VCS as used in the project\.
.
.SH "EXAMPLES"
Rebuild a project when source files change:
.

View File

@ -64,6 +64,7 @@
<a href="#DESCRIPTION">DESCRIPTION</a>
<a href="#OPTIONS">OPTIONS</a>
<a href="#ENVIRONMENT">ENVIRONMENT</a>
<a href="#FILES">FILES</a>
<a href="#EXAMPLES">EXAMPLES</a>
</div>
@ -80,7 +81,7 @@
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p>watchexec [<code>--exts</code> | <code>-e</code> <var>extensions</var>]... [<code>--filter</code> | <code>-f</code> <var>pattern</var>]... [<code>--ignore</code> | <code>-i</code> <var>pattern</var>]... [<code>--watch</code> | <code>-w</code> <var>path</var>]... [<code>--restart</code> | <code>-r</code>] [<code>--clear</code> | <code>-c</code>] [<code>--postpone</code> | <code>-p</code>] [<code>--force-poll</code> <var>interval</var>] [<code>--debounce</code> | <code>-d</code> <var>interval</var>] [<code>--no-vcs-ignore</code>] [<code>--no-default-ignore</code>] [<code>--verbose</code> | <code>-v</code>] [<code>--changes-only</code>] [<code>--version</code> | <code>-V</code>] [--] <var>command</var> [<var>argument</var>...]</p>
<p>watchexec [<code>--exts</code> | <code>-e</code> <var>extensions</var>]... [<code>--filter</code> | <code>-f</code> <var>pattern</var>]... [<code>--ignore</code> | <code>-i</code> <var>pattern</var>]... [<code>--watch</code> | <code>-w</code> <var>path</var>]... [<code>--restart</code> | <code>-r</code>] [<code>--clear</code> | <code>-c</code>] [<code>--postpone</code> | <code>-p</code>] [<code>--force-poll</code> <var>interval</var>] [<code>--debounce</code> | <code>-d</code> <var>interval</var>] [<code>--no-vcs-ignore</code>] [<code>--no-default-ignore</code>] [<code>--verbose</code> | <code>-v</code> | <code>-vv</code> | <code>-vvv</code> | <code>-vvvv</code>] [<code>--changes-only</code>] [<code>--version</code> | <code>-V</code>] [--] <var>command</var> [<var>argument</var>...]</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
@ -135,10 +136,13 @@
<dt><code>-p</code>, <code>--postpone</code></dt><dd><p>Postpone execution of <var>command</var> until the first file modification is detected.</p></dd>
<dt><code>--force-poll</code> <var>interval</var></dt><dd><p>Poll for changes every <var>interval</var> ms instead of using system-specific notification mechanisms (such as inotify). This is useful when you are monitoring NFS shares.</p></dd>
<dt><code>-d</code>, <code>--debounce</code></dt><dd><p>Set the timeout between detected change and command execution, to avoid restarting too frequently when there are many events; defaults to 100ms.</p></dd>
<dt><code>--no-vcs-ignore</code></dt><dd><p>Skip loading of version control system (VCS) ignore files. By default, watchexec loads .gitignore files in the current directory (or parent directories) and uses them to populate the ignore list.</p></dd>
<dt><code>--no-default-ignore</code></dt><dd><p>Skip default ignore statements. By default, watchexec ignores common temporary files for you, for example <code>*.swp</code>, <code>*.pyc</code>, and <code>.DS_Store</code>.</p></dd>
<dt><code>-v</code>, <code>--verbose</code></dt><dd><p>Prints diagnostic messages to STDERR.</p></dd>
<dt><code>--changes-only</code></dt><dd><p>Prints the paths that have changed as diagnostics to STDERR, but not everything else that <code>--verbose</code> prints.</p></dd>
<dt><code>--no-vcs-ignore</code></dt><dd><p>Skip loading of version control system (VCS) ignore files. By default, watchexec loads .gitignore, .hgignore, and other such files in the current directory (or child directories as applicable) and uses them to filter change events.</p></dd>
<dt><code>--no-project-ignore</code>, <code>--no-ignore</code> (deprecated alias)</dt><dd><p>Skip loading of project-local ignore files (include VCS ignore files). By default, watchexec loads .ignore, .gitignore, .hgignore, and other such files in the current directory (or child directories as applicable) and uses them to filter change events.</p></dd>
<dt><code>--no-default-ignore</code></dt><dd><p>Skip default ignore statements. By default, watchexec ignores common temporary files for you, for example <code>*.swp</code>, <code>*.pyc</code>, and <code>.DS_Store</code>, as well as the data directories of known VCS: <code>.bzr</code>, <code>_darcs</code>, <code>.fossil-settings</code>, <code>.git</code>, <code>.hg</code>, <code>.pijul</code>, and <code>.svn</code>.</p></dd>
<dt><code>--no-global-ignore</code></dt><dd><p>Skip loading of global ignore files. By default, watchexec loads $HOME/.gitignore and other such global files and uses them to filter change events.</p></dd>
<dt><code>-v</code>, <code>--verbose</code>, <code>-vv</code>, etc</dt><dd><p>Prints diagnostic and debugging messages to STDERR. Increase the amount of <code>v</code>s to get progressively more output: for bug reports use <strong>three</strong>, and for deep debugging <strong>four</strong> can be helpful.</p></dd>
<dt><code>--print-events</code>, <code>--changes-only</code> (deprecated alias)</dt><dd><p>Prints the events (changed paths, etc) that have triggered an action to STDERR.</p></dd>
<dt><code>-N</code>, <code>--notify</code></dt><dd><p>Sends desktop notifications on command start and command end.</p></dd>
<dt><code>-V</code>, <code>--version</code></dt><dd><p>Print the version of watchexec.</p></dd>
<dt><code>-h</code>, <code>--help</code></dt><dd><p>Print a help message.</p></dd>
</dl>
@ -146,26 +150,64 @@
<h2 id="ENVIRONMENT">ENVIRONMENT</h2>
<p>Processes started by watchexec have environment variables set describing the modification(s) observed. Which variable is set depends on how many modifications were observed and/or what type they were.</p>
<p>In variables that contain lists of paths, the separator is as for the <code>$PATH</code> environment variable (a colon, or semicolon on Windows).</p>
<p>If a single file changed (depending on the event type):</p>
<h3 id="Set-on-child-processes">Set on child processes</h3>
<p>Processes started by watchexec have environment variables set describing the changes observed.</p>
<p><code>$WATCHEXEC_COMMON_PATH</code> is set to the longest common path of all of the below variables, and so should be prepended to each path to obtain the full/real path.</p>
<ul>
<li><code>$WATCHEXEC_CREATED_PATH</code>, the path of the file that was created</li>
<li><code>$WATCHEXEC_REMOVED_PATH</code>, the path of the file that was removed</li>
<li><code>$WATCHEXEC_RENAMED_PATH</code>, the path of the file that was renamed</li>
<li><code>$WATCHEXEC_WRITTEN_PATH</code>, the path of the file that was modified</li>
<li><code>$WATCHEXEC_META_CHANGED_PATH</code>, the path of the file whose metadata changed</li>
<li><code>$WATCHEXEC_CREATED_PATH</code> is set when files/folders were created</li>
<li><code>$WATCHEXEC_REMOVED_PATH</code> is set when files/folders were removed</li>
<li><code>$WATCHEXEC_RENAMED_PATH</code> is set when files/folders were renamed</li>
<li><code>$WATCHEXEC_WRITTEN_PATH</code> is set when files/folders were modified</li>
<li><code>$WATCHEXEC_META_CHANGED_PATH</code> is set when files/folders' metadata were modified</li>
<li><code>$WATCHEXEC_OTHERWISE_CHANGED_PATH</code> is set for every other kind of pathed event</li>
</ul>
<p>If multiple files changed:</p>
<p>This can be disabled or limited with <code>--no-environment</code> (doesn't set any of these variables) and <code>--no-meta</code> (ignores metadata changes).</p>
<h3 id="Read-upon-startup">Read upon startup</h3>
<ul>
<li><code>$WATCHEXEC_COMMON_PATH</code>, the longest common path of all of the files that triggered a change</li>
<li><code>$WATCHEXEC_FILTERER</code>: select the filterer implementation: <code>globset</code> (default), or <code>tagged</code> (experimental).</li>
<li><code>$WATCHEXEC_IGNORE_FILES</code>: a list of paths to additional ignore files to be loaded.</li>
<li><code>$WATCHEXEC_FILTER_FILES</code>: a list of paths to additional "Tagged" filter files to be loaded (when enabled).</li>
<li><code>$RUST_LOG</code>: use for advanced verbose logging configuration. Refer to tracing-subscriber for documentation.</li>
</ul>
<h2 id="FILES">FILES</h2>
<h3 id="Supported-project-ignore-files">Supported project ignore files</h3>
<ul>
<li>Git: <code>.gitignore</code> at project root and child directories, <code>.git/info/exclude</code>, and the file pointed to by <code>core.excludesFile</code> in <code>.git/config</code>.</li>
<li>Mercurial: <code>.hgignore</code> at project root and child directories.</li>
<li>Bazaar: <code>.bzrignore</code> at project root.</li>
<li>Darcs: <code>_darcs/prefs/boring</code></li>
<li>Fossil: <code>.fossil-settings/ignore-glob</code></li>
<li>Ripgrep/Watchexec/generic: <code>.ignore</code> at project root and child directories.</li>
</ul>
<p>Note that VCS ignore files (Git, Mercurial, Bazaar, Darcs, Fossil) are only used if the corresponding VCS is discovered to be in use for the project/origin. For example, a <code>.bzrignore</code> in a Git repository will be discarded.</p>
<h3 id="Supported-global-ignore-files">Supported global ignore files</h3>
<ul>
<li>Git (if core.excludesFile is set): the file at that path</li>
<li>Git (otherwise): the first found of <code>$XDG_CONFIG_HOME/git/ignore</code>, <code>%APPDATA%/.gitignore</code>, <code>%USERPROFILE%/.gitignore</code>, <code>$HOME/.config/git/ignore</code>, <code>$HOME/.gitignore</code>.</li>
<li>Bazaar: the first found of <code>%APPDATA%/Bazzar/2.0/ignore</code>, <code>$HOME/.bazaar/ignore</code>.</li>
<li>Watchexec: the first found of <code>$XDG_CONFIG_HOME/watchexec/ignore</code>, <code>%APPDATA%/watchexec/ignore</code>, <code>%USERPROFILE%/.watchexec/ignore</code>, <code>$HOME/.watchexec/ignore</code>.</li>
</ul>
<p>Note that like for project files, Git and Bazaar global files will only be used for the corresponding VCS as used in the project.</p>
<h2 id="EXAMPLES">EXAMPLES</h2>
<p>Rebuild a project when source files change:</p>
@ -221,7 +263,7 @@
<ol class='man-decor man-foot man foot'>
<li class='tl'></li>
<li class='tc'>July 2021</li>
<li class='tc'>February 2022</li>
<li class='tr'>watchexec(1)</li>
</ol>

View File

@ -88,7 +88,7 @@ Skip loading of version control system (VCS) ignore files. By default, watchexec
Skip loading of project-local ignore files (include VCS ignore files). By default, watchexec loads .ignore, .gitignore, .hgignore, and other such files in the current directory (or child directories as applicable) and uses them to filter change events.
* `--no-default-ignore`:
Skip default ignore statements. By default, watchexec ignores common temporary files for you, for example `*.swp`, `*.pyc`, and `.DS_Store`, as well as the data directories of the VCS system in use (e.g. `.git` if you use Git, `.svn` for Subversion, etc).
Skip default ignore statements. By default, watchexec ignores common temporary files for you, for example `*.swp`, `*.pyc`, and `.DS_Store`, as well as the data directories of known VCS: `.bzr`, `_darcs`, `.fossil-settings`, `.git`, `.hg`, `.pijul`, and `.svn`.
* `--no-global-ignore`:
Skip loading of global ignore files. By default, watchexec loads $HOME/.gitignore and other such global files and uses them to filter change events.