From patchwork Mon Dec 9 16:50:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Eldar X-Patchwork-Id: 13900044 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48E31145B18 for ; Mon, 9 Dec 2024 16:51:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763083; cv=none; b=Mm5dsOXI4ekhwf1KKogplWrgJZNcgWnwC4wJW7aOpD+iGlsQnOine4urflvfQZb9nbm1PXB6NfQY5QEHJQdi1tItAWG693thFz3iYLzfg5iBxRBC1hadGapprbidHiBfN/vVAEMwQ5yNIMm6tyxuIrJrYxBmrRS0EtL5Jl9uSFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763083; c=relaxed/simple; bh=1OQ3GAwFz7FYXr8pVPz1MKEZeg0MI469s8Ls6Uzc2+4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WackUTpczDRvyEneAsJ6eL8Ar+yS1swAARE1T21JpGkdMgDat0VaCOk/nw17yxFyg8GfnYTZAxBepjQ+6ZrKCAYAc6igx4Gpd1GKl6tsKdr8Fz3RCFV7FTCRh03ZcaEq1e0gWhXytPyQwWeGO2G21NpI4ILvj3JGHcmPyBLVVCQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Mr5gChzw; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Mr5gChzw" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-5d3cd821c60so269570a12.3 for ; Mon, 09 Dec 2024 08:51:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733763079; x=1734367879; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WV0fTLWmm6YG6cgWUVjxRbRAxVrlwq00vVpaHsKjHEk=; b=Mr5gChzwuzV7UpA5gzjBgXBORkHZIFm+VUQKlgtXmEM73ngT/jDNh/LY3XhFFo9+PK 5opJLl7Mk8sq9MmmeLQhz1e6QHXBdXXXJm4XIvz+Ny+mi6uIKPa6XYjw+Cg49MV5UX4p dnTxzuKRl6hwSyV7m5/ZbXGIw1u7hgCemV6CvHC16Qq40Pk4EaXDPiAK6yC6JtQz0yLL L1KHSKdHD/fgyLv8kiGBEWlVgLNc38e/XwJ7tChKQdfBwHe8apcwVFcu/4OT993B6C/L DTl77fbJ4s+sxGZ1Zrdt36/o8MGOa3SMEMtWegHQ+IzIkNd03R5YfHdT2N+7YW/yWkCr Daiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733763079; x=1734367879; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WV0fTLWmm6YG6cgWUVjxRbRAxVrlwq00vVpaHsKjHEk=; b=goFJhDIzFb46ie+sItRe5rFFKfC+OTmTLeTzGxg4WoQcDRcMvfJevV4y1VSIgLICah x5bNOKpEpQdbJElrpfSXjGb9aKcdChISyfjT/DFYKVC4JQI5sbCLwwMI9xUEuHctPq9D DPsb/dL2MPKRPScvma7u2Gi7psWqKQ/3TDSR92rSMO3nrtqKoTEtyVeQW9Zsts4P/Tod ygcVkQfAz824wbP85SLdpM4izIOKhLJ2MoX2UpNyZ3HV6HPW9Q9n67+goCMXZ093U2Yp C57PmG7KomroQvfY2Wd8iqBB37li8G86lDWrG3cfzRmaf8B/rA1/2KGD8SzwwaXpoW+9 tkKg== X-Gm-Message-State: AOJu0YzdFtyahAzv+hNdTYucyq99HVLhrNL4zPq6PHttVSTGO5R7yRi5 LpT+a8+oiLjGmfUvWvTXtYjWswKw/6GhI+wCCQ5qv1wJCDUzrZsKipOr4+zt X-Gm-Gg: ASbGncufYRLB0cdEBD0/+jmz//8Rd2kp6kis+L8E0RPeTE0S9QDOAHCMxm+8SfLgkch /YjdtRJnkUQuOeiIMAb7C1rjmPx/EljaZmLy23VnwoyMvjJxw/YTnmwHadMSwfgJlPfk0FEuYUm QwYXaQS7nfaQr+mZF2TFVDsHeRF58Vz9F29zEv18kL9cDemmc4/tCvHwbE/6JRQQ1YO+Olj386e F0vg7VwMWmpDF8QrQJm12fKZ6E5YYKoLHk92ZhVzo2H+bEryZ0lj838dGI= X-Google-Smtp-Source: AGHT+IGFT6oMOQ+TR863435svR6oU3idG91IW6LduLfUi8wvsRcSqmnGq6toUB/4YRCnKRzcWThq/w== X-Received: by 2002:a17:907:948f:b0:a9e:80ed:5cc6 with SMTP id a640c23a62f3a-aa69f27f1f0mr12729966b.13.1733763079100; Mon, 09 Dec 2024 08:51:19 -0800 (PST) Received: from localhost.localdomain ([5.29.161.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa673474e27sm300539766b.102.2024.12.09.08.51.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 08:51:18 -0800 (PST) From: Roy Eldar To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= , Johannes Schindelin , Eric Sunshine , Roy Eldar Subject: [PATCH v2 1/8] git-submodule.sh: make some variables boolean Date: Mon, 9 Dec 2024 18:50:02 +0200 Message-Id: <20241209165009.40653-2-royeldar0@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241209165009.40653-1-royeldar0@gmail.com> References: <20241207135201.2536-1-royeldar0@gmail.com> <20241209165009.40653-1-royeldar0@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When git-submodule.sh parses various options and switches, it sets some variables to values; in particular, every switch that is passed causes a corresponding variable to be set to 1, which then affects the options given to git-submodule--helper. Some variables are assigned "$1", although there is no reason for it; this was actually noticed in 757d092 for the "$cached" variable. Make some variables boolean, in order to increase consistency throughout the script and reduce possible confusion. Signed-off-by: Roy Eldar --- git-submodule.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 03c5a220a2..107011f613 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -78,7 +78,7 @@ cmd_add() shift ;; -f | --force) - force=$1 + force=1 ;; -q|--quiet) quiet=1 @@ -231,7 +231,7 @@ cmd_deinit() do case "$1" in -f|--force) - force=$1 + force=1 ;; -q|--quiet) quiet=1 @@ -294,7 +294,7 @@ cmd_update() nofetch=1 ;; -f|--force) - force=$1 + force=1 ;; -r|--rebase) rebase=1 @@ -500,10 +500,10 @@ cmd_summary() { cached=1 ;; --files) - files="$1" + files=1 ;; --for-status) - for_status="$1" + for_status=1 ;; -n|--summary-limit) summary_limit="$2" From patchwork Mon Dec 9 16:50:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Eldar X-Patchwork-Id: 13900045 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CCD6150980 for ; Mon, 9 Dec 2024 16:51:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763085; cv=none; b=Ov4Wsy+6RnHqD5AnR78pSh0VimvmrHc3aWvWTwIGZTvD/V5P8EBrz6c5wL/M+78HyBvxT8fGwPQAfT7ugWrfmneUYZ5hY3isbl24EpOWDA0dyRV4eP52/ro/dzFUosNcRTNyOCzAkas6k1auEA9gjH5ukzo1+fiZcGJoFqMM19U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763085; c=relaxed/simple; bh=pzDeZ3DSmvYGy3VbHSeHsAPU+GWiOiAb//hKYq4y66g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mOrAK3q6A2aiB1jyvq1dJpsIFiIR6lp7RWYqCsUsFQ2bttKnv/KdeqBr0DkPfZcnV7kVH3ok9Wj7Q8BzNsWHrCLKYual7a8d78eYnJcTYnxmR5X5kdPu4Qwl0VEP+12Inf5B6/QZo+jm6aohjXLu5+5kXgrsJmMF8GX3VT2cuzE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nDRd/4Xv; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nDRd/4Xv" Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-aa680fafb3eso16885366b.3 for ; Mon, 09 Dec 2024 08:51:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733763082; x=1734367882; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bVfWyFkCjAPIQl2JhELKMRT25GIIVVZLVGqa0/iWq8Y=; b=nDRd/4Xv8JfcbdIxiqVxMTPyijB55skM/LDOclutoNkaw0oQQTpSuNtIqyHxfdMRJ2 Se/XqeRznE75/WEVl83LmCMrW/xFL13UwK4TL7YuEBzfT+XQ+sll4+HrLt3pel5X4VaR BrAFnSua5mzVNF7m5mR2OJkRUYc7tic+yWOkgeRgCrgU06FZTyb78LJ1fssKQuMP2rX9 hFfFnTvcPEWfgJKcG4Y5wnwiLZoDd4XM6bajV4FKyMeGEfqnKNd7Sr9cbLMYoJ1SLOhJ spHeOj6wjady11vx6rO+ljs8A7KT90e9PScpMA+GWcHalWuQuHzagIP+R4i13RCzGs5D b+BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733763082; x=1734367882; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bVfWyFkCjAPIQl2JhELKMRT25GIIVVZLVGqa0/iWq8Y=; b=uR+T6ORUjqFR3V8ouY6ZIszEQD+SaIHx7nlG6bI3gm3NAgP4zGsd3ZhEWtvhZOBp33 P3WpEgiLO0NhFtW67Lt/thO0UhB5f61CpN36tn8GUqyaCL7a/vQfCUDshbs/YDWq5sn9 ocplKg0t5pdBfwKMC9KQsNIs8Ou2YQEJtKEI9zI1QSVbE9pYwsUzkYK2a0TA+JbmULPS OxjMzjJlrc9p6ZtopOxHVTUeiN+HTK4cjw1CWa4GmAOu0Q4wd+6PoT/FoQnRetHEYy9i Ve1E5PUfAS5JSV28ptZ51Jrr3DnFPc+N94//LAJNwvQAgr4A5knKG9EmVi5km3qy2e2+ laoQ== X-Gm-Message-State: AOJu0YxkjfXEaReoVFqFz4LCgCD7bPqJQ5WWDEwuHQkvf+z5eHAyZEgN fU0KWP4b7QQPLSq69vr9eXOFHl63oR4ZIxc5CFdUmk0B5RfYDdMFDhXae/gO X-Gm-Gg: ASbGnctD8HzBfkcwvexBxs74X3IR96EK9HJvN+z+mScszgHkgG7mxIT60OfA13ANhYl Di3yuI3td2PX9Ann/NGowwdDuchoByi7jzTxpE/HUGYKrviTbQy2Q+Xe2ThycUgHAQhOs+u7lwy W6eNILk02JZLgEOGuyhb0fj9a+RTMDa4XJ+QC6pRPaGAJpyjfRkvmWT2OODZjEc2QwcS9/JcOLa M2bUJIqP8mhPYhfIQta9oB5OwIoSSJVBXvSX+ReGs9KDsJp8ZwTK2eD4H8= X-Google-Smtp-Source: AGHT+IEjMtTvHtZPkU2PnyLWZVrRHT13Yy4Bj6WhOaCMEBDCcq2Y2s0GDFHbG6ueRvwtdYCxQNG39g== X-Received: by 2002:a17:907:7285:b0:aa6:6792:8bce with SMTP id a640c23a62f3a-aa69f13df7bmr15636666b.3.1733763081948; Mon, 09 Dec 2024 08:51:21 -0800 (PST) Received: from localhost.localdomain ([5.29.161.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa673474e27sm300539766b.102.2024.12.09.08.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 08:51:21 -0800 (PST) From: Roy Eldar To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= , Johannes Schindelin , Eric Sunshine , Roy Eldar Subject: [PATCH v2 2/8] git-submodule.sh: improve parsing of some long options Date: Mon, 9 Dec 2024 18:50:03 +0200 Message-Id: <20241209165009.40653-3-royeldar0@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241209165009.40653-1-royeldar0@gmail.com> References: <20241207135201.2536-1-royeldar0@gmail.com> <20241209165009.40653-1-royeldar0@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some command-line options have a long form which takes an argument. In this case, the argument can be given right after `='; for example, "--depth" takes a numerical argument, which can be given as "--depth=X". Support the case where the argument is given right after `=' for all long options, in order to improve consistency throughout the script. Signed-off-by: Roy Eldar --- git-submodule.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/git-submodule.sh b/git-submodule.sh index 107011f613..a47d2a89f3 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -77,6 +77,9 @@ cmd_add() branch=$2 shift ;; + --branch=*) + branch="${1#--branch=}" + ;; -f | --force) force=1 ;; @@ -110,6 +113,9 @@ cmd_add() custom_name=$2 shift ;; + --name=*) + custom_name="${1#--name=}" + ;; --depth) case "$2" in '') usage ;; esac depth="--depth=$2" @@ -425,6 +431,9 @@ cmd_set_branch() { branch=$2 shift ;; + --branch=*) + branch="${1#--branch=}" + ;; --) shift break From patchwork Mon Dec 9 16:50:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Eldar X-Patchwork-Id: 13900046 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 194CA1487C8 for ; Mon, 9 Dec 2024 16:51:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763087; cv=none; b=cwKlB1/KJsVmvJPN0kR/cKGDIT0V4TxP19yaFHu2s1QANuJDSG/XYHbx8ICTOmvrERuxm7/kWnz3uxtBDiWd7oLMvwY4qyxH7uFyNcwWGUule1Jw/uE/Wh+siVQalSp2Ku7/udLd/l8CjS5mlsQDwya/M6ttBeoHX9b7yXOu/Xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763087; c=relaxed/simple; bh=A551sKNwUrIgY39NdUMaPNGWYiVWwTi6N66bJo+6OcU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kYM2WfhvcByG5t9FzkI/IpmR5qyr4/0y8LWil6qcWCakZ0AUTeHj2BrfMIp2lQ292RfWwjm/apKBfLHb0fcNEuDcJa86MN0/j/uMwmw8XmudBaKnCEborDoREU48uMs+gt6Pckr2xaJHd6WpFJQUtv1GJMK/vAImKQP65dlbpCM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IJGCmV1x; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IJGCmV1x" Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-aa62fc2675cso69836266b.1 for ; Mon, 09 Dec 2024 08:51:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733763084; x=1734367884; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qxPGqA/wMkYPZAbED39kDn5RPPa0ojwbXq22XnPY6JQ=; b=IJGCmV1xcWFZ5EJjFA27APymgUMXa532d6jwqOPHbC+D1HwUSvauVaITm7Vxq8TtDc 6S/aiRRnRpBuCl3GpzSItQfyUg9NUrN807JCaEOSJoH8nAL9h2MZbCl6xl+4hNnTk4Zj cnJXH0nqwgOmPlVVB2QBwBD+hBKCLetp6YwCzFrIx2O+E/8uuY3JAN/SWC2kuHh0xDyX fdJ2s9MgBulyNU9Vj7VwRhbqgkMd4pf2yc6AVyABIlg1XWlz4dNtSwWq/Y6DYbxfhKiI oPHSYKm+IIu6Lv9MbNek6wpsIRuV0qN0biH1MpQQimPUin7EslGPWm4MCz8Nql15nonU aQWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733763084; x=1734367884; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qxPGqA/wMkYPZAbED39kDn5RPPa0ojwbXq22XnPY6JQ=; b=w7jSEGadDKcS265wCwzN+DqKia2A+ReerRiX2GVDB5kqB82UYsNax447DMTOP5cDeN 9SI78elDi31Tf4HA2Z+ywKrqVDKUsxvDC4qijuVe9ur9QE++OlEYYPRtidTO3J8McAQo sk73z4bbXwtAfB9UOuHAw0iYgZdHwV9f0n32HHqrGU3ZWFkOLC0orNhTWu8Qe75r4KQB Yx3AAY64U1VORY5TiZrGjdoE1EB7wLPQx/RsqoC5yPJaSKhRALdNHhkEBZ10TrQNGTfH +IK+JpYoHneYDV9mzi6CwU7pykF6Cf8lfyUEkskiIQyyj2TXUHjmzUhRCmKiwBOb0hd3 sDYQ== X-Gm-Message-State: AOJu0YxsMsf61U2yXsuwdx86ASQv6lEqPMWVpkbg8kR3faObeYYMRSCP yA7q8gVU2cR2QO9gRZRiM1N1dYgveQLztLmnIMSL0j5ZO8k2QPOFRtZ1Duxb X-Gm-Gg: ASbGncu31xjV3CMtyV5oxshZoNrv9Lu3kppTjHXHSgnCaj/P3EphoVPxHeALwuErtbK yHGinJ2WEPAd9evl3QAcahC2yyu9+dR3kSyebwasC7mlf+Kvaa+swD+LYTQPU+ZpcPYz+q+PLHc kyDc0QQnKc/f4LMhZIO6qvNPX3XWcUey8ycseiYCW4n0uJdQeoaLoA8tPhslZqrLUR+5XpwlPDN O0KYUu/DIifUh/gZ0lDDVssFElMIavc4z+YT2pgFy3LQfdt28WNAW6XuKA= X-Google-Smtp-Source: AGHT+IEVhTauHcGF1RnrgNLywVOlMFReMx83JumiZuh1UPzrLRGsJAi2+8jbhGF8F9K/eQ5F9pxVzQ== X-Received: by 2002:a17:907:3f1d:b0:aa6:2572:563a with SMTP id a640c23a62f3a-aa63a10f275mr562902666b.6.1733763083963; Mon, 09 Dec 2024 08:51:23 -0800 (PST) Received: from localhost.localdomain ([5.29.161.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa673474e27sm300539766b.102.2024.12.09.08.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 08:51:23 -0800 (PST) From: Roy Eldar To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= , Johannes Schindelin , Eric Sunshine , Roy Eldar Subject: [PATCH v2 3/8] git-submodule.sh: improve parsing of short options Date: Mon, 9 Dec 2024 18:50:04 +0200 Message-Id: <20241209165009.40653-4-royeldar0@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241209165009.40653-1-royeldar0@gmail.com> References: <20241207135201.2536-1-royeldar0@gmail.com> <20241209165009.40653-1-royeldar0@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Some command-line options have a short form which takes an argument; for example, "--jobs" has the form "-j", and it takes a numerical argument. When parsing short options, support the case where there is no space between the flag and the option argument, in order to improve consistency with the rest of the builtin git commands. Signed-off-by: Roy Eldar --- git-submodule.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/git-submodule.sh b/git-submodule.sh index a47d2a89f3..fc85458fb1 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -77,6 +77,9 @@ cmd_add() branch=$2 shift ;; + -b*) + branch="${1#-b}" + ;; --branch=*) branch="${1#--branch=}" ;; @@ -352,6 +355,9 @@ cmd_update() jobs="--jobs=$2" shift ;; + -j*) + jobs="--jobs=${1#-j}" + ;; --jobs=*) jobs=$1 ;; @@ -431,6 +437,9 @@ cmd_set_branch() { branch=$2 shift ;; + -b*) + branch="${1#-b}" + ;; --branch=*) branch="${1#--branch=}" ;; @@ -519,6 +528,10 @@ cmd_summary() { isnumber "$summary_limit" || usage shift ;; + -n*) + summary_limit="${1#-n}" + isnumber "$summary_limit" || usage + ;; --summary-limit=*) summary_limit="${1#--summary-limit=}" isnumber "$summary_limit" || usage From patchwork Mon Dec 9 16:50:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Eldar X-Patchwork-Id: 13900047 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B706135956 for ; Mon, 9 Dec 2024 16:51:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763090; cv=none; b=j7x9F1VfeQvLUwKrCwu7yrzApu8N3OuLCnXjm5jXKOKyIXTqTbWIOY9afq0dNi1Jlp/h3UVJwvEY7vNZz7oGAqqhiLa4yaeDJVgj3ImE6kowDbLLCRB3skEt61GDNL2YuvhdrXpPMvubdzED8o1aBRJ0/6tY4AzJnvgsvm+SEFc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763090; c=relaxed/simple; bh=dr5hzo4uhrBb5fw5tCnGbT5/3fbYYeixJtJl/nSoiqE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ri+3TxYSTsQTcXRJkvq6UHBg1Us66/A2GXUQDoAwn+wsMxSHdWPema/P2qd2++E3PVq8FLcSrVSjzbzLg+kT3CsDBglvEvQe8WIQbZuDR0fOQI4z8vFNF0AiqRZYTKawN5tKD6OtPAsANDiLrvxsiLc11VrPSeYoBRS7BQs635s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KfDtzQUY; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KfDtzQUY" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-aa67ceb4e31so32633666b.1 for ; Mon, 09 Dec 2024 08:51:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733763086; x=1734367886; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PNLTh9hIxfWy/0RaTJBZ35tOHi2vi2KxzyTBi3DGvL0=; b=KfDtzQUYRrgiE5jYNVW96ozw2ekuu0B1zSOjhka1JRAiswLfr+fC5nHfse+t4545Sx YC6kOdvDo//bFsyFI0FFy0joL1exJp5D35PgoghHldEPtH+m42TX02adwgiBDrLbc+X9 LcgGrlfr79RIzG8BOWVyStu3C02EAyIDuMWlFNbgwyh2TSSuEm/a2+nuAEBZY2Q6Mp6t +n3WcE5ulrg/ZJkY/EDr0hiNqxSzkyusuDbQ3qRgszB5T1nhTP8MgoDBbSfSekidNdqG 1lof9BWTXhINv0Nhbb3fBxewdBrVxud1G5YyqUGnWpxlQm2+GQSgFhbtbhOwu27VlRQ9 G48Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733763086; x=1734367886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PNLTh9hIxfWy/0RaTJBZ35tOHi2vi2KxzyTBi3DGvL0=; b=IdI6QdiEXnIsXP07He8tJM+AqMm8Td+lUHgJSCeAZHyfOGaubxa6PFrOJpe4te16kC 4av52LW9y/a3PJo2a43d9f1T4lEFVJAVD4gEQWtvVHsr+6pI+SGy9YHbPAoWTbR6F1mN KZzmnpxp7+HjKiyHh2UeO8fkNVy+08BMx8hhUIaxisD0NEPN0G9LvnlvBr11TRbvqy6y 8Er6nmuKelpO04jZ6IEApNSAp+nrOYLjdKFrY4cQISfkhMJXXDY7P/xtZox+c6SWHxJ/ RTemXYTlCIJWmHnxK/bZrawuuHLLF3TRsXwb5RhmsRz/WLQVL6C+AIBgWjGkUlEJ+6Fy YVyw== X-Gm-Message-State: AOJu0Yw3D4mF6fE5KCfV/usNylguXlz3Zaaw2QhAgAP01wEnfvqkd5Ro OhUuhyyj6fFNRbQWNbumY28M9y0LvId85RrS8JGVPCmw+pgp6OKTYpQdvo5d X-Gm-Gg: ASbGnctVM84MRKwYJg+6MALoSMwChRHMXzZoPZbkiA50Ae0bkhMNkYErtO1qhnes0An ebmxRPHFDqpjRn0NoFKuVnzC1QaB2q8RpHBUnL4BbGEGgUSCGAXXDyNGMmccN/LixnxjXwKTf0p iwuMq+zcSSi+bxr+dZhEGMk8LqafQoVTzh9rCVmBva8/z5TAwgAsACcUl6V0spNOvs+gZTXykI0 +YVpC5W7j/ycV13Tc23Tbared0kzMnLJAYnzL8ThhD95zQ0ZamzYh883qU= X-Google-Smtp-Source: AGHT+IEZneTg3T4nujZfxs4qbeTsLdqUAbAd5xjEMSBKGcmPtjz19ws/VHQtFjwn//xz3NU13h/7TA== X-Received: by 2002:a17:906:c105:b0:aa6:2eb3:40ea with SMTP id a640c23a62f3a-aa69f2556aemr14188266b.11.1733763085779; Mon, 09 Dec 2024 08:51:25 -0800 (PST) Received: from localhost.localdomain ([5.29.161.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa673474e27sm300539766b.102.2024.12.09.08.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 08:51:25 -0800 (PST) From: Roy Eldar To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= , Johannes Schindelin , Eric Sunshine , Roy Eldar Subject: [PATCH v2 4/8] git-submodule.sh: get rid of isnumber Date: Mon, 9 Dec 2024 18:50:05 +0200 Message-Id: <20241209165009.40653-5-royeldar0@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241209165009.40653-1-royeldar0@gmail.com> References: <20241207135201.2536-1-royeldar0@gmail.com> <20241209165009.40653-1-royeldar0@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It's entirely unnecessary to check whether the argument given to an option (i.e. --summary-limit) is valid in the shell wrapper, since it's already done when parsing the various options in git-submodule--helper. Remove this check from the script; this both improves consistency throughout the script, and the error message shown to the user in case some invalid non-numeric argument was passed to "--summary-limit" is more informative as well. Signed-off-by: Roy Eldar --- git-submodule.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index fc85458fb1..833ac8362b 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -53,11 +53,6 @@ jobs= recommend_shallow= filter= -isnumber() -{ - n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1" -} - # # Add a new submodule to the working tree, .gitmodules and the index # @@ -524,17 +519,15 @@ cmd_summary() { for_status=1 ;; -n|--summary-limit) + case "$2" in '') usage ;; esac summary_limit="$2" - isnumber "$summary_limit" || usage shift ;; -n*) summary_limit="${1#-n}" - isnumber "$summary_limit" || usage ;; --summary-limit=*) summary_limit="${1#--summary-limit=}" - isnumber "$summary_limit" || usage ;; --) shift @@ -554,7 +547,7 @@ cmd_summary() { ${files:+--files} \ ${cached:+--cached} \ ${for_status:+--for-status} \ - ${summary_limit:+-n $summary_limit} \ + ${summary_limit:+-n "$summary_limit"} \ -- \ "$@" } From patchwork Mon Dec 9 16:50:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Eldar X-Patchwork-Id: 13900048 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 783EB1487C8 for ; Mon, 9 Dec 2024 16:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763091; cv=none; b=t6d3liK40uAV75ce1KT2CfTevq3nnYddX2nZqK9OjlKYbhUzA+tku4+MolQe6Hwd2NZ0v+Mn1udSiqCI70iaXVP0VWh5kBP5RD8Dq6AXhMwoM+pj4ZxxpaXkD0hOrtusZUFQh/qg1VfQemexFufa+T06290zPiwrm6N7ZAdVo3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763091; c=relaxed/simple; bh=Ekh5+ly0SnahaNDFmi4ejBFFSwqYkjdzv6IjL1nrdog=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=a6w6wj1gwHPJ3gKZ5fy9YZAerin/rEY01IQESDO0aSIeBSVi7mDm8/61EQ+G5Afl+JFPChQASMWRQwv4k9kt1fFRj3dZ6xiXferFEkXW+xVXWV7NuW/Y4bHPFwwf3RCg4+VwDMsIiTaRn6hrpbEZDm3q1GCXKDmjTb6dU+K3UMg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QGjLxMjj; arc=none smtp.client-ip=209.85.218.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QGjLxMjj" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-aa551d5dd72so84088066b.3 for ; Mon, 09 Dec 2024 08:51:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733763087; x=1734367887; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nXAQUzgKtdyMTiCCqrxRFUALbDjFkDNH4h90BasbJHQ=; b=QGjLxMjjg377O1WAxqm2y7YgbanKJfRiuEt/HXCFDIK/qmAeofLvu9MkML9MlbByVy EpYQEqc6QW4BSiMl3slqW48tvw3JDDbaVNcmqNjO6uuEmLBJ178cmMrE+lOJRxwG5zWz XUPEb+E8fjL0Gxc9TF0Mvr5hbI28GVYMYzlaz6uJAi4n6KOXQQDId9zNwDdDoQ3A9nqQ ZJVrvSjBn/sJC5qOOuxZVr2NUHoAC1sdxVf0o76lZmvMbxSqoqF2VhrhvkuRBUrzHQK/ NrbAiVbTx2CpjQ1/jnYfP1Owy3jmqAhPIGN9UNb0h32IwMGwtMQmR/c5y9R4Js1I2n1K jN3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733763087; x=1734367887; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nXAQUzgKtdyMTiCCqrxRFUALbDjFkDNH4h90BasbJHQ=; b=h1cR8nYtUS33zu65d8V8s53D3OW4//uv3wlWZuzsKbT0aSjoRDrgqcFpRLF4UBMNoP OvOQVjSfJZdGIEblhudtaVk3o5v5ICYfT4Zq+uxBBJjPeOJFpgTD7yOyuFqTB9E6vl+9 7cf+VUvJa9BrNLHz1AmkrRIDA+0SkvSTYWqRPp+VYqTU3w44Db/Rk1ceG1/gveG4gMfF b5KqEYVghD/NKWGzbBey/rrNW0KrsOucq4rt/CJYs8u8UGjWshp5PxYjPGRa/puZroK2 A8aTXXOqAC8gMCmgsIfduVzH10dgpdYXRrnkeMEEhfdkhhgdQP9160Y56rAQ9WnKiXzl FTsA== X-Gm-Message-State: AOJu0Yy/QGaNxR6Dilb0Dg8Z/Rr1Oc6obwJX51mCKcNr52QTlFvTbl3g Qfk2rn7DO81keFjRTcZk4khgNnJb+osxxU10b6aOE0mf7FkUKmi7u/wPB7jZ X-Gm-Gg: ASbGncuWyEHzZuV+oLakmhg0h3FyOcC4cmM4LrhRSu7V4ei40yv0q5pnIj91OE5eGY+ /EvgmWVE7LIRXWvzur8C9nZMpJ2dZOVteuRm4BvoGGkkUMtupjwNo5ShMZ6GEEkgQCbMTP2alo0 jldI9KAlXhKDo3IxfUOm5lWnDaXI3nW0PQ/964Ogyx5qBEgwW9UfcGYNCPVDmtylCZvYYslW8br ocBEBfHvjPvRixh+Osa9/IXfi0iJpAKkwMQMMnDwVvsO/7Ey3YSyl/vIyI= X-Google-Smtp-Source: AGHT+IG3WpsWxTaeI/qQQXBgRxC+5Mnp/YAbfksuXEyTJg+vW+ExCl/Y20cmthvqcPFm/SkPNX/ToQ== X-Received: by 2002:a17:906:dc8c:b0:aa6:35b1:5c02 with SMTP id a640c23a62f3a-aa69f26408fmr14227966b.9.1733763087526; Mon, 09 Dec 2024 08:51:27 -0800 (PST) Received: from localhost.localdomain ([5.29.161.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa673474e27sm300539766b.102.2024.12.09.08.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 08:51:27 -0800 (PST) From: Roy Eldar To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= , Johannes Schindelin , Eric Sunshine , Roy Eldar Subject: [PATCH v2 5/8] git-submodule.sh: get rid of unused variable Date: Mon, 9 Dec 2024 18:50:06 +0200 Message-Id: <20241209165009.40653-6-royeldar0@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241209165009.40653-1-royeldar0@gmail.com> References: <20241207135201.2536-1-royeldar0@gmail.com> <20241209165009.40653-1-royeldar0@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the variable "$diff_cmd" which is no longer used. Signed-off-by: Roy Eldar --- git-submodule.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/git-submodule.sh b/git-submodule.sh index 833ac8362b..67cdea331b 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -503,7 +503,6 @@ cmd_set_url() { cmd_summary() { summary_limit=-1 for_status= - diff_cmd=diff-index # parse $args after "submodule ... summary". while test $# -ne 0 From patchwork Mon Dec 9 16:50:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Eldar X-Patchwork-Id: 13900049 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 695AA14F9F8 for ; Mon, 9 Dec 2024 16:51:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763093; cv=none; b=NIEqAij8IN/UI/Wg0nbFDNiy8ipSJv6pSL2Zh7pJaHkFt3d0M67QG2t57TYJMLwLSu68SgBn67zMxno+N/C8N8ZR+axASIVz3Mn/7vEiKpwu+s+GWrQNMsTbxMOi4sVwzH/jMG54rTiAhXVLA4WkBsP6jsg2g+xRHhCVvWvKPlk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763093; c=relaxed/simple; bh=9F0y2XO9RYUbzwMVgqObLSiUEhSRN5IACzww9BgnJE8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zf0ugML2haYQwamEGSITuO3QrZoYqUuVM1ufe4oBn+X3sjpZ7mv5n2QBTJB48A9xqJhJHUKq4QpktnF3g8RMIuZOCy6+QUSjG5rCaia6KxAQsT4UpUBH7wcRdpk+nX1UhHRGwqzAMcgH6c8ybvdFjTLbDOLuh3Db9CUnKesibM0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YDChcHzF; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YDChcHzF" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-aa69599b4b0so13976166b.3 for ; Mon, 09 Dec 2024 08:51:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733763089; x=1734367889; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T+jglJVP0bt4/I9CEdmN5hFPwHUD4fv5kYBbPt4xZHk=; b=YDChcHzFqPHoOUqE3/LU01prCAojKCwORSPidBPezbGwLm7wpUYKPBkHx7i1GpobcP A5tWvv3xGHhxtlky09cXFGVXg/ksQuFLZRY3M2HER71+BD1rK/vXxyOba2fhTQm3dZxN 4TONZkXB7G5qIAKr5QRjTK5NfkzrSR5VTwk/GDUeglrBst/26zpnrVpBS3/pjgG4j0co 3kb9fmS/FocHIDi0MqFCu4x2hWQgCZ2JzERzUQrVN7c4YD5crtcAa1r4tb9ei8l7T8IF Ml98tJePRsiW+3uun7oEGnaKOZczvrWQujq4ISFT7l2tTu8HmlnR5CCcBwYhBolEXsge H7+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733763089; x=1734367889; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T+jglJVP0bt4/I9CEdmN5hFPwHUD4fv5kYBbPt4xZHk=; b=r5yhLmBinnrGX89SH3tyCLXYeB4eicjHgCtAOXfyXNAIOWmPHJwUVzgAmZmWAUWnPc AY5JMaVCQGc2IwTgRkmsWDVq6leTL9vd1ND1UIL9t7ZMP3CYMieEMISGRsXYQyasulaB IpLg6aLFmndHxgQqgiBtplJylJeO58oHOqy/KEDwLeFIJk6Lb4XWuVnMs1TQ1Kh3IrnK ht6MAd4fnQ0F0E/DzhHCXelRXbdZXj0+Z/cWdgFRStZpnv/Xsf8vF4+jpwTHzfx8FnEN gXO4PNCP1Q6IdIbVvzY7XlsbBhNe4/WY+UZ4pEw/jss41hkWqW4DoCigUH14HtTJWxoZ rPuQ== X-Gm-Message-State: AOJu0YxqyXI/tHyJR+uKFIgPJnft41h+awiHgIJS/rEsZyTX/D8IsDbZ PqUt5NWS07KK0jmnlHhCKQA7VHLidDHUSpKhK6MNX89xu7L9DDci6UZ3Nq4G X-Gm-Gg: ASbGncv35r5ioDAdvalRi8jGvkodpstoBFUeyHLNCLlbH8kzNimUOOx+bTdSQNXKTHJ idKbohC2KvVOlXc0/XRRhZaR9sSPvHyvWnrTxapNd9hwuKpORYimZ6nelFwS546oHQ9uoG4K1cG AuBq1s0MehoFrIzD5QK2y83me16wqIHhW4+OcMLYhXjpzF6WXO4XeEQjLaqyBFyiLpLrYPpoaqD lpe58JhCOp4L3cwJ7Zr8A0/tHjusNe6RaZ9pNuaN6EbMY3BFjTA/wU4IE8= X-Google-Smtp-Source: AGHT+IHrOYt1phgEk5rEa6KtgYcL2wuiT16o6rmAALavPAuEGm8H8OoRLvqtJOzdrPuVfM1CddwbMA== X-Received: by 2002:a17:907:3e1d:b0:aa5:3e81:5abc with SMTP id a640c23a62f3a-aa63a025e12mr577365466b.1.1733763089170; Mon, 09 Dec 2024 08:51:29 -0800 (PST) Received: from localhost.localdomain ([5.29.161.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa673474e27sm300539766b.102.2024.12.09.08.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 08:51:28 -0800 (PST) From: Roy Eldar To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= , Johannes Schindelin , Eric Sunshine , Roy Eldar Subject: [PATCH v2 6/8] git-submodule.sh: add some comments Date: Mon, 9 Dec 2024 18:50:07 +0200 Message-Id: <20241209165009.40653-7-royeldar0@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241209165009.40653-1-royeldar0@gmail.com> References: <20241207135201.2536-1-royeldar0@gmail.com> <20241209165009.40653-1-royeldar0@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a couple of comments in a few functions where they were missing. Signed-off-by: Roy Eldar --- git-submodule.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/git-submodule.sh b/git-submodule.sh index 67cdea331b..3b44aeddbf 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -418,6 +418,7 @@ cmd_set_branch() { default= branch= + # parse $args after "submodule ... set-branch". while test $# -ne 0 do case "$1" in @@ -466,6 +467,7 @@ cmd_set_branch() { # $@ = requested path, requested url # cmd_set_url() { + # parse $args after "submodule ... set-url". while test $# -ne 0 do case "$1" in @@ -604,6 +606,7 @@ cmd_status() # cmd_sync() { + # parse $args after "submodule ... sync". while test $# -ne 0 do case "$1" in From patchwork Mon Dec 9 16:50:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Eldar X-Patchwork-Id: 13900050 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC40E153BFC for ; Mon, 9 Dec 2024 16:51:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763094; cv=none; b=jWvV1mSp7bu28x8UCqXa3qZ+G4lE0JAMbdyoDutSYsq2VAaC6nbpfxQwk6oixhF0OEJPTZepqM925+lJ9GYtCPeBarMdFB/t/Cc/8lO322kdExRela5SzmfZGfjaT+F5qPd5Y7XOVl66Aof2Siok2L5fpyu3kj6OXWY9ilq9kxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763094; c=relaxed/simple; bh=RMBMffDdEdqj8+bhulqeskzLcLyvQFUHieibROZS0t0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bb342EXuHBn9ic+q0p1E9sOKoG7ISSMU1IPqQrlGXldnJd1vUqK341em0Fc9lUPfTL/8BDbWac88bI7b/l5ypNhTeGaNZXedHVayDHdH1CJ/OCcvcsL9YOHkHTioijnPQTI58o56PvHKQZbZeIjBKryCPL/+o+eFCDfx2DWmHgA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=E5afUC8s; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="E5afUC8s" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-aa6954ec439so9782666b.1 for ; Mon, 09 Dec 2024 08:51:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733763091; x=1734367891; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F+bsiR4NaUmzID1amv6uyVGy7kQ7PwgPazZygJy/unE=; b=E5afUC8sVft0qe9VWpMz3HfKXMcu3aJJ9TQrcxH4LujTTpZxWQwmM77H5udvaPGm5r TViGdBOLYzYEAI81MrBaYP/CyGxj3oysDQrHLMwXyOa6xejouecsgqEHH0jCRORtnGOS Txgf6ht+iVr2bUQIyA42WfOAwjg3shgJwqiAdzAiFuujj66qoY1btFuGYIvIZtMBAl9J PCjfLTdAUT0mYNkJwRkQfMToy0oFB5r3TdcGhsga2LyMqtNPmtLLnRd2uWnIYPS3sJSH yVBFZOww9t23F4HOQWQeNUSqlbRQqMUkZSYEAJcFzfg7cuUPFHR4Lv1XTqKDFPcT9klk MKLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733763091; x=1734367891; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F+bsiR4NaUmzID1amv6uyVGy7kQ7PwgPazZygJy/unE=; b=kOkwvOwPaT7U2vmm7D+OW3osThfIyz7lzP+nFA0suJ4M4iNE09ZOi+P5nMytPAxayc HslmctjLfmZhvMSsZc/V0M7ukenpL71tCIz1fkYZ8yan1nDBLxZMq2UybxRtHXjdm7E1 N1iKJlURJzKfNL9Zp9HtInMTTGBTcnpUaH935ZvbKCtvJ8gjQbTL0ubdqdxkvLSd6iYi tzlXt9LlqoL9UXwjvfFlBboYzApDFhiuoksgi7Jctc7IIpZ81mR5+QMwHWTVFVqGtMi7 vhKTRS+SMp1WrVXYPTvo3aKWTAao5ugLnAXBM253O3+zHK5odFMMfeKTKi9vayLxdV5W vKWw== X-Gm-Message-State: AOJu0YyNVuCT51CQWnaTwxcIVbKiO7B3d6biG+FIjCSJnivT8tyRRzvZ k2f5Vln6wOhWM2O0SieKlpIhzR8E3etgHSzfo7bvw8bS4xhvApUTG237Tug2 X-Gm-Gg: ASbGnctyFycK/Ef8Hg29s2yi/PPCOpc0wzYIMnG4LJDzA25GxiJ7J3BUc4L4BQY/QBD w/Y/ljRpHEusT14Hawv2Zr6uTaVWhzhkAFCe7gnaDN/WPJ0somVux4n+S5/oMLHsmIC042XWQ6w z303OvGmFkr0ucpMkz6MHXVSid9B49h8ZxLGjGYfV37gbJtl1pnUPiax0h0UDtgWv6I743o59cU gBHB7hnyz39QlNl9mco3H+4suxEsDBu3wI3/xGcwrKN0/7thtOK6CS1buKLODc= X-Google-Smtp-Source: AGHT+IF8oYMmZuRsBkFN4nMvqFrx+DGsQbgPBTDgfZ8U6b3qyuU5yExgWOFtsAHYSIo0qHRgt7eLxw== X-Received: by 2002:a17:907:9694:b0:a9a:410d:f86f with SMTP id a640c23a62f3a-aa69f29c1fbmr14890266b.14.1733763090785; Mon, 09 Dec 2024 08:51:30 -0800 (PST) Received: from localhost.localdomain ([5.29.161.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa673474e27sm300539766b.102.2024.12.09.08.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 08:51:30 -0800 (PST) From: Roy Eldar To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= , Johannes Schindelin , Eric Sunshine , Roy Eldar Subject: [PATCH v2 7/8] git-submodule.sh: improve variables readability Date: Mon, 9 Dec 2024 18:50:08 +0200 Message-Id: <20241209165009.40653-8-royeldar0@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241209165009.40653-1-royeldar0@gmail.com> References: <20241207135201.2536-1-royeldar0@gmail.com> <20241209165009.40653-1-royeldar0@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When git-submodule.sh parses various options and switches, it sets some variables to values; the variables in turn affect the options given to git-submodule--helper. Currently, variables which correspond to switches have boolean values (for example, whenever "--force" is passed, force=1), while variables which correspond to options which take arguments have string values that sometimes contain the option name and sometimes only the option value. Set all of the variables to strings which contain the option name (e.g. force="--force" rather than force=1); this has a couple of advantages: it improves consistency, readability and debuggability. Suggested-by: Junio C Hamano Signed-off-by: Roy Eldar --- git-submodule.sh | 219 +++++++++++++++++++++-------------------------- 1 file changed, 98 insertions(+), 121 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 3b44aeddbf..2da4d55d64 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -52,6 +52,10 @@ single_branch= jobs= recommend_shallow= filter= +deinit_all= +default= +summary_limit= +for_status= # # Add a new submodule to the working tree, .gitmodules and the index @@ -63,37 +67,33 @@ filter= cmd_add() { # parse $args after "submodule ... add". - reference_path= while test $# -ne 0 do case "$1" in -b | --branch) case "$2" in '') usage ;; esac - branch=$2 + branch="--branch=$2" shift ;; - -b*) - branch="${1#-b}" - ;; - --branch=*) - branch="${1#--branch=}" + -b* | --branch*) + branch="$1" ;; -f | --force) - force=1 + force=$1 ;; -q|--quiet) - quiet=1 + quiet=$1 ;; --progress) - progress=1 + progress=$1 ;; --reference) case "$2" in '') usage ;; esac - reference_path=$2 + reference="--reference=$2" shift ;; --reference=*) - reference_path="${1#--reference=}" + reference="$1" ;; --ref-format) case "$2" in '') usage ;; esac @@ -104,15 +104,15 @@ cmd_add() ref_format="$1" ;; --dissociate) - dissociate=1 + dissociate=$1 ;; --name) case "$2" in '') usage ;; esac - custom_name=$2 + custom_name="--name=$2" shift ;; --name=*) - custom_name="${1#--name=}" + custom_name="$1" ;; --depth) case "$2" in '') usage ;; esac @@ -120,7 +120,7 @@ cmd_add() shift ;; --depth=*) - depth=$1 + depth="$1" ;; --) shift @@ -142,14 +142,14 @@ cmd_add() fi git ${wt_prefix:+-C "$wt_prefix"} submodule--helper add \ - ${quiet:+--quiet} \ - ${force:+--force} \ - ${progress:+"--progress"} \ - ${branch:+--branch "$branch"} \ - ${reference_path:+--reference "$reference_path"} \ + $quiet \ + $force \ + $progress \ + ${branch:+"$branch"} \ + ${reference:+"$reference"} \ ${ref_format:+"$ref_format"} \ - ${dissociate:+--dissociate} \ - ${custom_name:+--name "$custom_name"} \ + $dissociate \ + ${custom_name:+"$custom_name"} \ ${depth:+"$depth"} \ -- \ "$@" @@ -168,10 +168,10 @@ cmd_foreach() do case "$1" in -q|--quiet) - quiet=1 + quiet=$1 ;; --recursive) - recursive=1 + recursive=$1 ;; -*) usage @@ -184,8 +184,8 @@ cmd_foreach() done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper foreach \ - ${quiet:+--quiet} \ - ${recursive:+--recursive} \ + $quiet \ + $recursive \ -- \ "$@" } @@ -202,7 +202,7 @@ cmd_init() do case "$1" in -q|--quiet) - quiet=1 + quiet=$1 ;; --) shift @@ -219,7 +219,7 @@ cmd_init() done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper init \ - ${quiet:+--quiet} \ + $quiet \ -- \ "$@" } @@ -230,18 +230,17 @@ cmd_init() cmd_deinit() { # parse $args after "submodule ... deinit". - deinit_all= while test $# -ne 0 do case "$1" in -f|--force) - force=1 + force=$1 ;; -q|--quiet) - quiet=1 + quiet=$1 ;; --all) - deinit_all=t + deinit_all=$1 ;; --) shift @@ -258,9 +257,9 @@ cmd_deinit() done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit \ - ${quiet:+--quiet} \ - ${force:+--force} \ - ${deinit_all:+--all} \ + $quiet \ + $force \ + $deinit_all \ -- \ "$@" } @@ -277,31 +276,31 @@ cmd_update() do case "$1" in -q|--quiet) - quiet=1 + quiet=$1 ;; -v|--verbose) - quiet=0 + quiet= ;; --progress) - progress=1 + progress=$1 ;; -i|--init) - init=1 + init=$1 ;; --require-init) - require_init=1 + require_init=$1 ;; --remote) - remote=1 + remote=$1 ;; -N|--no-fetch) - nofetch=1 + nofetch=$1 ;; -f|--force) - force=1 + force=$1 ;; -r|--rebase) - rebase=1 + rebase=$1 ;; --ref-format) case "$2" in '') usage ;; esac @@ -320,22 +319,19 @@ cmd_update() reference="$1" ;; --dissociate) - dissociate=1 + dissociate=$1 ;; -m|--merge) - merge=1 + merge=$1 ;; --recursive) - recursive=1 + recursive=$1 ;; --checkout) - checkout=1 - ;; - --recommend-shallow) - recommend_shallow="--recommend-shallow" + checkout=$1 ;; - --no-recommend-shallow) - recommend_shallow="--no-recommend-shallow" + --recommend-shallow|--no-recommend-shallow) + recommend_shallow=$1 ;; --depth) case "$2" in '') usage ;; esac @@ -343,24 +339,18 @@ cmd_update() shift ;; --depth=*) - depth=$1 + depth="$1" ;; -j|--jobs) case "$2" in '') usage ;; esac jobs="--jobs=$2" shift ;; - -j*) - jobs="--jobs=${1#-j}" - ;; - --jobs=*) - jobs=$1 + -j*|--jobs*) + jobs="$1" ;; - --single-branch) - single_branch="--single-branch" - ;; - --no-single-branch) - single_branch="--no-single-branch" + --single-branch|--no-single-branch) + single_branch=$1 ;; --filter) case "$2" in '') usage ;; esac @@ -385,22 +375,21 @@ cmd_update() done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper update \ - ${quiet:+--quiet} \ - ${force:+--force} \ - ${progress:+"--progress"} \ - ${remote:+--remote} \ - ${recursive:+--recursive} \ - ${init:+--init} \ - ${nofetch:+--no-fetch} \ - ${rebase:+--rebase} \ - ${merge:+--merge} \ - ${checkout:+--checkout} \ + $quiet \ + $force \ + $progress \ + $remote \ + $recursive \ + $init \ + $nofetch \ + $rebase \ + $merge \ + $checkout \ ${ref_format:+"$ref_format"} \ ${reference:+"$reference"} \ - ${dissociate:+"--dissociate"} \ + $dissociate \ ${depth:+"$depth"} \ - ${require_init:+--require-init} \ - ${dissociate:+"--dissociate"} \ + $require_init \ $single_branch \ $recommend_shallow \ $jobs \ @@ -415,9 +404,6 @@ cmd_update() # $@ = requested path # cmd_set_branch() { - default= - branch= - # parse $args after "submodule ... set-branch". while test $# -ne 0 do @@ -426,18 +412,15 @@ cmd_set_branch() { # we don't do anything with this but we need to accept it ;; -d|--default) - default=1 + default=$1 ;; -b|--branch) case "$2" in '') usage ;; esac - branch=$2 + branch="--branch=$2" shift ;; - -b*) - branch="${1#-b}" - ;; - --branch=*) - branch="${1#--branch=}" + -b*|--branch=*) + branch="$1" ;; --) shift @@ -454,9 +437,9 @@ cmd_set_branch() { done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-branch \ - ${quiet:+--quiet} \ - ${branch:+--branch "$branch"} \ - ${default:+--default} \ + $quiet \ + ${branch:+"$branch"} \ + $default \ -- \ "$@" } @@ -472,7 +455,7 @@ cmd_set_url() { do case "$1" in -q|--quiet) - quiet=1 + quiet=$1 ;; --) shift @@ -489,7 +472,7 @@ cmd_set_url() { done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper set-url \ - ${quiet:+--quiet} \ + $quiet \ -- \ "$@" } @@ -503,32 +486,26 @@ cmd_set_url() { # $@ = [commit (default 'HEAD'),] requested paths (default all) # cmd_summary() { - summary_limit=-1 - for_status= - # parse $args after "submodule ... summary". while test $# -ne 0 do case "$1" in --cached) - cached=1 + cached=$1 ;; --files) - files=1 + files=$1 ;; --for-status) - for_status=1 + for_status=$1 ;; -n|--summary-limit) case "$2" in '') usage ;; esac - summary_limit="$2" + summary_limit="--summary-limit=$2" shift ;; - -n*) - summary_limit="${1#-n}" - ;; - --summary-limit=*) - summary_limit="${1#--summary-limit=}" + -n*|--summary-limit=*) + summary_limit="$1" ;; --) shift @@ -545,10 +522,10 @@ cmd_summary() { done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper summary \ - ${files:+--files} \ - ${cached:+--cached} \ - ${for_status:+--for-status} \ - ${summary_limit:+-n "$summary_limit"} \ + $files \ + $cached \ + $for_status \ + ${summary_limit:+"$summary_limit"} \ -- \ "$@" } @@ -569,13 +546,13 @@ cmd_status() do case "$1" in -q|--quiet) - quiet=1 + quiet=$1 ;; --cached) - cached=1 + cached=$1 ;; --recursive) - recursive=1 + recursive=$1 ;; --) shift @@ -592,9 +569,9 @@ cmd_status() done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper status \ - ${quiet:+--quiet} \ - ${cached:+--cached} \ - ${recursive:+--recursive} \ + $quiet \ + $cached \ + $recursive \ -- \ "$@" } @@ -611,11 +588,11 @@ cmd_sync() do case "$1" in -q|--quiet) - quiet=1 + quiet=$1 shift ;; --recursive) - recursive=1 + recursive=$1 shift ;; --) @@ -632,8 +609,8 @@ cmd_sync() done git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync \ - ${quiet:+--quiet} \ - ${recursive:+--recursive} \ + $quiet \ + $recursive \ -- \ "$@" } @@ -656,10 +633,10 @@ do command=$1 ;; -q|--quiet) - quiet=1 + quiet=$1 ;; --cached) - cached=1 + cached=$1 ;; --) break From patchwork Mon Dec 9 16:50:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roy Eldar X-Patchwork-Id: 13900051 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7095414D430 for ; Mon, 9 Dec 2024 16:51:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763096; cv=none; b=TB42M5VtDTwOMHiHVmBplM8fx/vffl7DjgUV8JnW3cWw42UiGlP854wZB76TaUAzFWLJvbdTuYI7cihiKRd1d/aj2KLQIFdUq1Q+/GPXo3fyQgoWtl3+Ia1BNXwi0H2ANaOjfVkFfD4lHOXAi/obDy9NM+QZOM+THHl/H3r1ALE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733763096; c=relaxed/simple; bh=w6kZBdeBwCc3AIqN6w3bzxiNvPzcOCeRrQy47kwuhZk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=O4KQ9grXy1VhydWPEqd2bHkzMlkzxWnsQv80Z5oStu/G/wRYME/XOeBQBeJlVSg+zONAjTxmGOHr7mzUDRg4QoAVqEkxfGy2ljr9SO6KKQAC7/hsjo1eFo/jVsXZD4FgTs4h+LelB/VoipIF3EtRnykwT3iy6gSrBOr1Pb6vhgw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Lwi/0XOh; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Lwi/0XOh" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5d0b85c5574so501112a12.2 for ; Mon, 09 Dec 2024 08:51:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733763092; x=1734367892; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oyb6rQ/GtGZbuPidGq4BS/h97tnwe1X0LPsRdsXX3GI=; b=Lwi/0XOh8rrPq9zEcri5YEgfHJNXb6g1GPlyT7gy+9zGAyhwbQqC/FS8DySrvI/cQ1 on4Vxpe1u8doyAhrtS0BuF7/+Zz6wnzxYP6EPbBxCoQ5dmav5hw/fdVwdhzEla55Pet1 Oks/ml1NpKkP+m0VkyH8RKbo0jmq80S4/pWQ1tWhuR6b3ijU6VTCC3S2Lvt3m3Wt7sx8 Biu33puiwZYn9DQy8T07dX5dSMMinmZ9LG/qHKeXD7hRaPRYyS3iW+cSflj8f6CjBZ90 qfTtMi+ohk9Ztw8oI52esva6zYiATBOcp3wCdtN2H5v2JUEXN8QLUtxAwudvyf5sVhEA +AgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733763092; x=1734367892; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oyb6rQ/GtGZbuPidGq4BS/h97tnwe1X0LPsRdsXX3GI=; b=TbI4AXx1nWL9bgEirRv16otIkSp+Dck67zBNPKBGzJvRRqEw45LaxY13uyQ4PEiQAZ pjqC/0ZaL0Mm1rYNBAtR41kxjK45egl4gdvXtsQDOsHztDBs31wiSox8crjm6yfCHun9 Wc22m8kFh+v7pxOsMtyXm3bDtMgIQI6FmjpQaLnFu/J58Kcq5Yci3EbUbXV4mjRSAJPB 9t8MLzIeZAvto/nM5CxH+4M8aZKKBN3ibsaQ3NI6pVTWvVzp8ooMGnzJyuvs0roqGgUq CpQa+Zg6J1onrGvPxwP35sXFabyVpWD6nUytugajOjBMO+lZg2LAsyXERq7noL95O2nh sa5Q== X-Gm-Message-State: AOJu0YwwVNdcsPEqjtWWConwrxLojvyIKQdqzhKw3Mc1TbN2GA3U9VV2 zugnTf6Jz8PB9gxA0noMQafXoovL5pHOqQV4F61xZ/yf4NiNckm0hXWc622r X-Gm-Gg: ASbGncvj7ENZD7QW8+6p3Qr/+UvqNDYPCoDuoac53P63r4h4Mzh0k3pZysYQcaQ+lJv FzT3MXHb3Dq5fo6aLAmVd8Hupo9vjTBDqFeqMOAnLDuf8ZUQnesiDTVadq0KQ0jFPD1gRRQZlzu 6Z3k6SU4KV3QycjNyEWaRDxeaOk6be3EnRa8q0thsOXV5wmbkHCIC9iBLKtH+5FCdoFrC/NkoZj e4gHwr89MS45jfgj3nkotS+dV3ASQzl4FvVXK5JMDjXacqjX9UzvJZWT2o= X-Google-Smtp-Source: AGHT+IGMsYZZ55duJfvo4pd9B39yM27IPtluxVVM9ZyvX/U78a2Y/50D9q2SKD5czQ8GKWbbMdSegA== X-Received: by 2002:a17:907:894b:b0:aa5:a36c:88f0 with SMTP id a640c23a62f3a-aa69f27e04bmr9310166b.12.1733763092427; Mon, 09 Dec 2024 08:51:32 -0800 (PST) Received: from localhost.localdomain ([5.29.161.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa673474e27sm300539766b.102.2024.12.09.08.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2024 08:51:32 -0800 (PST) From: Roy Eldar To: git@vger.kernel.org Cc: Junio C Hamano , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= , Johannes Schindelin , Eric Sunshine , Roy Eldar Subject: [PATCH v2 8/8] git-submodule.sh: rename some variables Date: Mon, 9 Dec 2024 18:50:09 +0200 Message-Id: <20241209165009.40653-9-royeldar0@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20241209165009.40653-1-royeldar0@gmail.com> References: <20241207135201.2536-1-royeldar0@gmail.com> <20241209165009.40653-1-royeldar0@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Every switch and option which is passed to git-submodule.sh has a corresponding variable which is set accordingly; by convention, the name of the variable is the option name (for example, "--jobs" and "$jobs"). Rename "$custom_name" and "$deinit_all" in order to improve consistency. Signed-off-by: Roy Eldar --- git-submodule.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/git-submodule.sh b/git-submodule.sh index 2da4d55d64..9c10472b5f 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -44,7 +44,7 @@ nofetch= rebase= merge= checkout= -custom_name= +name= depth= progress= dissociate= @@ -52,7 +52,7 @@ single_branch= jobs= recommend_shallow= filter= -deinit_all= +all= default= summary_limit= for_status= @@ -108,11 +108,11 @@ cmd_add() ;; --name) case "$2" in '') usage ;; esac - custom_name="--name=$2" + name="--name=$2" shift ;; --name=*) - custom_name="$1" + name="$1" ;; --depth) case "$2" in '') usage ;; esac @@ -149,7 +149,7 @@ cmd_add() ${reference:+"$reference"} \ ${ref_format:+"$ref_format"} \ $dissociate \ - ${custom_name:+"$custom_name"} \ + ${name:+"$name"} \ ${depth:+"$depth"} \ -- \ "$@" @@ -240,7 +240,7 @@ cmd_deinit() quiet=$1 ;; --all) - deinit_all=$1 + all=$1 ;; --) shift @@ -259,7 +259,7 @@ cmd_deinit() git ${wt_prefix:+-C "$wt_prefix"} submodule--helper deinit \ $quiet \ $force \ - $deinit_all \ + $all \ -- \ "$@" }