Skip to content

Review several local files with repeated --path - #121

Open
devhimanshuhc wants to merge 1 commit into
prooflinedev:mainfrom
devhimanshuhc:feat/review-multiple-paths
Open

devhimanshuhc wants to merge 1 commit into
prooflinedev:mainfrom
devhimanshuhc:feat/review-multiple-paths

Conversation

@devhimanshuhc

Copy link
Copy Markdown

Who it helps

People who run proofline review on local changes that Proofline refuses as a whole. The CLI refuses a local patch over 5 MiB, over 3,000 files, or with any text that is not UTF-8. A regenerated lockfile, a vendored directory or one Latin-1 test fixture is enough. The only way around it was --path, which takes one file. Reviewing the five files you actually changed meant five reviews, five uploads and five charges, and cross-file findings were lost because each review saw one file.

Change

  • --path now repeats: proofline review --path src/a.rs --path src/b.rs sends one patch with exactly those files.
    • Naming both sides of a rename keeps it a rename.
    • Duplicate paths are harmless.
    • The existing rules for each path still apply: literal, repository-relative, no directories, globs or ... One refused path stops the whole review before anything is sent, so a typo never uploads a partial selection.
  • The three whole-patch refusals (too large, too many files, not UTF-8) now end with ; to review some of the files, name each one with --path FILE when no --path was given.
  • check_paths validates every path with one git ls-files against the scratch index and one git ls-tree against the base, so the number of git processes does not grow with the number of paths.
  • Hooks, --commit, --range and --pr are unchanged. --json, exit codes, the index-preserving scratch index and the secret preflight all behave as before. The README documents the repeatable flag.

Decisions

  • Repeat the flag rather than add --exclude. --allow-path and --files already take lists, and naming what to review keeps the literal, no-glob rules --path has today.
  • No new cap on the number of paths. The existing 3,000-file and 5 MiB patch limits still apply to the result.
  • Show the hint only without --path. Someone who already selected files and is still over the limit needs a smaller selection, not the same advice again.

Verification

  • New tests in tests/local_patch.rs. All three fail on unmodified main and pass with this change:
    • repeated_local_paths_select_several_literal_files_and_a_rename: four changed files, three selected (one named twice, one is a git mv). The upload has exactly 3 sections, the rename stays rename from/rename to, the unselected file is absent, and the real index is byte-for-byte unchanged.
    • one_invalid_local_path_refuses_every_path_before_http: a valid path plus a directory, a missing file or ... The refusal names the bad path and makes no HTTP request.
    • an_unreviewable_patch_names_path_and_a_selection_reviews_the_rest: a Latin-1 file makes the plain review refuse with the --path FILE hint and no request. --path kept.txt then uploads only the other file.
  • The existing single---path tests pass unchanged.
  • cargo fmt --check and cargo clippy --locked --all-targets -- -D warnings are clean. cargo test --locked --no-fail-fast passes everything except unattended_registration_preserves_settings_and_uses_the_installed_binary, which fails the same way on unmodified main on macOS (unattended_registration_preserves_settings_and_uses_the_installed_binary fails on macOS (/var vs /private/var) #112).

`proofline review --path` took one file, so a person whose local change
was refused as too large, too many files or not UTF-8 had to review the
files they cared about one review at a time. --path now repeats: the
selected files go into one patch, both sides of a rename stay a rename,
and every path is checked before anything is sent. Those three refusals
now suggest --path when no path was named.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant