Skip to content

fix(diff): compare normalized lines so CRLF-only differences are skipped (#11) - #12

Merged
sujal-maheshwari2004 merged 2 commits into
priompt:mainfrom
montionugera:fix/issue-11
Oct 18, 2026
Merged

sujal-maheshwari2004 merged 2 commits into
priompt:mainfrom
montionugera:fix/issue-11

Conversation

@montionugera

Copy link
Copy Markdown
Contributor

Closes #11

Summary

  • Normalizes line endings via splitLines before comparing prompt content in diffCmd (via changedLines), so files differing only by CRLF vs LF line endings (e.g. under core.autocrlf on Windows) are skipped instead of printed as no changes.
  • Adds TestChangedLines unit tests covering CRLF vs LF, mixed line endings, and content differences.

Verification

  • go test -v ./... passes.

@sujal-maheshwari2004
sujal-maheshwari2004 merged commit 91d19bb into priompt:main Oct 18, 2026
1 check passed
@sujal-maheshwari2004

Copy link
Copy Markdown
Member

Thanks! Verified: go test ./... passes. I merged main in, resolving against the new -fail-on/new verdict code and keeping your normalised comparison.

@sujal-maheshwari2004

Copy link
Copy Markdown
Member

Hi @montionugera, thanks again for this fix for #11. The change itself looks good.

On our side, this PR was merged without the maintainer review that main now requires, and that slip was ours, not yours. To keep everything on main reviewed, we're reverting it in #33.

Could you open a new pull request with the same change? From an up-to-date main, after #33 merges:

git checkout -b fix/issue-11-crlf origin/main
git cherry-pick eb51429   # your original commit from fix/issue-11

We'll review it promptly. Sorry for the extra round trip, and thank you for contributing.

sujal-maheshwari2004 added a commit that referenced this pull request Nov 15, 2026
… are skipped (#11) (#12)" (#33)

This reverts commit 91d19bb.

The change was merged without the required maintainer review. It is being
reverted so it can come back through a reviewed pull request; reverting does
not imply a problem with the change itself. Reopens #11.
sujal-maheshwari2004 added a commit that referenced this pull request Nov 15, 2026
The changedLines helper this branch used came from #12, which was reverted
in #33. Use a small sameIgnoringLineEndings helper instead so promote does
not depend on that change.
sujal-maheshwari2004 added a commit that referenced this pull request Nov 15, 2026
changedLines came from #12, reverted in #33; use sameIgnoringLineEndings
and import slices directly.
sujal-maheshwari2004 added a commit that referenced this pull request Nov 15, 2026
…<to> (#29)

* fix(promote): refuse to run on a dirty tree and never strand HEAD on <to>

promote round-trips through a checkout of <to>. go-git's Checkout only
refuses unstaged edits, so staged edits and staged new files were reset away
with exit 0, and when it did refuse it had already moved HEAD, leaving the
user on <to> with their work in the tree.

promote now checks for staged or modified tracked files up front and stops
with "commit or stash first" (untracked files are fine; the checkout leaves
them alone). If the checkout of <to> still fails, HEAD is restored to the
branch or commit the user started on.

Fixes #14
Fixes #15

* fix(promote): don't treat CRLF-only checkouts as uncommitted changes

go-git ignores core.autocrlf when it has to hash a file (a racy index entry
right after a checkout, or a touched file), so a clean CRLF checkout of an LF
blob shows as modified and the new clean-tree check would block promote on
Windows. A worktree-modified file now only counts when it differs from HEAD
by more than line endings (changedLines).

* fix(promote): rewrite CRLF-only files instead of letting go-git's checkout refuse

The previous commit let a CRLF-only file through promote's own check, but
go-git's Checkout hits the same false positive and refuses with "worktree
contains unstaged changes" (TestPromoteAllowsLineEndingOnlyDifferences
failed). Such files are now rewritten with their committed content before
the round trip; only their line endings change, as for every file go-git
checks out. Checkout Force was not an option: it deletes untracked files.

* refactor(promote): compare line endings with a local helper

The changedLines helper this branch used came from #12, which was reverted
in #33. Use a small sameIgnoringLineEndings helper instead so promote does
not depend on that change.
sujal-maheshwari2004 added a commit that referenced this pull request Nov 15, 2026
changedLines came from #12, reverted in #33; use sameIgnoringLineEndings
and import slices directly.
sujal-maheshwari2004 added a commit that referenced this pull request Nov 15, 2026
…sh one branch (#31)

* fix(publish): send committed content, refuse non-serving branches, push one branch

push -server and publish read prompts from the working tree and sent them
with no Branch or Message, so on git branch dev an uncommitted edit went live
on the server's main (what agents read). push also used go-git's default
refspec and pushed every local branch.

- Inside a repo, prompts are read from the HEAD commit; a prompt with
  uncommitted changes is refused. A CRLF checkout of an LF blob is not a
  change (go-git ignores core.autocrlf when it hashes racy/touched files).
- Without -branch, only git main/master/prod may publish to server main;
  other branches must name the server branch with -branch.
- Each version carries the HEAD commit subject and hash as its message.
- push pushes only the current branch and refuses a detached HEAD.
- Outside a git repo, publish still sends plain files as they are on disk.

Fixes #16

* refactor(publish): compare line endings with a local helper

changedLines came from #12, reverted in #33; use sameIgnoringLineEndings
and import slices directly.
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.

diff reports CRLF-only differences as 'no changes' instead of skipping them

2 participants