Skip to content

A commit a shallow clone was cut at reads SKIP, not PASS, for whitespace, with a warning - #94

Open
closer-claudio wants to merge 1 commit into
mainfrom
claudio/20261116-whitespace-not-checked
Open

closer-claudio wants to merge 1 commit into
mainfrom
claudio/20261116-whitespace-not-checked

Conversation

@closer-claudio

Copy link
Copy Markdown

🎯 Why

In a shallow clone, the commit the clone was cut at cannot have its whitespace checked: its parents are not there, and git shows it as adding the whole tree. The dangling-whitespace rule skipped it, said so under -D only, and reported a pass.

A run with no range in a clone of depth 1, as actions/checkout makes by default, so checked no whitespace, printed PASS and said nothing: #93.

🛠️ What

A rule's result has a third state: not checked, neither a pass nor a failure.

  • git.Check returns ErrParentsNotHere for such a commit, where it returned nothing.
  • The rule's result is not checked. Under -v its line is - SKIP - whitespace not checked: the commit's parents are not in this shallow clone.
  • The commit's own line, and the exit status, are the verdict of the rules that ran.
  • A warning on standard error names the commit and what to do, at every verbosity, -q included: fetch the history, or give a range the clone holds.

A deeper clone only moves the commit: a run with no range reaches the cut whatever the depth, so the warning asks for the history or a range, not for one more commit.

What a consumer of the report sees: one SKIP rule line under -v where a PASS line was, in a shallow clone, and a warning on standard error. Commit lines and the exit status do not move.

🧪 How

  1. V: TestContractWhitespaceNotCheckedInAShallowClone (cmd/git-validation/contract_test.go), through the command: a clone of depth 1 under -v, at normal verbosity and under -q (the SKIP line or its absence, the warning with the commit each time, exit 0); every rule together (the commit passes on the others); a clone of depth 2 with no range (the head checked, the cut skipped, one warning) and with a range it holds (checked, nothing logged).
  2. V: TestContractANotCheckedResultIsNeither (validate/contract_test.go): how such a result is counted.
  3. V: measured one at a time, files restored: with the skipped check reported as a pass, with the warning lowered to debug, and with a not-checked result counted as a failure, 1 fails each time, and 2 with the last.
  4. V: just lint and just test pass.
  5. U: the clones on Windows; this pull request's checks are the measure.

📝 Notes

UPSTREAM.md's row on -D loses the skipped check, which is no longer a debug record. The README says what a shallow clone prints.

For #93.

…ace, with a warning

In a shallow clone the commit the clone was cut at cannot have its
whitespace checked: its parents are not there, and git shows it as
adding the whole tree. The rule skipped it, said so under -D only, and
reported a pass. A run with no range in a clone of depth 1, as
actions/checkout makes by default, so checked no whitespace, printed
PASS and said nothing.

A result has a third state now: not checked, neither a pass nor a
failure.

- git.Check returns ErrParentsNotHere for such a commit, where it
  returned nothing.
- The rule's result is not checked. Under -v its line is
  `  - SKIP - whitespace not checked: the commit's parents are not in
  this shallow clone`.
- The commit's own line, and the exit status, are the verdict of the
  rules that ran.
- A warning on standard error names the commit and what to do, at every
  verbosity, -q included: fetch the history, or give a range the clone
  holds.

A deeper clone only moves the commit: a run with no range reaches the
cut whatever the depth, so the warning asks for the history or a range
and not for one more commit.

What a consumer of the report sees: one `SKIP` rule line under -v where
a `PASS` line was, in a shallow clone. Commit lines and the exit status
do not move.

TestContractWhitespaceNotCheckedInAShallowClone holds, through the
command: a clone of depth 1 under -v, at normal verbosity and under -q
(the SKIP line or its absence, the warning with the commit each time,
exit 0); every rule together (the commit passes on the others); a clone
of depth 2 with no range (the head checked, the cut skipped, one
warning) and with a range it holds (checked, nothing logged).
TestContractANotCheckedResultIsNeither holds how such a result is
counted. Measured one at a time, files restored: with the skipped check
reported as a pass, with the warning lowered to debug, and with a
not-checked result counted as a failure, the command's test fails each
time, and the counting test with the last.

UPSTREAM.md's row on -D loses the skipped check, which is no longer a
debug record; the README says what a shallow clone prints.

For #93.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
@closer-claudio

Copy link
Copy Markdown
Author

Reviewed at d5e96f5

1 similar comment
@closer-claudio

Copy link
Copy Markdown
Author

Reviewed at d5e96f5

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