From: Junio C Hamano Date: Fri, 26 Sep 2025 17:15:00 GMT Subject: Re: [PATCH 2/2] libgit-rs: add get_bool() method to ConfigSet Message-ID: In-Reply-To: <9e53f617-1b17-4d36-9c35-fc86c0ddfb19@gmail.com> Phillip Wood writes: > On 25/09/2025 12:44, ionnss via GitGitGadget wrote: >> From: ionnss >> Add support for parsing boolean configuration values in the Rust >> ConfigSet API. The method follows Git's standard boolean parsing >> rules, accepting true/yes/on/1 as true and false/no/off/0 as false. >> The implementation reuses the existing get_string() infrastructure >> and adds case-insensitive boolean parsing logic. > > It's nice to know that someone is using the rust bindings. The code in > contrib/libgit-rs is intended to be safe wrappers around the unsafe > functions in contrib/libgit-sys which wrap git's C code. I think what > we need to do here is add a binding for git_configset_get_bool() to > libgit-sys and then wrap that in libgit-rs. We don't want to start > implementing the parsing separately as they'll inevitably end up > behaving differently to git. For example what you have here parses > "00" or "100" differently to git. > > Thanks Thanks for paying attention to an important detail on the design criteria. As this is a binding to allow Rust programs to access the feature implemented and offered by Git, I fully agree that reimplementing what Git does in an incompatible way in Rust would not help the targetted intended audiences at all (that is better off done in a project that aims to reimplement what Git does, like gitoxide, targetting native Rust solution). If I were not paying attention, I would very likely have missed the misparses of number-as-bool, distracted and blinded by the prettier and nicer syntax the language offers over the original in C X-<. Thanks.