| Age | Commit message (Collapse) | Author |
|
`projectile-purge-file-from-cache' writes the updated file list to
disk under persistent caching; the directory variant only mutated
the in-memory hash, so the purged subtree would reappear on the
next Emacs session. Mirror the persistence step here.
|
|
Without this, `projectile-files-cache-expire' combined with persistent
caching ended up re-reading the cache file from disk on every call to
`projectile-project-files' and never reindexing: the TTL check at the
top of `projectile-project-files' evicts the in-memory entry whenever
its cache time is missing, and `projectile-load-project-cache' was
populating only `projectile-projects-cache' on disk loads. Use the
cache file's mtime as the recorded time, so the TTL check sees a real
age and reindexing happens when (and only when) the data is actually
stale.
|
|
`projectile-get-ext-command' had no direct test coverage, so the
non-git VCS branches (hg/svn/bzr/darcs/fossil/pijul/sapling/jj) were
relying on indirect coverage that didn't actually exercise the
dispatch. Add a `describe' block that pins each branch.
Also extend the `projectile-dir-files-alien' tests with two cases
that were previously uncovered: the fd path for git (verifying we
don't also call `projectile-git-deleted-files') and the no-VCS
fallback (verifying the generic command is used).
|
|
Cover the new internal helpers (`projectile--list->set',
`projectile--ignored-file-fast-p', `projectile--ignored-directory-
fast-p') and add end-to-end tests for the previously uncovered
behaviour:
* `projectile-index-directory' honors dirconfig glob ignore patterns
at every directory level - previously only the alien-mode dirconfig
warning had any test coverage for this.
* Ensure (`!') entries in `.projectile' override an ignore pattern.
* `projectile-remove-ignored' drops basename matches, treats `*'-
prefixed ignored-dir entries as any-segment matches, and treats
plain entries as path-prefix matches.
|
|
`+' keep entries had no end-to-end test coverage. Add tests that verify:
* Multiple `+' keep entries trigger a single batched call to the
external command, with the kept paths passed as the new pathspecs
argument.
* The single-keep-dir case keeps going through `projectile-dir-files'
for each subdirectory (no behavioural change there).
* `projectile--restricted-sub-projects-files' returns all submodule
files when no subdirs are supplied, drops files outside the supplied
subdirs when they are, and normalises subdirs without a trailing
slash.
Also add a focused test for the new `pathspecs' argument of
`projectile-files-via-ext-command'.
|
|
The hybrid path through `projectile-dir-files` had zero direct
coverage. Add tests that verify it applies
`projectile-globally-ignored-file-suffixes` and dirconfig ignore
patterns on top of the alien result, and that the resolved VCS is
threaded through to `projectile-dir-files-alien` exactly once.
Also adds a focused test for `projectile-dir-files-alien` honoring an
explicitly supplied VCS argument without re-running
`projectile-project-vcs`.
|
|
The existing projectile-invalidate-cache always tries to also clear
the per-project files cache, which means it either prompts for a
project (with prefix arg) or only operates when you're already in a
project. Users who just created a marker file in a directory that
Projectile previously considered rootless ended up picking an
unrelated project from the prompt just to get the root cache
flushed.
projectile-discard-root-cache is a focused alternative that empties
projectile-project-root-cache only. Wired into the menu next to the
existing 'Invalidate cache' entry; deliberately not bound on the
prefix map since the keymap is already dense.
|
|
- projectile-root-marked: default and custom dirconfig file, miss case
- projectile-root-local: returns the buffer-local var, ignores DIR
- projectile-root-bottom-up: matches a regular-file marker (e.g. git
worktree's .git file)
- projectile-ensure-project: all three projectile-require-project-root
branches (nil / t / 'prompt) plus the dir-non-nil pass-through
- projectile-acquire-root: the success path and the no-root delegation
- projectile-project-root: tramp-archive path unwrap, verified by
observing the directory handed to a stub root function (a
defvar-backed variable is needed because byte-compiled lexical
closures don't propagate setq through cl-letf-mocked dispatch)
|
|
Previously a root function returning nil stored nil in the cache,
which is indistinguishable from a missing entry, so on the next call
the function was re-run. When a project's root is found by the third
function in projectile-project-root-functions, the first two
re-walked the tree on every call - and projectile-project-root is hot
in mode-line / company / spaceline updates.
Store the symbol 'none for unsuccessful entries and treat it as a
cache hit on lookup. The overall-failure marker already used 'none
in a separate slot, so this just extends the same convention to the
per-function entries.
|
|
projectile-root-local reads the buffer-local projectile-project-root
variable rather than inspecting its DIR argument, so caching its
result by (FUNC . DIR) was wrong: two buffers visiting the same
directory but with different file-local overrides would share the
first buffer's cached answer. Skip the cache for this function
specifically - it's a single variable read, no FS work to amortize.
Adds a regression test that visits two buffers with different
file-local roots from the same default-directory and confirms each
sees its own override.
|
|
Per-function entries are now keyed on (FUNC . DIR), and the overall
failure marker on ('none . DIR), instead of formatted strings. Same
equal semantics, no per-call format allocation, and lambda functions
in projectile-project-root-functions hash by identity instead of by
their printed repr.
|
|
The cache value used to be (MTIME . PARSED-RESULT) keyed on the
project root. If the user changed `projectile-dirconfig-file' to
point at a different file mid-session, the old entry kept getting
returned because the key didn't depend on the path. Store the path
alongside the mtime in the cached value and compare both before
considering a hit. The hash key remains the project root so
`projectile-invalidate-cache' continues to work as-is.
|
|
The other two dirconfig warnings (alien-mode bypass and prefix-less
entries) are gated by per-project hash sets so they fire at most
once per Emacs session. The glob-keep warning was the odd one out —
it lived inside the uncached parser and re-fired on every cache
miss, and it emitted one display-warning per offending entry rather
than a single consolidated message.
Move it into the cached wrapper alongside the others, gate it on
projectile--glob-keep-warned-projects, and roll multiple offending
entries into one warning that lists them.
|
|
The implicit "any unprefixed line is an ignore pattern" rule is the
last source of subtle parser surprises — it's the reason why a
single leading space silently changes a +-keep into a literal ignore
pattern, and it makes typo'd comments slip through as ignores.
Mark these lines as :legacy-ignore in the classifier, record them
in a new prefixless-ignore slot on the dirconfig struct, and emit a
one-time warning per project listing the offending entries. The
behavior is unchanged — the lines still go into the ignore list —
but users now get a nudge to write them as -entry. The warning can
be silenced via projectile-warn-on-prefixless-dirconfig-lines.
|
|
The old parser walked a temp buffer with point and pcase'd on
char-after, mixing IO, prefix dispatch, and bucket bookkeeping into
one function. Pull the dispatch out into projectile--dirconfig-classify-line,
which takes a string and returns a (BUCKET . VALUE) tag. The pure
function is unit-testable without buffer plumbing, the IO wrapper
shrinks to a one-shot read + dispatch, and the awkward
(pcase ((pred (lambda ...)) ...)) for the comment-prefix check
becomes a straightforward cond.
No behavior change.
|
|
Replace the positional (KEEP IGNORE ENSURE) triple with a
cl-defstruct. Every internal call site used car/cadr/caddr to pull
out a slot, which is unreadable and error-prone — slot accessors
make the intent explicit and let cl-defstruct grow a fourth field
later without touching every consumer.
Existing callers that compared against the raw triple (a couple of
internal helper tests) are updated to construct the struct with
make-projectile-dirconfig.
|
|
The parser silently turns every keep entry into a directory via
file-name-as-directory, which means a user-typed +*.json or +/foo.txt
becomes "*.json/" or "foo.txt/" and quietly never matches anything.
Spot the obvious misuses (anything containing *, ?, or [) at parse
time and emit a warning so the user can correct the file or move the
pattern to an ignore/ensure rule.
|
|
The existing parser tests stub insert-file-contents; nothing exercises
the full IO path. Add three sandbox-based tests: a mixed +/-/!/no-prefix
file, a non-ASCII round-trip, and a file with no trailing newline. These
guard against IO-layer regressions that the stubbed tests can't see.
|
|
Under alien indexing the dirconfig file is silently ignored, which
is the most common confusion in the issue tracker (#1322, #1075,
#1534, #1941). Show a one-shot display-warning the first time we
index a project where alien mode meets a non-empty .projectile.
The new projectile-warn-when-dirconfig-is-ignored option lets users
who already understand the trade-off silence the warning.
|
|
The mtime-keyed cache around projectile-parse-dirconfig-file had no
direct coverage. Cover the four invariants that matter: a cache hit
on repeat calls, a re-parse when mtime advances, no caching of a nil
result for a missing file, and entry removal via
projectile-invalidate-cache (the path that previously crashed in #1854).
|
|
A user accidentally typing " -path/" or " # comment" in .projectile
would have the line silently routed to the ignore bucket with the
prefix character left intact, because the parser dispatched on the
first character of the line without trimming. Skip leading spaces and
tabs before the pcase so the +/-/! and comment-prefix markers are
matched regardless of indentation. Reported in #1508.
|
|
|
|
- Test projectile-ignored-project-p truename normalization
- Test projectile-determine-find-tag-fn fallback behavior
- Update projectile-files-via-ext-command test for empty string guard
|
|
projectile-get-sub-projects-command returned "" for non-git VCSes,
which passed the stringp guard in projectile-files-via-ext-command
and spawned a useless shell process. Return nil instead, and also
make the guard defensive against empty strings to match the
docstring's contract.
|
|
- Test sort-by-modification-time handles nil file-attributes
- Test projectile--merge-related-files-fns merges correctly across
keys, within same key, and does not mutate original return values
- Test projectile-load-project-cache does not store nil on corrupt
cache files
|
|
- Test that projectile-update-project-type resets cache with 'equal test
- Test safe-local-variable predicates for project settings variables
- Test that projectile-project-type passes project-root through to
detect-project-type
|
|
- projectile-purge-file-from-cache: verify it serializes the updated
file list (not the stale original) to disk
- projectile-default-generic-command: test string commands, symbol
commands, lambda commands, and missing commands
- projectile-sort-by-modification-time: verify descending sort order
- projectile-project-buffer-p: verify the truename cache is used and
avoids redundant file-truename calls
|
|
|
|
Migrate cl-remove-if-not → seq-filter, cl-remove-if → seq-remove,
cl-some → seq-some, cl-every → seq-every-p, cl-find-if → seq-find,
cl-mapcan → mapcan, cl-union → seq-union, cl-sort → seq-sort,
cl-case → pcase, and delete projectile-difference in favor of
seq-difference. Manual replacements for cl-notany, cl-typep, cl-incf,
cl-remove, and cl-subst.
cl-lib is still required for cl-defun, cl-defmethod, cl-loop, cl-letf,
and cl-flet*.
|
|
projectile-root-top-down used projectile-locate-dominating-file which
stops at the first (bottommost) match going up the directory tree.
This made it behave identically to projectile-root-bottom-up.
Add projectile-locate-dominating-file-top-down which walks the entire
directory hierarchy and returns the topmost match. For example, with
nested Makefiles at both project/ and project/subdir/, searching from
project/subdir/ now correctly returns project/ instead of
project/subdir/.
|
|
projectile-project-dirs previously only returned directories that
directly contain files, missing intermediate directories that contain
only subdirectories (e.g. src/ when it only has src/ComponentA/).
Fix by walking each file path's ancestor directories up to the project
root, so all intermediate directories are included.
|
|
- Use cl-remove-if instead of seq-remove for consistency with the rest
of the codebase.
- Remove unnecessary project/.git/ from test fixture (git init creates it).
- Remove unnecessary projectile-indexing-method binding in test.
|
|
When fd is unavailable or disabled, `git ls-files -zco --exclude-standard`
returns files still tracked in the index even if deleted from disk. This
causes projectile-dir-files-alien to list ghost files. Fix by running
`git ls-files -zd` and removing those entries from the result.
|
|
Wrap the directory-files call in ignore-errors so that unreadable
directories (e.g. .Spotlight-V100 on macOS) are silently skipped
instead of aborting the entire native indexing operation.
|
|
Newer fd versions (8.3.0+) prepend "./" to output. The --strip-cwd-prefix
flag was already added to projectile-generic-command and projectile-git-fd-args,
but this flag doesn't exist in older fd versions, causing errors.
Add post-processing in projectile-files-via-ext-command to strip the "./"
prefix from results as a defensive fallback, matching the existing pattern
in projectile-files-from-cmd.
Fixes #1749
|
|
On case-insensitive filesystems (macOS default), a ~/workspace directory
matches the "WORKSPACE" Bazel marker because file-exists-p returns t for
both files and directories. This causes the home directory to be falsely
detected as a Bazel project root, leading to severe performance issues.
Add a (not (file-directory-p ...)) guard in projectile-root-top-down so
that only regular files can satisfy file-type marker checks.
Fixes #1961
|
|
- Include projectile-cache-file in projectile-globally-ignored-files default
- Add :safe predicate to allow dir-locals configuration
- Add tests for default values and :safe predicate validation
- Update related file and test matching functions to use let* variants
- Improve variable binding consistency and future compatibility
|
|
|
|
|
|
|
|
It's now done outside of `projectile-mode`'s init, which should make Projectile
load faster.
* As a side effect the known projects will be initialized properly even if you're not using `projectile-mode`.
* The projects are read from disk the first time you invoke
`projectile-switch-project` or a similar command.
* We no longer do auto-cleanup of known projects when projectile-mode
starts. I'll think about how to handle this in an efficient manner.
|
|
|
|
|
|
|
|
|
|
The presence of an "src/" directory doesn't say anything about the
type of the project. This commit fixes the dotnet sln project type to
rely on the presence of an .sln file instead of the "src/" directory.
|
|
'buffer-list-update-hook"
This reverts commit 3c92d28c056c3553f83a513a35502b4547d29319.
|
|
|
|
|
|
|