| From: | 夏侯莯昍 <xiahoumuxuan(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | [PATCH] Keep git-external-diff usage text from executing |
| Date: | 2026-10-21 04:16:49 |
| Message-ID: | CAMPOERnKK-vNtc_Ooddb9WGbDepGi1=pxOFfiGrb4_Cqzyu69w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
src/tools/git-external-diff is a Bash script, but its usage text is enclosed
in the Perl POD markers =comment and =cut. Bash therefore tries to execute
the prose and the embedded git config/git diff examples on each invocation.
The attached patch changes only those two delimiters to a quoted no-op
here-document. This preserves the text literally, without executing it or
performing shell expansions, and leaves the actual diff code unchanged.
The patch was prepared against master at
3cde90ecc5f85e7c6cb9fba29d473b2f6dd40ee1.
Validation:
- bash -n and git diff --check pass.
- The attached standalone test passes all three cases with the patch;
all three fail against the unmodified master file. It records Git calls
rather than allowing the documentation examples to change configuration
or invoke another diff. It covers unchanged content, context diffs with
spaced paths, and custom DIFF_OPTS=-u.
- A separate integration check using real Git in an isolated temporary
repository produces the expected context diff and leaves configuration
unchanged.
Run the standalone test with an explicit path to the file under test:
python3 test_git_external_diff.py /path/to/postgres/src/tools/git-external-diff
This was originally proposed to IvorySQL; its maintainers asked that this
inherited tool change be sent upstream first:
https://github.com/IvorySQL/IvorySQL/pull/2510
AI assistance was used to prepare the patch, tests, and this message.
The reported validation results are from actual local runs.
Regards,
zmuxuny
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Make-git-external-diff-usage-text-a-shell-comment.patch | text/plain | 1.2 KB |
| test_git_external_diff.py | text/plain | 3.1 KB |
| test_git_integration.py | text/plain | 1.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sho Ito | 2026-10-21 05:12:12 | Re: [PATCH v1] Fix tab completion for DROP INDEX CONCURRENTLY |
| Previous Message | jian he | 2026-10-21 04:12:41 | nodeWindowAgg.c IGNORE NULLS abs overflow |