Skip to content

Conversation

@felipecrs
Copy link

@felipecrs felipecrs commented Nov 24, 2025

Describe the pull request

When UnescapeValueDoubleQuotes is enabled, the parser now correctly handles multiline double-quoted values that contain backslash line continuations. Previously, it would incorrectly stop at intermediate quotes before a continuation, causing key-value delimiter not found errors.

The fix checks if a line ends with a backslash after finding a closing quote, and continues reading if so, ensuring the actual closing quote is found.

Fixes parsing of values like:

# ~/.gitconfig

[alias]
hello = "!f() { \
  echo "hello world"; \
};f"

Link to the issue: n/a

Checklist

  • I agree to follow the Code of Conduct by submitting this pull request.
  • I have read and acknowledge the Contributing guide.
  • I have added test cases to cover the new code.

When UnescapeValueDoubleQuotes is enabled, properly handle multiline
values where backslash continuations appear after quotes within the
value. Previously caused "key-value delimiter not found" errors.
@felipecrs
Copy link
Author

felipecrs commented Nov 24, 2025

Hi @unknwon, apologies for the ping.

I know the project has been quiet, and I'm not requesting a review. I just wanted to ask whether this PR (or any other one) has any chance of being merged.

It fixes an important issue for me, and I'm trying to decide whether I should wait or consider maintaining a fork.

Thank you.

@unknwon
Copy link
Member

unknwon commented Dec 1, 2025

Hey @felipecrs, thanks for the ping! I might be able to give a human-review some time this week, but can't commit on a timeline due to holiday travels!

@felipecrs
Copy link
Author

Thanks a lot, @unknwon!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a parsing bug where multi-line double-quoted values with backslash line continuations would fail with "key-value delimiter not found" errors. The issue occurred when inner quotes appeared on lines ending with backslashes - the parser would incorrectly treat these inner quotes as closing quotes. The fix adds logic to check if a line ends with a backslash after finding a quote, and continues reading if so.

Key changes:

  • Enhanced readMultilines function to detect backslash continuations after quotes
  • Added test coverage for git config-style multi-line quoted values with inner quotes
  • Preserves existing behavior when IgnoreContinuation option is enabled

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
parser.go Added backslash continuation detection in readMultilines to prevent premature quote closure when lines end with backslashes
ini_test.go Added test case verifying multi-line double-quoted values with backslash continuations and inner quotes parse correctly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

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.

2 participants