git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: ionnss via GitGitGadget <gitgitgadget@gmail.com>,
	 git@vger.kernel.org, ions <zara.leonardo@gmail.com>,
	 Josh Steadmon <steadmon@google.com>
Subject: Re: [PATCH 2/2] libgit-rs: add get_bool() method to ConfigSet
Date: Fri, 26 Sep 2025 10:15:00 -0700	[thread overview]
Message-ID: <xmqqy0q1b0ff.fsf@gitster.g> (raw)
In-Reply-To: <9e53f617-1b17-4d36-9c35-fc86c0ddfb19@gmail.com> (Phillip Wood's message of "Fri, 26 Sep 2025 10:58:04 +0100")

Phillip Wood <phillip.wood123@gmail.com> writes:

> On 25/09/2025 12:44, ionnss via GitGitGadget wrote:
>> From: ionnss <zara.leonardo@gmail.com>
>> 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.

  reply	other threads:[~2025-09-26 17:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25 11:44 [PATCH 0/2] libgit-rs: add get_bool() method to ConfigSet ions via GitGitGadget
2025-09-25 11:44 ` [PATCH 1/2] po: fix escaped underscores in README.md ionnss via GitGitGadget
2025-09-25 11:44 ` [PATCH 2/2] libgit-rs: add get_bool() method to ConfigSet ionnss via GitGitGadget
2025-09-26  6:43   ` Chris Torek
2025-09-26  9:58   ` Phillip Wood
2025-09-26 17:15     ` Junio C Hamano [this message]
2025-09-27  0:07 ` [PATCH v2 0/3] " ions via GitGitGadget
2025-09-27  0:07   ` [PATCH v2 1/3] po: fix escaped underscores in README.md ionnss via GitGitGadget
2025-09-27  0:07   ` [PATCH v2 2/3] libgit-rs: add get_bool() method to ConfigSet ionnss via GitGitGadget
2025-09-27  0:07   ` [PATCH v2 3/3] libgit-rs: address review feedback for get_bool() ionnss via GitGitGadget
2025-09-27  2:01   ` [PATCH v2 0/3] libgit-rs: add get_bool() method to ConfigSet Junio C Hamano
2025-09-27  3:51   ` [PATCH v3 " ions via GitGitGadget
2025-09-27  3:51     ` [PATCH v3 1/3] po: fix escaped underscores in README.md ionnss via GitGitGadget
2025-09-29 13:26       ` Phillip Wood
2025-09-27  3:51     ` [PATCH v3 2/3] libgit-rs: add get_bool() method to ConfigSet ionnss via GitGitGadget
2025-09-29 13:23       ` Phillip Wood
2025-09-27  3:51     ` [PATCH v3 3/3] libgit-rs: add get_ulong() and get_pathname() methods ionnss via GitGitGadget
2025-09-29 13:23       ` Phillip Wood
2025-09-30  8:46     ` [PATCH v4] libgit-rs: add get_bool(), get_ulong(), " ions via GitGitGadget
2025-10-01 10:15       ` Phillip Wood
2025-10-06 21:20         ` brian m. carlson
2025-10-08 13:36           ` Phillip Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqy0q1b0ff.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=phillip.wood123@gmail.com \
    --cc=steadmon@google.com \
    --cc=zara.leonardo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).