From nobody Thu Jun 06 21:45:42 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VwHvC1bC8z5N4WK; Thu, 06 Jun 2024 21:45:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VwHvC14hlz42sc; Thu, 6 Jun 2024 21:45:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717710343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=shIXXEWC6pV5OKtziTlZUjyJybo/5NFZMkbFsyWbIcs=; b=Gai27TXE1ZzYQqB4+XgLflXIfyihr2DKvRgje46wAB6fCk2bHGz3ir5Q0GT6LGUSXXi72S xEhGX/q5d58/bv/XZXxlkEVWMKaBryOWeQ9OJAqcCaveWFR/BR7iStIe3EsQSi1HKaHan/ MYyM8nqc2Ne36HVthFFZWTdhWe49XlwKugG2lNt2uFP25ronZfKKA0mqt6QwS2ZojpHT+q EJ0yCDwUqV1xhiWgCXmU48Tp9r1xspVEl2SAzkvAVWvDM6UzaOFvIMI+U/RJBefW2Ies7M KKG+VMmalYwYBQqkHjfMnEdHpjGSP6vj7wPdJIlZ25bH3ynNiTuJsj46v4XX6w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717710343; a=rsa-sha256; cv=none; b=fUNRPis6UxC13sColFJ0QuONbEaIDrqEGXmVgpEdogTcqRpAsblB5czXKJ/YnYh7mUfnLQ TegHoUc/oyjHB6JoVLiWQnlo/p7KEKLa7s+wJv2Mjv0SJfARZKXGL9VJbn/YCV/4Vb5fsk SLakhg5QVcmDHp2Vif/JfFWFYiypHDOVxUzjDoFnwYltoYHZxjottgbrBcr+9hFXOhX1Yc ZCt3CT0Hu6U6TtEHGs6rI4qh2Fk0tT00HY+DH+w9/3sSwvod/lbmER7tAIfLon1icXTqEG eL4Sf9Ccaud1R2LGOOGZrTv36Fs7XoZtiotWg0iNgYkv4xTCEz0WJXlV0jOv5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717710343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=shIXXEWC6pV5OKtziTlZUjyJybo/5NFZMkbFsyWbIcs=; b=xzkWCWzna39Jds6j8DoX7Qp0sf3jeV5CHraIcBSSP0IR4bHU0wKMPF1pX5P53zk5B5SNAh m2hkHft/9h2KRqL6KFOKUYaj4KcvkQGQYaGb+7KXHKsKdYYcA8fPqeTtd+jsCdwWZu262D 6TmNJMIqUxJ3unHSx+PsFpx3LaTcNko6kdXZRqe3Ltc1YtF5iuYpTofOv1+OOTh93zN3hG 8Stchr9Z96nh0q9v6GOurynHsG7UEA887ITWhPSyIbJR1gFM7EhYrjskVu5cT1Oftv4gJh EiY2Bd6EiDMdj0rsSUxGwpSDdPpEXn8L3WrvSMLIr2CjLspOwsALThH/N2V42A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VwHvC0h3nz132W; Thu, 6 Jun 2024 21:45:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 456LjgtB048481; Thu, 6 Jun 2024 21:45:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 456LjgOV048478; Thu, 6 Jun 2024 21:45:42 GMT (envelope-from git) Date: Thu, 6 Jun 2024 21:45:42 GMT Message-Id: <202406062145.456LjgOV048478@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a2c88e0d47ac - main - git-arc: Use a helper function to fetch boolean config variables List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2c88e0d47acb1a33016cbb7a821465fa1e357a6 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a2c88e0d47acb1a33016cbb7a821465fa1e357a6 commit a2c88e0d47acb1a33016cbb7a821465fa1e357a6 Author: John Baldwin AuthorDate: 2024-06-06 21:45:30 +0000 Commit: John Baldwin CommitDate: 2024-06-06 21:45:30 +0000 git-arc: Use a helper function to fetch boolean config variables Requested by: markj Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D45104 --- tools/tools/git/git-arc.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/tools/git/git-arc.sh b/tools/tools/git/git-arc.sh index e8da1f1ed32a..e9398a60d2f7 100644 --- a/tools/tools/git/git-arc.sh +++ b/tools/tools/git/git-arc.sh @@ -147,6 +147,16 @@ __EOF__ exit 1 } +# +# Fetch the value of a boolean config variable ($1) and return true +# (0) if the variable is true. The default value to use if the +# variable is not set is passed in $2. +# +get_bool_config() +{ + test "$(git config --bool --get $1 2>/dev/null || echo $2)" != "false" +} + # # Filter the output of call-conduit to remove the warnings that are generated # for some installations where openssl module is mysteriously installed twice so @@ -378,7 +388,7 @@ gitarc__create() list= prev="" - if [ "$(git config --bool --get arc.list 2>/dev/null || echo false)" != "false" ]; then + if get_bool_config arc.list false; then list=1 fi doprompt=1 @@ -672,7 +682,7 @@ gitarc__update() local commit commits diff doprompt have_msg list o msg list= - if [ "$(git config --bool --get arc.list 2>/dev/null || echo false)" != "false" ]; then + if get_bool_config arc.list false; then list=1 fi doprompt=1 @@ -727,7 +737,7 @@ gitarc__update() set -e ASSUME_YES= -if [ "$(git config --bool --get arc.assume-yes 2>/dev/null || echo false)" != "false" ]; then +if get_bool_config arc.assume-yes false; then ASSUME_YES=1 fi @@ -801,7 +811,7 @@ list|patch) ;; esac -if [ "$(git config --bool --get arc.browse 2>/dev/null || echo false)" != "false" ]; then +if get_bool_config arc.browse false; then BROWSE=--browse fi