Skip to content

Commit a22d8dd

Browse files
committed
Invert logic
--quiet Disable all output of the program. Implies --exit-code. --exit-code Make the program exit with codes similar to diff(1). That is, it exits with 1 if there were differences and 0 means no differences.
1 parent 66a78c6 commit a22d8dd

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

.readthedocs.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@ build:
1919
# https://docs.readthedocs.io/en/stable/build-customization.html#cancel-build-based-on-a-condition
2020
#
2121
# Cancel building pull requests when there aren't changed in the docs directory.
22-
# `--quiet` exits with a 1 when there **are** changes,
23-
# so we invert the logic with a !
2422
#
25-
# If there are no changes (exit 0) we force the command to return with 183.
23+
# If there are no changes (git diff exits with 0) we force the command to return with 183.
2624
# This is a special exit code on Read the Docs that will cancel the build immediately.
2725
- |
2826
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ];
2927
then
30-
! git diff --quiet origin/main -- docs/ && exit 183;
28+
git diff --quiet origin/main -- docs/ && exit 183;
3129
fi
3230
3331
search:

docs/user/build-customization.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,13 @@ Here is an example that cancels builds from pull requests when there are no chan
140140
jobs:
141141
post_checkout:
142142
# Cancel building pull requests when there aren't changed in the docs directory.
143-
# `--quiet` exits with a 1 when there **are** changes,
144-
# so we invert the logic with a !
145143
#
146-
# If there are no changes (exit 0) we force the command to return with 183.
144+
# If there are no changes (git diff exits with 0) we force the command to return with 183.
147145
# This is a special exit code on Read the Docs that will cancel the build immediately.
148146
- |
149147
if [ "$READTHEDOCS_VERSION_TYPE" = "external" ];
150148
then
151-
! git diff --quiet origin/main -- docs/ && exit 183;
149+
git diff --quiet origin/main -- docs/ && exit 183;
152150
fi
153151
154152

0 commit comments

Comments
 (0)