You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Second follow-up left open by #48, alongside --latexdiff. Reports diff(1)'s
statuses: 0 when nothing differs, 1 when something does, 2 when the run
itself failed.
The 1-vs-2 split is the whole feature. A pipeline that cannot separate "the
project differs" from "the run failed" reads an expired session cookie as a
content change, and a job that goes red for the wrong reason sends whoever
reads the log looking for a diff that was never computed. All ten failure
paths in the command move to 2 together, so no failure can be mistaken for
a difference. Without the flag they stay 1, as in every other command, so
existing scripts are unaffected.
The status is set rather than exited on. process.exit discards whatever is
still buffered on a non-TTY stdout, and `olcli diff --exit-code > patch.txt`
is exactly a large patch going into a pipe: exiting outright truncated a
1.5 MB patch to the 128 KB pipe buffer here, losing 91% of it mid-hunk.
The gate covers whatever was compared, so --file narrows it the way a
git diff --exit-code pathspec does, and under --latexdiff it reports on the
project rather than on the markup - a changed figure is a real difference
even though a marked-up root document cannot show one.
Refs #48
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,12 @@ All notable changes to this project will be documented in this file.
17
17
- Placed next to the root document rather than at the project root, so relative `\includegraphics` and `\bibliography` paths resolve exactly as they do for the document it was built from
18
18
- A compile failure writes the CLSI log next to the marked-up source instead of reporting only a status, and deletes a PDF left by an earlier run rather than leaving one that describes a different revision. The compile runs against the project, so a `.sty` or `.cls` that exists only locally is the usual cause and the message says so. A missing *figure* is not: Overleaf draws a placeholder box naming the file and still reports success
19
19
-**`src/latexdiff.ts`** - root document detection, argument construction, output naming and failure interpretation are functions over data, unit-tested with no Overleaf account and no `latexdiff` binary. 21 tests, in the suite CI already runs
20
+
-**`olcli diff --exit-code` makes the command a CI gate** ([#48](https://github.com/aloth/olcli/pull/48)) - the second follow-up left open when the core `diff` command shipped in 0.10.0. It reports `diff(1)`'s statuses: `0` when nothing differs, `1` when something does, `2` when the run itself failed
21
+
- The `1` vs `2` split is the whole feature. A pipeline that cannot separate "the project differs" from "the run failed" reads an expired session cookie as a content change, and a job that goes red for the wrong reason sends whoever reads the log looking for a diff that was never computed. All ten failure paths in the command move to `2` together - bad flag combinations, a missing directory, an unresolvable project, a `latexdiff` that is not installed, a failed remote compile - so no failure can be mistaken for a difference
22
+
- Failures stay `1` when the flag is absent, which is what every other command exits, so scripts that check `olcli diff` for success are unaffected
23
+
- The status is *set* rather than exited on. `process.exit` discards whatever is still buffered on a non-TTY stdout, and `olcli diff --exit-code > patch.txt` is exactly a large patch going into a pipe: measured here, exiting outright truncated a 1.5 MB patch to the 128 KB pipe buffer and lost 91% of it mid-hunk. Returning lets node flush first
24
+
- The gate covers whatever was compared, so `--file` narrows it to one file the way a `git diff --exit-code` pathspec does, and a `--file` matching nothing is `0` rather than an error. Under `--latexdiff` it reports on the project rather than on the markup - a changed figure is a real difference even though a marked-up root document cannot show one
25
+
- Exit statuses and the "unchanged files are not differences" rule are pinned by unit tests in `test/diff.test.ts`; `test/e2e.sh` gains eight cases covering the clean tree, a difference, `--file` narrowing, the redirected-output case and both failure statuses
0 commit comments