GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Reject comments after implicit boolean config keys by Byron · Pull Request #2239 · gitpython-developers/GitPython

Conversation

@Byron

@Byron Byron commented Sep 13, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex GPT-6.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Git rejects bare config keys followed by # or ; comments. GitPython previously accepted those lines with the comment in the option name, and an = or : inside the comment could make the line look like an assignment.

Exclude comment markers from the shared option-name expression and require a full-line match for valueless options. Reading or editing these entries now raises ParsingError. Ordinary bare keys retain their implicit true value.

Validation

  • Six regression cases compare rejection directly with Git, covering both markers, whitespace and adjacent comments, and assignment delimiters inside comments.
  • The regression checks both boolean reads and attempted edits raise ParsingError, and a failed edit leaves the original file untouched. All six cases failed before full-line matching was added.
  • Python 3.12.14: 42 configuration tests and six regression subtests passed; two existing tests skipped.
  • Ruff lint and formatting and git diff --check passed.
  • Tix change vxuttnt, commit 2d4f068 (fix: reject comments after implicit boolean config keys).
  • The single codex review --commit 2d4f0683341cb77e75a8656484d3c09a441f9d22 attempt could not complete because the Codex CLI refresh token has expired.

Git reference

Inspected Git checkout 1630431f326e15fcde608827b5ff38422528eb59, particularly config.c:get_value. Without an assignment, Git requires the line to end after the key and optional whitespace. Git 2.50.1 (Apple Git-155) rejects all six regression inputs with exit status 128.

Reported issue

The compatibility requirement was clarified to match Git's rejection of these entries. Original report:

Follow-up to PR 2238:

This matches the valueless-option regex against the unprocessed line, so a valid Git entry such as enabled # comment (or enabled ; comment) is stored with the comment text in the option name instead of as enabled. A write-back then emits that text as part of the key, and getboolean("flag", "enabled") still cannot find the option; strip the unquoted comment before extracting the name and add a regression for it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI lite review requested due to automatic review settings September 13, 2026 16:08
Copilot started reviewing on behalf of Byron September 13, 2026 16:08
View session
Copilot AI reviewed Sep 13, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟢 Approval recommended

The reviewed changes and regression coverage address the stated parsing issue.

Pull request overview

Fixes parsing and round-tripping of implicit boolean keys followed by # or ; comments.

Changes:

  • Stops option matching at comment markers.
  • Adds regression coverage for parsing, boolean access, and write-back.
File summaries
File Summary
test/test_config.py Adds comment-handling regression tests.
git/config.py Updates assignment and valueless-key regex handling.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Byron
Byron force-pushed the 2238-follow-up branch from 42566c6 to 0087d89 Compare September 13, 2026 17:12
Copilot AI review requested due to automatic review settings September 13, 2026 17:12
@Byron

Byron commented Sep 13, 2026

Copy link
Copy Markdown
Member Author

Actually these have to be rejected, just like in Git.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Copilot started reviewing on behalf of Byron September 13, 2026 17:13
View session
@Byron @codex
fix: reject comments after implicit boolean config keys
2d4f068
Note that this is just a fixup, on a huge hack which is the native
git-config parsing. Let's just hope this holds up until v4.

<!-- agent -->
GitConfigParser accepted entries such as "enabled # comment" and
"enabled ; comment" even though Git rejects them. The comment became
part of the option name, and an equals sign or colon inside the comment
could make the entry look like an assignment. Silently stripping the
comment would also accept configuration that Git considers invalid.

Exclude both comment markers from the shared option-name expression and
require a full-line match for valueless options. The assignment pattern
cannot cross a comment marker, and the valueless fallback cannot accept
just the valid-looking prefix. Such lines now raise the existing
ParsingError during reading or an attempted edit. Ordinary bare keys
retain their implicit true value and round-trip behavior.

Add six regression cases covering both markers, spaces, tabs, adjacent
comments, and assignment delimiters inside comments. Compare rejection
with git config, check both getboolean and an unrelated edit raise
ParsingError, and verify that the failed edit leaves the original bytes
untouched. All six cases failed before full-line matching was added.

Git reference: checkout 1630431f326e15fcde608827b5ff38422528eb59,
config.c:get_value. Without an assignment, that parser requires the
line to end after the key and optional whitespace. Runtime comparisons
used Git 2.50.1 (Apple Git-155), which rejected all six inputs with
exit status 128.

Validation on Python 3.12.14: 42 configuration tests and six regression
subtests passed, with two existing skips. Ruff lint and formatting and
git diff --check passed.

Assisted-by: GPT 6.0
Co-authored-by: GPT 6.0 <[email protected]>
Copilot AI reviewed Sep 13, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

🟡 Changes recommended

The parser and regression tests do not implement or verify the intended comment-handling behavior.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread git/config.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread test/test_config.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Byron force-pushed the 2238-follow-up branch from 0087d89 to 2d4f068 Compare September 13, 2026 17:22
@Byron Byron changed the title Ignore comments after implicit boolean config keys Reject comments after implicit boolean config keys Sep 13, 2026
@Byron
Byron merged commit 696e1cb into main Sep 13, 2026
53 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Byron deleted the 2238-follow-up branch September 13, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Byron
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.