Skip to content

Commit 1de9d59

Browse files
authored
Merge pull request #27 from lucatescari/fix/status-show-untracked-files
fix: status lists untracked filter-marked files; warn on plaintext blobs
2 parents b60726b + e9a67e1 commit 1de9d59

6 files changed

Lines changed: 844 additions & 119 deletions

File tree

CONTRIBUTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ cargo build
2525
cargo test
2626
```
2727

28-
All 95 tests should pass (33 unit + 40 integration + 16 GPG integration + 6 cross-compatibility). They cover:
28+
All 112 tests should pass (34 unit + 56 integration + 16 GPG integration + 6 cross-compatibility). They cover:
2929
- AES-256-CTR encryption/decryption round-trips
3030
- HMAC-SHA1 known-answer vectors
3131
- Key file TLV serialization/deserialization
@@ -34,6 +34,8 @@ All 95 tests should pass (33 unit + 40 integration + 16 GPG integration + 6 cros
3434
- Key name validation
3535
- Full E2E: init → encrypt → lock → unlock (integration)
3636
- Status, export-key, quiet mode, error messages (integration)
37+
- Status: default focused output (tracked + untracked filter-marked only), `(untracked)` suffix on untracked filter files to distinguish prospective vs actual encryption, `-a/--all` includes non-filter files, `-e` only files with encrypted blob, `-u` only WARNING files needing re-encryption, WARNING + summary for filter-marked files with plaintext blob, named-key filter, filenames with spaces, clear error outside a git repo, works without `gitveil init`, `-f` skips files deleted from the working tree, gitignored files are excluded (integration)
38+
- Status: `has_git_crypt_filter` recognizes default and named-key filters (unit)
3739
- Edge cases: empty files, binary files, multi-key lock (integration)
3840
- Pipe deadlock regression: many-file and large-blob status, unlock, lock (integration)
3941
- Global config: XDG resolution, keyring path save/load/remove, permissions (unit)

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,19 +285,27 @@ Omit the output file to write to stdout.
285285

286286
### `gitveil status`
287287

288-
Show encryption status of tracked files.
288+
Show the encryption status of files in the repository.
289289

290290
```
291-
gitveil status [-e] [-u] [-f]
291+
gitveil status [-e] [-u] [-a | --all] [-f | --fix]
292292
```
293293

294294
| Option | Description |
295295
|--------|-------------|
296-
| `-e` | Show only encrypted files |
297-
| `-u` | Show only unencrypted files |
298-
| `-f, --fix` | Re-encrypt files that should be encrypted but aren't |
296+
| _(none)_ | List files marked for encryption (the actionable set), tracked + untracked |
297+
| `-e` | Show only files whose committed blob is encrypted |
298+
| `-u` | Show only files marked for encryption whose blob is plaintext (the set needing re-encryption — pair with `-f` to fix) |
299+
| `-a, --all` | Include files **without** the git-crypt filter too (verbose `git-crypt`-style listing) |
300+
| `-f, --fix` | Re-stage tracked files whose committed blob is plaintext but should be encrypted (skips files deleted from the working tree; never auto-adds untracked files) |
299301

300-
The status command uses batched subprocesses (3 total, regardless of repo size) instead of spawning one per file. On a Unity project with ~4,000 files it completes in ~130 ms vs ~65 seconds for git-crypt -- roughly 500x faster.
302+
By default, status is focused on files governed by a git-crypt filter — for a large repo this is the actionable subset. Tracked **and** untracked filter-matched files are shown. Use `-a/--all` for the full `git-crypt`-style listing that also includes non-filter files.
303+
304+
When a filter-marked file's committed blob is plaintext (typically because it was staged before `.gitattributes` took effect), `*** WARNING ***` is appended to its line and a summary at the end suggests `gitveil status -f`. Untracked filter-marked files appear with an `(untracked)` suffix to make it clear that the file on disk is still plaintext — it'll be encrypted on staging.
305+
306+
Works without `gitveil init` -- the command is informational and can be used to audit filter coverage before initializing. If filter-marked files were committed without init, status surfaces them as WARNINGs.
307+
308+
Performance: at most one `git ls-files` per category, one batched `git check-attr`, and one batched `git cat-file` regardless of repo size. On a Unity project with ~4,000 files it completes in ~130 ms vs ~65 seconds for git-crypt -- roughly 500x faster.
301309

302310
## Named Keys
303311

src/cli.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,23 @@ pub enum Commands {
8585
output_file: Option<PathBuf>,
8686
},
8787

88-
/// Display the encryption status of tracked files
88+
/// Display the encryption status of files in the repository
8989
Status {
90-
/// Show only encrypted files
90+
/// Show only files whose blob is encrypted
9191
#[arg(short = 'e')]
9292
encrypted_only: bool,
9393

94-
/// Show only unencrypted files
94+
/// Show only files marked for encryption whose blob is plaintext
95+
/// (the set needing re-encryption — pair with -f to fix)
9596
#[arg(short = 'u')]
9697
unencrypted_only: bool,
9798

98-
/// Re-encrypt files that should be encrypted but aren't
99+
/// Show every file, including files without the git-crypt filter
100+
/// (verbose git-crypt-style listing)
101+
#[arg(short = 'a', long = "all")]
102+
all: bool,
103+
104+
/// Re-stage files that should be encrypted but aren't
99105
#[arg(short = 'f', long)]
100106
fix: bool,
101107
},

0 commit comments

Comments
 (0)