Skip to content

worktree stack supports excludes #397

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

Merged
merged 121 commits into from
Apr 30, 2022
Merged
Changes from 1 commit
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
568f013
change!: `Pattern::matches()` is now private (#301)
Byron Apr 21, 2022
0effef0
adapt to changes in git-glob (#301)
Byron Apr 21, 2022
cc1312d
Basic match group pattern matching (#301)
Byron Apr 21, 2022
afbb295
Baseline tests for global excludes and instantiation of pattern lists…
Byron Apr 21, 2022
0852f13
refactor (#301)
Byron Apr 21, 2022
4c9a51e
enforce nicer/unified names so use struct instead of tuple (#301)
Byron Apr 21, 2022
4a1e797
first succeding tests for global repository excludes (#301)
Byron Apr 22, 2022
ac53780
thanks clippy
Byron Apr 22, 2022
99c7b5f
more pendantic baseline parsing (#301)
Byron Apr 22, 2022
457c921
support for loading per-directory pattern lists as well (#301)
Byron Apr 22, 2022
f66c27e
generalize parsing of paths in pattern lists (#301)
Byron Apr 22, 2022
5992883
thanks clippy
Byron Apr 22, 2022
50b8c64
try using compatct_str for attribute storage (#301)
Byron Apr 22, 2022
f1635c3
feat: publicly accessible `Result` type (#301)
Byron Apr 23, 2022
fe9fb4c
refactor (#301)
Byron Apr 23, 2022
f8dd5ce
discover an entirely new class of exclude matches… (#301)
Byron Apr 23, 2022
cd58a1c
adapt to changes in git-glob and add failing test (#301)
Byron Apr 23, 2022
fb65a39
adjust baseline to only handle patterns that work without a dir stack…
Byron Apr 23, 2022
4f6cefc
Allow basename matches to work like before (#301)
Byron Apr 23, 2022
1ab4705
cleanup (#301)
Byron Apr 23, 2022
04ab5d3
also skip negative attribute patterns (#301)
Byron Apr 23, 2022
d80b321
Sketch how attribute states can be used (#301)
Byron Apr 23, 2022
97ee03d
sketch how attribute globals could be used in worktrees (#301)
Byron Apr 23, 2022
eb525f7
Sketch state for handling excludes (#301)
Byron Apr 24, 2022
f7c1920
fix release build
Byron Apr 21, 2022
d87d62d
Sketch state for handling attributes as well (#301)
Byron Apr 24, 2022
4b72045
re-export `git-glob` as its `Case` type is part of the public API (#301)
Byron Apr 24, 2022
ce40add
Add baseline test to motivate implementing ignore file stack (#301)
Byron Apr 24, 2022
2c88b57
feat: add `Default` impl for `pattern::Case` (#301)
Byron Apr 24, 2022
8d1000b
refactor to make push/pop with mutable state work; prepare to read .g…
Byron Apr 24, 2022
0424136
First primitive ignore pattern test works (#301)
Byron Apr 24, 2022
8674c11
Merge branch 'main' into worktree-stack
Byron Apr 25, 2022
e58b771
A baseline test that indicates how excludes aren't using data from th…
Byron Apr 25, 2022
5d619e6
add option to not follow symlinks when reading attribute files (#301)
Byron Apr 25, 2022
dec9f33
A test to check skip-worktree special case with ignore files (#301)
Byron Apr 25, 2022
155bb82
Make .gitignore name overridable (#301)
Byron Apr 25, 2022
475aa6a
refactor (#301)
Byron Apr 25, 2022
b199367
thanks clippy
Byron Apr 25, 2022
9841efb
An attempt to build a lookup table of attribute files, but… (#301)
Byron Apr 25, 2022
6f74f85
doing things directly works fortunately (#301)
Byron Apr 25, 2022
b14904b
refactor (#301)
Byron Apr 25, 2022
4234b84
try to keep borrows to path backing alive but… (#301)
Byron Apr 25, 2022
514e2f4
Fix borrow check issues the fast way, but… (#301)
Byron Apr 25, 2022
645ed50
feat: support for separating lifetimes of entries and path-backing (…
Byron Apr 25, 2022
e525b5e
Use a separate path mapping to enable clone-avoidance (#301)
Byron Apr 25, 2022
e4044a4
Support for shared attribute file names (#301)
Byron Apr 25, 2022
63f0839
fix MSRV (#301)
Byron Apr 25, 2022
883d78d
refactor (#301)
Byron Apr 26, 2022
34d0d5c
wire everything up to have all data where it needs to be, but… (#301)
Byron Apr 26, 2022
910d500
And finally, we can read ignore files from the index, too (#301)
Byron Apr 26, 2022
aeebc5f
thanks clippy
Byron Apr 26, 2022
2659816
customize stack operation to support the notion of directories (#301)
Byron Apr 27, 2022
8345b7c
refactor (#301)
Byron Apr 27, 2022
d078d6e
feat!: mild refactor of paths module to waste less on unix (#301)
Byron Apr 27, 2022
c55cac6
adjustments to go along with changes in git-features (#301)
Byron Apr 27, 2022
8d13f81
add empty git-path crate (#301)
Byron Apr 27, 2022
725e198
Copy all existing functions from git-features::path to git-path:: (#301)
Byron Apr 27, 2022
90611ce
change!: remove `path` module in favor of `git-path` crate (#301)
Byron Apr 27, 2022
47e607d
Use `git-path` crate instead of `git_features::path` (#301)
Byron Apr 27, 2022
9380e99
Use bstr intead of [u8] (#301)
Byron Apr 27, 2022
f158648
adapt to all changes in git-path with bstr support (#301)
Byron Apr 27, 2022
fdec111
thanks clippy
Byron Apr 27, 2022
5480159
refactor!: various name changes for more convenient API (#301)
Byron Apr 27, 2022
cc2d810
adapt to changes in git-path (#301)
Byron Apr 27, 2022
e868acc
The first indication that directory-based excludes work (#301)
Byron Apr 27, 2022
a6532e7
Don't hardcode case in state::Ignore (#301)
Byron Apr 27, 2022
21d4076
refactor (#301)
Byron Apr 27, 2022
e191b72
improved testing… (#301)
Byron Apr 27, 2022
2010ddd
more tests and fixes to assure directory logic in stack works (#301)
Byron Apr 27, 2022
e68cd69
Allow check-ignore style queries with API that doesn't remove trailin…
Byron Apr 27, 2022
6793bab
The stack now allows to change a non-dir into a dir (#301)
Byron Apr 27, 2022
120675d
Test for case-sensitivity as well (#301)
Byron Apr 27, 2022
a331314
frame for `gix repo exclude query` (#301)
Byron Apr 28, 2022
3ff991d
refactor (#301)
Byron Apr 28, 2022
732f6fb
a sketch of basic Worktree support (#301)
Byron Apr 28, 2022
ff76261
sketch `open_index()` on `Worktree`, but… (#301)
Byron Apr 28, 2022
13554f8
feat: new hierarchical errors for value lookup (#301)
Byron Apr 28, 2022
f9aaac1
change!: use `lookup::Error` and `lookup::existing::Error` (#301)
Byron Apr 28, 2022
d011d4e
thanks clippy
Byron Apr 28, 2022
a86b254
change!: remove all `get_` prefixes from methods (#301)
Byron Apr 28, 2022
61ea4c4
Adapt to changes in git-config (#301)
Byron Apr 28, 2022
cb56f12
fix build (#301)
Byron Apr 28, 2022
ca019fc
Release git-path v0.1.0
Byron Apr 28, 2022
8aef1d3
remove all #[inline] attributes (#301)
Byron Apr 28, 2022
a98a7a7
change!: switch from quickerror to thiserror. (#301)
Byron Apr 28, 2022
1e2b239
thanks clippy
Byron Apr 28, 2022
4496b5a
fix build warnings (#301)
Byron Apr 28, 2022
dc3dc3b
feat: support for `try_value()`, `boolean()` and `string()` access`. …
Byron Apr 28, 2022
ffc5dec
Adjust to improvements to the `git-config` API (#301)
Byron Apr 28, 2022
53f27e0
thanks clippy
Byron Apr 28, 2022
732c0fa
Remove IntegerSuffix error which wasn't ever used (#301)
Byron Apr 28, 2022
f11cc44
A first version of opening index files with proper configuration (#301)
Byron Apr 28, 2022
4612fca
A sketch of what can be a general value decode error (#301)
Byron Apr 28, 2022
807b7f8
refactor (#301)
Byron Apr 28, 2022
38dfdcf
change!: remove `values::*Error` in favor of `value::parse::Error`. (…
Byron Apr 28, 2022
2672a25
some tests to check pattern negation (#301)
Byron Apr 28, 2022
455a72e
feat: `fmt::Display` impl for `Pattern`. (#301)
Byron Apr 28, 2022
d29932d
make use of new git-glob::Pattern::to_string() feature (#301)
Byron Apr 28, 2022
a86ed7b
refactor (#301)
Byron Apr 28, 2022
d0c8407
Turn attribute files into a Cow to support other usecases… (#301)
Byron Apr 28, 2022
ed7f223
Revert "Turn attribute files into a Cow to support other usecases… (#…
Byron Apr 28, 2022
7c75eac
feat: `GitConfig::path()` for direct access to paths. (#301)
Byron Apr 28, 2022
8ab219a
feat: `State::path_backing()`. (#301)
Byron Apr 28, 2022
259d015
preliminary access to a fully configured exclusion cache (#301)
Byron Apr 28, 2022
5bf6b52
thanks clippy
Byron Apr 28, 2022
7d98b21
Support for overrides on the command-line (#301)
Byron Apr 29, 2022
de0226a
feat: `permission::Error` (#301)
Byron Apr 29, 2022
97e53f6
Some notes about of 'path' will soon have to be amended with more saf…
Byron Apr 29, 2022
95577e2
feat: A shared `permission::Error` type (#301)
Byron Apr 29, 2022
42a6c8c
Permission controlled access to xdg config (#301)
Byron Apr 29, 2022
a89a667
refactor (#301)
Byron Apr 29, 2022
f802a03
thanks clippy
Byron Apr 29, 2022
cb1c80f
fix build (#301)
Byron Apr 29, 2022
9cb8385
Basic prefix support as well the first working version of `exclude qu…
Byron Apr 29, 2022
e4f4c4b
`path::discover()` now returns the shortest path. (#301)
Byron Apr 29, 2022
09f904b
Add `--show-ignore-patterns` to `gix repo exclude query` (#301)
Byron Apr 30, 2022
7697f51
see if this fixes the CI test issue on windows (#301)
Byron Apr 30, 2022
0c597fe
Allow reading patterns from stdin (#301)
Byron Apr 30, 2022
056e8d2
thanks clippy
Byron Apr 30, 2022
b0b3df4
REMOVE ME: debug info for failing CI test (#301)
Byron Apr 30, 2022
3a41d5c
Don't have expectations on the path, rather deal with it gracefully (…
Byron Apr 30, 2022
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
Prev Previous commit
Next Next commit
doing things directly works fortunately (#301)
Maybe something wrong about the method definition
  • Loading branch information
Byron committed Apr 25, 2022
commit 6f74f8516ba73c35b1b327aae491f70f83eefafd
16 changes: 12 additions & 4 deletions git-worktree/src/fs/cache/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,25 @@ impl State {
a1_backing = [(v.exclude_file_name_for_directories.as_bytes().as_bstr(), true)];
a1_backing.as_slice()
}
State::AttributesAndIgnoreStack { ignore, attributes } => {
State::AttributesAndIgnoreStack { ignore, .. } => {
a2_backing = [
(ignore.exclude_file_name_for_directories.as_bytes().as_bstr(), true),
(".gitattributes".into(), false),
];
a2_backing.as_slice()
}
State::CreateDirectoryAndAttributesStack { attributes, .. } => {
State::CreateDirectoryAndAttributesStack { .. } => {
a1_backing = [(".gitattributes".into(), true)];
a1_backing.as_slice()
}
};

index
.entries_with_paths_by_filter_map(|path, entry| {
.entries()
.iter()
.filter_map(move |entry| {
let path = entry.path(index);

// Stage 0 means there is no merge going on, stage 2 means it's 'our' side of the merge, but then
// there won't be a stage 0.
if entry.mode == git_index::entry::Mode::FILE && (entry.stage() == 0 || entry.stage() == 2) {
Expand All @@ -145,11 +150,14 @@ impl State {
Case::Sensitive => basename == *desired,
Case::Fold => basename.eq_ignore_ascii_case(desired),
};
if !is_match {
continue;
};
// See https://github.com/git/git/blob/master/dir.c#L912:L912
if *is_ignore && !entry.flags.contains(git_index::entry::Flags::SKIP_WORKTREE) {
return None;
}
return Some(entry.id);
return Some((path, entry.id));
}
None
} else {
Expand Down