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 — Read git's yes/no and on/off booleans in get_value by rawsun007 · Pull Request #2229 · gitpython-developers/GitPython

Conversation

@rawsun007

@rawsun007 rawsun007 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

This pull request was written by Claude Code (Claude Opus 5) working through @rawsun007's account, identified here per CONTRIBUTING.md's "Prevent agent impersonation". The facts below were measured locally; @rawsun007 has not reviewed the diff line by line yet and will answer review comments himself.

GitConfigParser disagrees with itself about the same file. getboolean (from ConfigParser) accepts all of git's boolean spellings; get_value handled only true/false, under a comment saying it tries "boolean values as git uses them":

value get_value() getboolean() git config --type=bool
yes 'yes' True true
no 'no' False false
on 'on' True true
off 'off' False false
true / false True / False same same

Returning them as strings is worse than merely inexact: "no" and "off" are non-empty, so

if repo.config_reader().get_value("core", "someflag"):

is True for a value git reads as false, and nothing raises.

_string_to_value now recognises the same spellings getboolean does. Non-boolean values are untouched ("meld" stays a string) and numeric values keep their current behaviour.

Deliberately not included: get_value also diverges on numeric bases and suffixes — "0x10" and "1k" come back as strings where git reads 16 and 1024, and "010" becomes 10 where git reads octal 8. Those change a value rather than its type, so they belong in their own commit; happy to send that separately.

Validation: test_get_value_reads_git_boolean_spellings covers the ten spellings and asserts the two accessors agree — it fails on the parent commit. test/test_config.py passes (40 passed, 2 skipped). ruff check and ruff format --check clean at the repo's line length. test/test_repo.py errors on my clone because init-tests-after-clone.sh has not been run; unchanged by this commit.

Sorry, something went wrong.

Uh oh!

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

All reactions
rawsun007 and others added 2 commits September 7, 2026 12:10
@rawsun007
Read git's yes/no and on/off booleans in get_value
5fd795a
git accepts yes/no and on/off for a boolean as well as true/false
(git_parse_maybe_bool_text in parse.c), and ConfigParser.getboolean on this
class already accepted all of them. _string_to_value handled only true/false,
under a comment claiming to "try boolean values as git uses them", so the two
accessors disagreed about the same file:

    value   get_value()   getboolean()   git config --type=bool
    yes     'yes'         True           true
    no      'no'          False          false
    on      'on'          True           true
    off     'off'         False          false

Returning them as strings was worse than merely inexact. "no" and "off" are
non-empty, so a caller testing the result of get_value got True for a value
git reads as false — the inversion is silent, since nothing raises.

_string_to_value now recognises the same spellings getboolean does. A value
that is not a boolean is untouched, so "meld" is still returned as a string,
and numeric values keep their existing behavior.

Not changed here: get_value also diverges on numeric bases and suffixes
("0x10" and "1k" come back as strings, "010" as 10 where git reads octal 8).
Those change the value rather than its type and are worth their own commit.

Validation: test_get_value_reads_git_boolean_spellings covers the ten
spellings and asserts the two accessors agree; it fails on the previous
revision. test/test_config.py passes (40 passed, 2 skipped), ruff check and
ruff format are clean. test/test_repo.py errors on this clone because
init-tests-after-clone.sh has not been run, unchanged by this commit.
@Byron
review
297cd26
@Byron

Byron commented Sep 7, 2026

Copy link
Copy Markdown
Member

Thanks, great catch!

All reactions

Sorry, something went wrong.

Uh oh!

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

@Byron
Byron merged commit b62e91b into gitpython-developers:main Sep 7, 2026
53 checks passed

Uh oh!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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

@rawsun007 @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.