Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gitpython-developers/GitPython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main@{1day}
Choose a base ref
...
head repository: gitpython-developers/GitPython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 4 commits
  • 3 files changed
  • 2 contributors

Commits on Jun 8, 2025

  1. Refactor quote parsing, to prepare for more checks

    This refactors ConfigParser double-quote parsing near the single
    line double-quoted value parsing code, so that:
    
    - Code that parses the name is less intermixed with code that
      parses the value.
    
    - Conditional logic is less duplicated.
    
    - The `END` comment notation appears next to the code it describes.
    
    - The final `else` can be turned into one or more `elif` followed
      by `else` to cover different cases of `"..."` differently. (But
      those are not added here. This commit is purely a refactoring.)
    
    (The `pass` suite when `len(optval) < 2 or optval[0] != '"'` is
    awkward and not really justified right now, but it looks like it
    may be able to help with readabilty and help keep nesting down
    when new `elif` cases are added.)
    EliahKagan committed Jun 8, 2025
    Configuration menu
    Copy the full SHA
    c8e4aa0 View commit details
    Browse the repository at this point in the history
  2. Add tests of ConfigParser with "..." with " or \ inside

    These are cases where just removing the outer quotes without doing
    anything to the text inside does not give the correct result, and
    where keeping the quotes may be preferable, in that it was the
    long-standing behavior of `GitConfigParser`.
    
    That this was the long-standing behavior may justify bringing it
    back when the `"`-`"`-enclosed text contains such characters, but
    it does not justify preserving it indefinitely: it will still be
    better to parse the escape sequences, at least in the type case
    that all of them in a value's representation are well-formed.
    EliahKagan committed Jun 8, 2025
    Configuration menu
    Copy the full SHA
    7bcea08 View commit details
    Browse the repository at this point in the history
  3. Don't remove quotes if \ or " are present inside

    This is for single line quoting in the ConfigParser.
    
    This leaves the changes in #2035 (as adjusted in #2036) intact for
    the cases where it addressed #1923: when the `...` in `"..."`
    (appearing in the value position on a single `{name} = {value}"`
    line) has no occurrences of `\` or `"`, quote removal is enough.
    
    But when `\` or `"` does appear, this suppresses quote removal.
    This is with the idea that, while it would be better to interpret
    such lines as Git does, we do not yet do that, so it is preferable
    to return the same results we have in the past (which some programs
    may already be handling themselves).
    
    This should make the test introduced in the preceding commit pass.
    But it will be even better to support more syntax, at least
    well-formed escapes. As noted in the test, both the test and the
    code under test can be adjusted for that.
    
    (See comments in #2035 for context.)
    EliahKagan committed Jun 8, 2025
    Configuration menu
    Copy the full SHA
    f2b8041 View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2025

  1. Merge pull request #2048 from EliahKagan/conservative-quote-removal

    Don't remove quotes if `\` or `"` are present inside
    Byron authored Jun 9, 2025
    Configuration menu
    Copy the full SHA
    85c8155 View commit details
    Browse the repository at this point in the history
Loading