Skip to content

Commit

Permalink
Merge pull request #96 from stepchowfun/skip-git-hg
Browse files Browse the repository at this point in the history
Skip over `.git` and `.hg`
  • Loading branch information
stepchowfun authored Oct 23, 2020
2 parents 7dca517 + ddb2337 commit 4e23d64
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 23 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.3] - 2020-10-23

### Changed
- Tagref now always skips two hidden directories: `.git` and `.hg`.

## [1.3.2] - 2020-10-23

### Changed
- Tagref no longer skips hidden files.
- Tagref no longer skips hidden files and directories.

## [1.3.1] - 2020-07-30

Expand Down
47 changes: 27 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tagref"
version = "1.3.2"
version = "1.3.3"
authors = ["Stephan Boyer <stephan@stephanboyer.com>"]
edition = "2018"
description = "Tagref helps you refer to other locations in your codebase."
Expand Down
11 changes: 10 additions & 1 deletion src/walk.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ignore::{WalkBuilder, WalkState};
use ignore::{overrides::OverrideBuilder, WalkBuilder, WalkState};
use std::{
fs::File,
path::{Path, PathBuf},
Expand All @@ -23,6 +23,15 @@ pub fn walk<T: 'static + Clone + Send + FnMut(&Path, File)>(
// Traverse the filesystem in parallel.
WalkBuilder::new(path)
.hidden(false)
.overrides(
OverrideBuilder::new("")
.add("!.git/")
.unwrap() // Safe by manual inspection
.add("!.hg/")
.unwrap() // Safe by manual inspection
.build()
.unwrap(),
)
.build_parallel()
.run(|| {
// These clones will be moved into the closure below, and that closure will be sent
Expand Down

0 comments on commit 4e23d64

Please sign in to comment.