gh-stack icon indicating copy to clipboard operation
gh-stack copied to clipboard

`gh stack submit` with PULL_REQUEST_TEMPLATE.md that has `CRLF` line endings

Open MelDommer opened this issue 4 months ago • 2 comments

Problem Submit is rendering extra line endings when it sees CRLF. Opening in the $EDITOR also has these extra line endings.

Descirption When developing on Windows, it is common for git to normalize line endings to CRLF and then back to LF on commit.

On Windows, given a template with the following:

Image

It opens in the submit editor like this (each red mark is an extra newline):

Image

I replaced CRLF with LF, and then it works fine.

I have workarounds, just a minor inconvenience.

MelDommer avatar Jul 31 '26 16:07 MelDommer

Hi! I'd be happy to take this on. I traced the relevant flow to the shared PR-template ingestion path. My plan is to add a focused table-driven regression covering LF, CRLF, mixed line endings, YAML front matter, and intentional Markdown blank lines, then normalize CRLF to LF at that boundary so interactive and non-interactive submit paths receive the same content without collapsing layout. I'll keep the patch scoped to template handling. Please let me know if you prefer a different boundary.

newbpydev avatar Aug 09 '26 23:08 newbpydev

Hi @skarim — quick update: I have the fix and regression tests ready at https://github.com/newbpydev/gh-stack/tree/fix/pr-template-crlf. GitHub is currently rejecting pull-request creation from my fork with a CreatePullRequest permission error, which appears consistent with PR creation being restricted to collaborators. If you would still like this contribution, could you grant the necessary access or let me know your preferred submission path? I can open the PR immediately afterward.

newbpydev avatar Aug 10 '26 16:08 newbpydev