From patchwork Tue Feb 6 02:09:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13546528 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (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 D886D5677B for ; Tue, 6 Feb 2024 02:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185376; cv=none; b=Y4Ede0oTVDz8Tc1p13rviOXlpYzvpcWgfw4jZA40RXFNExqaVyV5r2FD20rxxJf2DEtUZI/R03AAW9+vUkDlvRnWDiczRr4TTWz2VVqz/3tGR3YKO/zAdETE3muFouGfwI8+OFGq+9F/D7FLV/izynG8+hLRPWxGIaEDEk/GjxQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185376; c=relaxed/simple; bh=6h5e1f3ZIeMJQUz8oMhboJbNf+tiaXGt48DYcgHkjUE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t9TATIzgKhOJOMQWQSx+9avOGkLSJWW4bfaUIx5Z8HcmMCjXsRz++knjjXTRqboqxQk0lbHqRbsk7hpxYV6oxnV2P5NIMCnr75o7NfHAdx72Z5X/gAEqGpjXtNqdfp2Pt/Lkd47/D0K8qSoDpQ6oHQ+DjVpoQp+Cu2taHtiRB5c= 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=TZDFVy5H; arc=none smtp.client-ip=209.85.215.171 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="TZDFVy5H" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-53fbf2c42bfso4230653a12.3 for ; Mon, 05 Feb 2024 18:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707185374; x=1707790174; 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=4mtZl/JLBY55f0TcDPFOUW1HtKEHIRTFgF3o82xinFE=; b=TZDFVy5H86QaB6/oeyQEppk8UzHn2+so8YRmescoIp/UJoDPIPWsAvNP+KhYMqKUlC hz5+vKXaJAknP6g73o6F5JEZ38AzkHsjuAqHf3kewpphKgIzAkOy7PE4iC7aY5MEX56z Rio56vXSK72pewzriwyZYLg/WJiV8SlmQr9fuJg5KsAF+nECGVWBmRSN1/ZNVG4aHwYX exTls209jnNMBFj1HZCDhnEF/6pjkg7+yuDzz3mdZoYnab6IYyTAiA4ecTks8MhLa4ti hqNSXErwtxuBVDob5gPK4uC1eEWjgyJkeeFNUL4T+vqJ9ryRJhk5bS3RN30CjCAgZ9cA WEHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707185374; x=1707790174; 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=4mtZl/JLBY55f0TcDPFOUW1HtKEHIRTFgF3o82xinFE=; b=mVa4j+SqqkCRFh3j1qypQdntYqr7V3baP87L7/JalVaZ3bxlsxBi9640g2gMZV5Tdx JdfdQJRdzatWv89Qu8Q2IdAriqKV5GbE2pCHLlTG/mP0hHZ3iJulZkFPPl14tcxO0RSN E3FdyUzO0MhdLY8h7wzmFztSxSHyiTEzP4jkvVfs7x08ouHkP20KpNQKy6Pp2taXvzqN IdxxGt/B9cWMGu5JJRV84Z5X1Dkzb3mHiwZsgrCLV4PyybDWCFELUOSyh8/5UNXmssH2 Su8h7/yASabTdinKdMHMcjON+onds4zjJloaMbgqxLR0uSNBU/DprjbPn3ezqD1iliyq M4wg== X-Gm-Message-State: AOJu0Yx3nqQvb64F40mWy9o4aJFOxwVYtfKAZwvCsnLmeoD81VL6e93r 1XrIQjP/tS+odjkSPo/PqLHE9vAKWfKgoqmBXBfn0JYHdWl/YPMXsmQLBK7H4JI= X-Google-Smtp-Source: AGHT+IFB7ZNx9+A+nNHKVflB+VjnTGqvfQx8MS+JR99DXS73gTnFiCXKXvoncB+ruJHtweAMgsbLng== X-Received: by 2002:a05:6a20:3ca7:b0:19c:64a5:2162 with SMTP id b39-20020a056a203ca700b0019c64a52162mr337799pzj.20.1707185374106; Mon, 05 Feb 2024 18:09:34 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU+CwgdvX5FlWElfMK86B2ddO3Y/FXE5oH8uoz7JCY0i3N1/I8yuLjUNsPWCPP8cyoZRYag2cKEu1xpmxApkMJO03IX1cH9a9LdOwy0AJDNwCSz Received: from brittons-large-Vivobook ([2600:380:4635:872e:d8c9:9f5d:4e33:1b6a]) by smtp.gmail.com with ESMTPSA id js12-20020a17090b148c00b002960a58b04bsm190485pjb.28.2024.02.05.18.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 18:09:33 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 76BE0520288; Mon, 5 Feb 2024 17:09:31 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v5 1/7] completion: tests: always use 'master' for default initial branch name Date: Mon, 5 Feb 2024 17:09:24 -0900 Message-ID: <20240206020930.312164-2-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206020930.312164-1-britton.kerin@gmail.com> References: <20240128223447.342493-1-britton.kerin@gmail.com> <20240206020930.312164-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The default initial branch name can normally be configured using the GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME environment variable. However, when testing e.g. completion it's convenient to know the exact initial branch name that will be used. To achieve that without too much trouble it is considered sufficient to force the default initial branch name to 'master' for all of t9902-completion.sh. Signed-off-by: Britton Leo Kerin --- t/t9902-completion.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index aa9a614de3..a5d4e900a2 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -5,6 +5,11 @@ test_description='test bash completion' +# Override environment and always use master for the default initial branch +# name for these tests, so that rev completion candidates are as expected. +GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master +export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME + . ./lib-bash.sh complete () From patchwork Tue Feb 6 02:09:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13546529 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 20E1E56B68 for ; Tue, 6 Feb 2024 02:09:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185376; cv=none; b=ams4+6AU2ENAF6+wDoQ55j1vH7V43/XLBje/KMDZeGjTTys0DWQGqvXNmbwl/mGbfmhPdlQxPkgQzzo5fPfRCkVvAfH6WXPwxoCfnncjbpc6Werw4GqJ1UOiAvPtcOxS+fUEFLMXU0/8NHEqkqCIV887//OUV0mBbZrYOMdrCCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185376; c=relaxed/simple; bh=It5gCIbSeOT89nUeP4WauYwQ68Qq8cs3daDHgcLoVUs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T0ZfBueXj1QVkeJYwn1CjyCy4srrM69FBm42soPL+pd5W9gZOOzTaqrDEclMBR76x+njY1RIjs1T+V7qelf6ng6VEqwGlo3Z7In5F9KiN5b/XT9ylJjX7AB/LBWEVgVxh9bFvsEzEXrH0SAmkILFe0tXVvCF9tug541ilauJGNg= 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=Q+agI3I5; arc=none smtp.client-ip=209.85.214.174 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="Q+agI3I5" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d8aadc624dso38228185ad.0 for ; Mon, 05 Feb 2024 18:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707185374; x=1707790174; 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=LXtmhqYFFwTSutZKMF97JDHxuH9zThRsF3fiEBpbgGw=; b=Q+agI3I5eQnRocCCOUb/4W+JwQNXRgqG6yvFQxqphVMm8cEHthOw7mszfqx1izTmJ2 TQi4Z3gvPf9HzQtfhD3vgV92NGe9VJi5UzWsGdvKDz5CKtKrd4HAwwoVT8rkTN+26dph Vw7KHjtPULm6Z6vgBIBYNoXb496hnI/YwWmB+jQv8EJ7S9aLGRwOP1lNkWft/x57PcIP IhuRl60dspwMEHfCUF16vwNmnkltWF26/Ffy8F8knHeh8P4wyTwKg2OKYxNC4uV7rLjf OeIrlgoIHma7XRaGxTXNV5kMDK3q2C6mqCXPPdjynZkeiegyrK/qIicp/g49fLyO7hes X0zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707185374; x=1707790174; 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=LXtmhqYFFwTSutZKMF97JDHxuH9zThRsF3fiEBpbgGw=; b=uMoVKrtYMrf24dF9BwJ5usD+VlPQTclLQi1OZn8pRrPAiuM6ykDlCsJJ4JQnSxZAa1 vNKr0T5T78DXiAIRU9DUnjzBXVfAgbosQe2C1SdNg1bItNmY4tQ63ZULr5jE06NTTmEY 5k7rOtYrkZcyQNBjF6G0J0vHThhYECy3elS9mExOTT/HpPYdR1k78w7beEfJ8/d3v7iW Yr2xCuiqoFSF/DR4xSJabNpIeb7c+tLqVeDSZOmObd4eODV22gwUxr6KfnoNgZJ2ll5I bfm8YmcVmF7ZFLjAu9UqL/nT4df58lJxyOG9BghfmjK7NJ1empetCMvYSQVkzsFYTVy/ sL+w== X-Gm-Message-State: AOJu0YyKb/TqC42ik5njzq6hIbRc4rkvt2+m2DZbBbMw91DNhU5lCMfZ +itB/gWiwwGqhxIfkAZ3PuayNyo3wwQmDx1kgXf2gYQhIs7NiL6w X-Google-Smtp-Source: AGHT+IGy9WNqIbzrQGl9ysFFBKg0RFmmMjCy9XYyIIMu6lLQWObt6lo8L5wvXCUfIF9yPXgrqGiLEA== X-Received: by 2002:a17:902:d902:b0:1d9:a527:608f with SMTP id c2-20020a170902d90200b001d9a527608fmr254111plz.64.1707185374423; Mon, 05 Feb 2024 18:09:34 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWxh35ByCW7t3PxOIo5E9FVTdY4RBxV+C2bu+7dfdmnp+9HbjYO71G8J/YOgVEqzI/VVA5hEK6FItwSFBFc4u39SN3ayWWPlNYf+ONDGG7o1w0E Received: from brittons-large-Vivobook ([2600:380:4635:872e:d8c9:9f5d:4e33:1b6a]) by smtp.gmail.com with ESMTPSA id w5-20020a170902d3c500b001d91b6175afsm577297plb.18.2024.02.05.18.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 18:09:33 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 7A94052028D; Mon, 5 Feb 2024 17:09:31 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v5 2/7] completion: bisect: complete bad, new, old, and help subcommands Date: Mon, 5 Feb 2024 17:09:25 -0900 Message-ID: <20240206020930.312164-3-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206020930.312164-1-britton.kerin@gmail.com> References: <20240128223447.342493-1-britton.kerin@gmail.com> <20240206020930.312164-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The bad, new, old and help subcommands to git-bisect(1) are not completed. Add the bad, new, old, and help subcommands to the appropriate lists such that the commands and their possible ref arguments are completed. Add tests. Signed-off-by: Britton Leo Kerin file && + git add file && + git commit -am "Initial commit" && + git tag initial && + echo "new line" >>file && + git commit -am "First change" && + echo "another new line" >>file && + git commit -am "Second change" && + git tag final + ) +' + +test_expect_success 'git bisect - start subcommand arguments before double-dash are completed as revs' ' + ( + cd git-bisect && + test_completion "git bisect start " <<-\EOF + HEAD Z + final Z + initial Z + master Z + EOF + ) +' + +# Note that these arguments are s, which in practice the fallback +# completion (not the git completion) later ends up completing as paths. +test_expect_success 'git bisect - start subcommand arguments after double-dash are not completed' ' + ( + cd git-bisect && + test_completion "git bisect start final initial -- " "" + ) +' + +test_expect_success 'setup for git-bisect tests requiring ongoing bisection' ' + ( + cd git-bisect && + git bisect start --term-new=custom_new --term-old=custom_old final initial + ) +' + +test_expect_success 'git-bisect - when bisecting all subcommands are candidates' ' + ( + cd git-bisect && + test_completion "git bisect " <<-\EOF + start Z + bad Z + new Z + good Z + old Z + skip Z + reset Z + visualize Z + replay Z + log Z + run Z + help Z + EOF + ) +' + test_expect_success 'git checkout - completes refs and unique remote branches for DWIM' ' test_completion "git checkout " <<-\EOF HEAD Z From patchwork Tue Feb 6 02:09:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13546531 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 502605820A for ; Tue, 6 Feb 2024 02:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185378; cv=none; b=qJQf47ZUxfUl1qoNl7UpA/cJn9GlaRBUkUnHldFizcSOAalKFQ4l0fdbpgG6N4C8fAs0r7ltjDWZtTPKSNgmdVSxCUyUfO0Z2ZKP6+JZLMB09iYWhN+xuIyIHxnku2BgnlUeuu64mtYI9a6IjBgjIKZEicCremEixULoGEK3jng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185378; c=relaxed/simple; bh=w+EC6JsgpUDKCJ9efaO85nfI2eywx0+7e4oz6qm1a50=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bmXRcUER5cSwh2vc7/j/yBHhEFou6MCpMdRW920IKMuJaVJzstu+7YAVeEZyTD4Ol1tk43CiPch+oELY6BDyCtFtT+hcLsZzE/cJO283eJ7pL0czZSfLEWEk2NEFVXY+iYel1hpHHNCSmvtTfI+faAkLmy+qLzOhYGyEnKWhjBk= 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=W6CaZ2Q3; arc=none smtp.client-ip=209.85.216.43 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="W6CaZ2Q3" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-296c562ac70so288867a91.2 for ; Mon, 05 Feb 2024 18:09:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707185376; x=1707790176; 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=dYU1pUnsExAG/G+Z1gtK5ljLqNb7sAB0Fvf7qCLD2Hc=; b=W6CaZ2Q3Ia3JTIAgRU+ckke1TTHT2KZzidxVapHs1KG9FpUNy+O7nthGhMNShzLxe3 6c46oP+61F/AUirTXdSSz/E8kENgpeISN4ePe2Mk1AalDDMlkbKYQlWm1H7F1E+mRSQg j6jt0dAe5RQiNVQje3VFgX1WeUOugovnB/HTwvQAeTd0A4GH1/22e1m/myRJxh7JH0hs 6xVX3Hw4yP9A9pElF/Aq+2NCvRorwJN9ulC0jTWuirjit97bqiCJQF6D6MJXtd4DPh07 yBcu96QYW0tPFkDc6rFviqp1mwuVNEAa3Rqd3x79TUdTDSPe1lXri/bwQRDPQ0XGmom+ lmag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707185376; x=1707790176; 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=dYU1pUnsExAG/G+Z1gtK5ljLqNb7sAB0Fvf7qCLD2Hc=; b=V6WpRCnruJ5h2fTb7aNJdy4C4dJH0UU3RL1N4sc+tUb5PwX4MGABJNAeaU9abhVFB/ sLP96/Nbxp3Rp3PZkzgSwWRapE6bVcwVPDCgiPUHokQtYWdSD8mdFvGhQWaRlgTYkmhj XA/uYaMHrRnk6/LkEmXRH/Xdc0AqhKp3C1YVrbj8MuI09gkAEbQ2aRAf5BIu2G3jNQiD odLjIKdpPtT4j6TCsvgF/oWb5pY9eHfizjm1xOuJakjW6VjDeL6hdcQQDk93a8vUqfWb UHQtce/ajVosLILSVeBnVGSCnUo0OiY0OpqszWYWfZBjdwL/ELuL3JNXG4sQKOzn2OxG k45g== X-Gm-Message-State: AOJu0YyPrHWowp4r+4ckCBLAfW+E0x89sHXdmkt7fPfql8NM4oDPm2Ct JbdYxqaHBCfy/+43uw5xlApkQaHT1cYQZi2tRI1SjNNgYY1N3T8n X-Google-Smtp-Source: AGHT+IGp9x80r8FQyAW3w+kBKZKAfrc58334sFTEeJUERV0GcUamAchKWsf3WNsi8W4T3ypzRtgnXg== X-Received: by 2002:a17:90a:6f46:b0:294:8eb6:85f9 with SMTP id d64-20020a17090a6f4600b002948eb685f9mr1339110pjk.17.1707185376638; Mon, 05 Feb 2024 18:09:36 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWSKVZZd3wMsZ5R2Pr2FQoduD8hCiQre79EO79a5ipBtPYWIUY2D3Ea3YiezaWKawW+IvSfqMwDDmjFgoWTx3qsS9poxXc8z7nRQU4NuqwkLixF Received: from brittons-large-Vivobook (mobile-166-171-250-223.mycingular.net. [166.171.250.223]) by smtp.gmail.com with ESMTPSA id gm3-20020a17090b100300b002955eff3182sm190471pjb.10.2024.02.05.18.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 18:09:33 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 7C812520296; Mon, 5 Feb 2024 17:09:31 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v5 3/7] completion: bisect: complete custom terms and related options Date: Mon, 5 Feb 2024 17:09:26 -0900 Message-ID: <20240206020930.312164-4-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206020930.312164-1-britton.kerin@gmail.com> References: <20240128223447.342493-1-britton.kerin@gmail.com> <20240206020930.312164-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 git bisect supports the use of custom terms via the --term-(new|bad) and --term-(old|good) options, but the completion code doesn't know about these options or the new subcommands they define. Add support for these options and the custom subcommands by checking for BISECT_TERMS and adding them to the list of subcommands. Add tests. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 32 ++++++++++++++++++++++++-- t/t9902-completion.sh | 15 ++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 06d0b156e7..6a3d9c7760 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1449,7 +1449,20 @@ _git_bisect () { __git_has_doubledash && return - local subcommands="start bad new good old skip reset visualize replay log run help" + __git_find_repo_path + + # If a bisection is in progress get the terms being used. + local term_bad term_good + if [ -f "$__git_repo_path"/BISECT_TERMS ]; then + term_bad=$(__git bisect terms --term-bad) + term_good=$(__git bisect terms --term-good) + fi + + # We will complete any custom terms, but still always complete the + # more usual bad/new/good/old because git bisect gives a good error + # message if these are given when not in use, and that's better than + # silent refusal to complete if the user is confused. + local subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help" local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __git_find_repo_path @@ -1462,7 +1475,22 @@ _git_bisect () fi case "$subcommand" in - bad|new|good|old|reset|skip|start) + start) + case "$cur" in + --*) + __gitcomp "--term-new --term-bad --term-old --term-good" + return + ;; + *) + __git_complete_refs + ;; + esac + ;; + terms) + __gitcomp "--term-good --term-old --term-bad --term-new" + return + ;; + bad|new|"$term_bad"|good|old|"$term_good"|reset|skip) __git_complete_refs ;; *) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 7388c892cf..409a5a49d5 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1321,9 +1321,12 @@ test_expect_success 'git-bisect - when bisecting all subcommands are candidates' test_completion "git bisect " <<-\EOF start Z bad Z + custom_new Z + custom_old Z new Z good Z old Z + terms Z skip Z reset Z visualize Z @@ -1334,6 +1337,18 @@ test_expect_success 'git-bisect - when bisecting all subcommands are candidates' EOF ) ' +test_expect_success 'git-bisect - options to terms subcommand are candidates' ' + ( + cd git-bisect && + test_completion "git bisect terms --" <<-\EOF + --term-bad Z + --term-good Z + --term-new Z + --term-old Z + EOF + ) +' + test_expect_success 'git checkout - completes refs and unique remote branches for DWIM' ' test_completion "git checkout " <<-\EOF From patchwork Tue Feb 6 02:09:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13546532 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 A7D3758ABB for ; Tue, 6 Feb 2024 02:09:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185379; cv=none; b=MlE0Aqo2HXEraOOJasStg1wOPdpdkazxzHInJhqAlY3Sk9W5GtdSFXkKaZuLWBK07ldFaXCIf1ZL+9EPjPVd+lGmKHvMJ68gMCU6+dvb2NSrxeeA43Art2HwGExiKbgSQp42Lg7KOJCpWoPqNySyK9x18VuB6IRfZmP3eqfFIX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185379; c=relaxed/simple; bh=2rqmk/8cF7AkouZvwaXgVsDWEMOQLh4iCQLsF7PJWCc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sQlNSr284CIRov6jtUfAPhCzqLzMDdMADEJgORkL21GoVg0BJ9qZBOZ8ZKiYPF1pM8QJAFlSvYh9KApeMvhEtP2L0Ld5YAwE+nKP1/LZm5E91XnT++uFt/TjvEdHzqz24V2M/9JAs2T0mUq7PYttqsu4Anm38Xjw97kxEfhyVGw= 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=FeosZY3P; arc=none smtp.client-ip=209.85.214.170 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="FeosZY3P" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1d944e8f367so40050075ad.0 for ; Mon, 05 Feb 2024 18:09:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707185377; x=1707790177; 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=mJC771/ZAtYuzQtPLvo0UyQDABOPPwXtlear8RbdXuM=; b=FeosZY3PX5Yja2YOs4IWD639/FBwsvz0zcGeMAwMs+sycH/EDh5ZePylPucfEFvG3D jYxJNMf0DF/Uv0kZ3KoylZQT4BykQ/e/9UnSepLS6AJA8Mgp1k1IXG3U6RDRv8Z5IvOC HUgAy+a7BeqzpMlau8s/ZpCukfnuI9H0s86ZCJ+2RbgZfUIYR48KMvJ8GXmgJNPnX8Hm UywYJOe+NFZxHaxKtB+Q5jKn5KWAVzZYVRzgr6vEhcdI2gwpEX2ObVxurB13PJjl3Tyz q4a+h1mKO0ecz+GqjDr9Za9ebdKu2HY5Wi90mEpjd5y/wMPJ3gtqGoBVf/Kdzf/xRiU3 Q2Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707185377; x=1707790177; 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=mJC771/ZAtYuzQtPLvo0UyQDABOPPwXtlear8RbdXuM=; b=Zx6egnbdHKeC4VfENWo5+n+71QscaodrkD5Fs7NEun+rI+VbD8Yjlbbpb33MJQ5Xb9 5LMCXINm3rWNXykON1SfTOBfZJMyO7Ry+YqXbqq4CskNBsUmIcGvd7+UjCw9WCUSgbBX 0JIYmlx54pvXjuJm5AtI0SCkAMh80gXqxA9tbj8AygX4EfaYYpBUIHGhb9rWExAUnXdo UWYhiNyog3YqqXtxkY/zVcWtDVGX7zRpok7CPu+9OH/nWcN3cEqUbn+6L1tA0JWz7nPX npFkgLau/32z/8XoWjI3ymanAaTh+qkCFTfUm+gedxASd2bVbvJzJm8SnpkJlRu8skiu 7UbA== X-Gm-Message-State: AOJu0YywsLmJEbYe3m+v41P8viNqCuLAlgubWbVmj250+ifScwuW9aoP CIIDeTvt9MmTvSv7AeFg7MbtNV8Ghk015OcE6BzIp1hUX7ZkgItpkQ+hM/QvR2c= X-Google-Smtp-Source: AGHT+IFEr3+FWsdct4SAfC90UmI1mcnLbGK81RCuI+PHbIs8pjJmsgFSNm3piPloqq6ioDVfqoGyBg== X-Received: by 2002:a17:902:e5cf:b0:1d9:d17c:5818 with SMTP id u15-20020a170902e5cf00b001d9d17c5818mr349363plf.4.1707185377026; Mon, 05 Feb 2024 18:09:37 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVjLjMeegUN9p1Py7M4ccCmksRDL13OHcv6oMsa9F1Tu+YZoUsJnSuUj1ISa2m//6h4tO8gMc03afqSZGwSY/t43RjbXHWJSaUbsC2S0pMFSNIm Received: from brittons-large-Vivobook ([2600:380:4635:872e:d8c9:9f5d:4e33:1b6a]) by smtp.gmail.com with ESMTPSA id l13-20020a170903244d00b001d9620e9ac9sm570173pls.170.2024.02.05.18.09.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 18:09:33 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 7E78D520297; Mon, 5 Feb 2024 17:09:31 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v5 4/7] completion: bisect: complete missing --first-parent and --no-checkout options Date: Mon, 5 Feb 2024 17:09:27 -0900 Message-ID: <20240206020930.312164-5-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206020930.312164-1-britton.kerin@gmail.com> References: <20240128223447.342493-1-britton.kerin@gmail.com> <20240206020930.312164-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The --first-parent and --no-checkout options to the start subcommand of git-bisect(1) are not completed. Enable completion of the --first-parent and --no-checkout options to the start subcommand. Add test. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 2 +- t/t9902-completion.sh | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 6a3d9c7760..57c6e09968 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1478,7 +1478,7 @@ _git_bisect () start) case "$cur" in --*) - __gitcomp "--term-new --term-bad --term-old --term-good" + __gitcomp "--first-parent --no-checkout --term-new --term-bad --term-old --term-good" return ;; *) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 409a5a49d5..f4d3aa67e3 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1271,6 +1271,17 @@ test_expect_success 'git bisect - when not bisecting, complete only replay and s EOF ' +test_expect_success 'git bisect - complete options to start subcommand' ' + test_completion "git bisect start --" <<-\EOF + --term-new Z + --term-bad Z + --term-old Z + --term-good Z + --no-checkout Z + --first-parent Z + EOF +' + test_expect_success 'setup for git-bisect tests requiring a repo' ' git init git-bisect && ( From patchwork Tue Feb 6 02:09:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13546533 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 7141D59B4F for ; Tue, 6 Feb 2024 02:09:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185381; cv=none; b=F+QvAO3dbMXSqB3hqnrlzOiIedzwZ43FgMW7g+lWTRrVB6SGv738wLGleBIhOga9M3P5+Si3JSLH4oyRMi1t1UljSJWT9qWUKAUMCmDG2vuVX1+L0Gg+hC6BHP9SaZph1aep7kJ1mTznZhgXJofe+mEbhtaxMIX0xRaR+9iiXUY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185381; c=relaxed/simple; bh=G4jFFry/sMdArCitMtx+StoyXZV+P7Ssfadj+vZiNwg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M+rwddYXuCDiQAJZYvYxQGgHOVi1n5Du8wc7cZxFSZpWsa4YTMpabXaO9iZuB6STckvYpN5BnZh2MmghdBWUbxFpVXsDNih6GosqP29FjIqrdOnSfbwjojNgNU9MoBdGhPfz62CC3YAXvBouO8tVuchtQRghxUtVk//mg4lWfFU= 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=NwkshHFz; arc=none smtp.client-ip=209.85.210.172 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="NwkshHFz" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-6e02597a0afso2007232b3a.1 for ; Mon, 05 Feb 2024 18:09:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707185380; x=1707790180; 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=5oHnza+QGWzvqfOr+ub1rgbb9vJWfTCjbT/c1rVKw9o=; b=NwkshHFzlFPAB3z8+oG7cQGuh6n5BkSpb1U8GHG7/ej4ul17TSeugMdMfBunr3geGE rgsv+Ph5MUunANEiY00Q7fHuZp4MmK7I4YKUgrqTOtXYcnHMuYj3ZM6XZd//nP1BcrKr M3YrmpN7Z4WlbMVsmnmgWDSg9fRVm5nPtriJKDUX1MzavPjWQLgESVZigQUtUV8R/vMX O2KF8v6oCbibxoFHe+B77uXmSgZLPIPspFBpUkWW88gTxp0h8DSHaSqPB0hR2y5sirwH kLhXF9B0ka8ZBc+zC8b2gAoN9XOPRUMrV8SB4vEJclrU7crnChMRv0wkCN3Cl1H3wbtM f6CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707185380; x=1707790180; 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=5oHnza+QGWzvqfOr+ub1rgbb9vJWfTCjbT/c1rVKw9o=; b=aSrTzJmgbRKTbYW7nppCTBEDR2Ipxl/BF7v9MHuTyfOx8neDYFzn5YqMKKUh9s9lJL RDN4jkB6d9XYhZpwOVS6cNLC0Wy9o8qBRHgnc/ZHQ2DyfgiBZ6/BW8Qx9egMq9E9ZlnO Eh8O95AmRal6N9M3srkFpfj2AHYkX3nkTzds4ujEzSUdK6mYzrOvYe7gHmXc0uOjDNZY CXpP1mEtgRBxZysmvb51eQcQJb+Hy16nE77cCmQ4zJIBso6qAYcHdhQ+7u34vOWvWhu/ dGYUeKpZU+rxNMNTpS7du/MoamTUadcypFPa5T9jOw7RLEVwp5Rj8Y1utfRCdiCBquRk aIyQ== X-Gm-Message-State: AOJu0Ywke6Z1lf39faNL7sxR0aKThCvSJabRTJCugCnC64JNP57BWNA2 cQdNIyHvTla5VYDbix//IeGzjnKFCK7cnHFoMfY3pWFbd9PNiX8m X-Google-Smtp-Source: AGHT+IGbAm9OctBDduORy8PrwadMg4iZx9Rw+WfgY2pfXXAxjANGXhzz2FIwHcFzWdE6/qdcWBxeXA== X-Received: by 2002:a05:6a20:4329:b0:19c:acfe:5fe6 with SMTP id h41-20020a056a20432900b0019cacfe5fe6mr380337pzk.21.1707185379784; Mon, 05 Feb 2024 18:09:39 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWpoCyvdncIiTw4xGMwyyuUmKS2yvZ00rP9+nRRE2OM6XtCnLMcPMIKsDWE60SKyCw64SBK5XaRFT13lBI/vBCT7dObOuJZBpJSzddoiZ2AOETN Received: from brittons-large-Vivobook ([2600:380:4635:872e:d8c9:9f5d:4e33:1b6a]) by smtp.gmail.com with ESMTPSA id s9-20020a056a00194900b006e044e376adsm581182pfk.166.2024.02.05.18.09.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 18:09:37 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 80C75520298; Mon, 5 Feb 2024 17:09:31 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v5 5/7] completion: new function __git_complete_log_opts Date: Mon, 5 Feb 2024 17:09:28 -0900 Message-ID: <20240206020930.312164-6-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206020930.312164-1-britton.kerin@gmail.com> References: <20240128223447.342493-1-britton.kerin@gmail.com> <20240206020930.312164-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The options accepted by git-log are also accepted by at least one other command (git-bisect). Factor the common option completion code into a new function and use it from _git_log. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 57c6e09968..8c3b1b8e96 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2089,10 +2089,12 @@ __git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-c __git_log_pretty_formats="oneline short medium full fuller reference email raw format: tformat: mboxrd" __git_log_date_formats="relative iso8601 iso8601-strict rfc2822 short local default human raw unix auto: format:" -_git_log () +# Complete porcelain (i.e. not git-rev-list) options and at least some +# option arguments accepted by git-log. Note that this same set of options +# are also accepted by some other git commands besides git-log. +__git_complete_log_opts () { - __git_has_doubledash && return - __git_find_repo_path + COMPREPLY="" local merge="" if [ -f "$__git_repo_path/MERGE_HEAD" ]; then @@ -2186,6 +2188,16 @@ _git_log () return ;; esac +} + +_git_log () +{ + __git_has_doubledash && return + __git_find_repo_path + + __git_complete_log_opts + [ -z "$COMPREPLY" ] || return + __git_complete_revlist } From patchwork Tue Feb 6 02:09:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13546535 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 E9FD259B55 for ; Tue, 6 Feb 2024 02:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185383; cv=none; b=d0aSF2+l97WYrzl8BGCi1HA5PUlUiGPzWYdiV5GWr3TL8rWLTNnGSyJiM85rsoyubHvsNYvd0PWI2BThvsInZ8gIW/YJKziYc2gP4JJWBDfOeMadhl6m48Z9snBkNsQqPh4GzZrkr5gciHaGVJJAAOwzvSrZZnfFPMsl1vYX9TQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185383; c=relaxed/simple; bh=4avKA/ZQ6lx+d8v3SqCQ9dDFNtUzvxnfRKhFHORGoPg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N3bl7pOINM20knhYTmRGyXw04I2h8FLLI1KxPdB9K4dIPiSdtEGvll+qNCMG9Pp8AskW3GCd2eI2glqqhEaiI2T6YoBhJaiYNVTmO2ERpA+P1MUbBuJN+2+h8WawB3Tbep6XYyzkteROgDEJ3nn5DZthGwHDBxewRPxtHhbPD+Y= 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=I4L8JSzp; arc=none smtp.client-ip=209.85.215.177 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="I4L8JSzp" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5d8b276979aso354763a12.2 for ; Mon, 05 Feb 2024 18:09:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707185381; x=1707790181; 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=RUP7isu8qBoKMuGagew9XpTqWYBY7NMocgW32KhuTi4=; b=I4L8JSzpFPqyEhourwOw1VXfZ7qxhIm533/tHPGdRlvRP1WraX+w1BWUBCbGpb4SVp Sgwj3jFRNBl3egfRcickcF8eX+tu/anburFHp9izEt9zsM01b7bIMry7YR8aWOsrlrih BXYUcLlfyJxaL0MDCV3N9JNNonGO5I7nhqf/J/gUnJKMWlHKpZSb6rODRU58ROpOZ6pU 3PIu0LK0qMBq/uVWOpEl/P6U214EMQrQ8Wq75yLLLbtUiItN+yzmfy09sjZE12UM9E5D Q2ynE8QRzzMrOuFgOJSpHz5h7OxXVpJZ9eUdIzahF8m0PsHF/C5McVtEMdTRKg4Azq7z PikQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707185381; x=1707790181; 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=RUP7isu8qBoKMuGagew9XpTqWYBY7NMocgW32KhuTi4=; b=M3Gaa/BSyRlhxYQqpE8JuW0xaN5vXh6P1ltqLVtg/6DJDcB6tY3tkV+bayUux1z82q a6nDe6cYiKlOsSEPPqPY07ghRptx66eCTwYMLR9QP05xIoLlaBXLP1L4skc1Fug9Sc+z Vb8uef0Q8D62eAVM3vc5PySi2ThpHsPqWr3UfFbs5KGua/o/q/A+g1K08C2hx/i2/F0U W5a9BfqdimDAxmKXl29vUrxdOL4PSTT786ktI51VUDW9zD1eer/jnFhpZrhGT+mpKJx/ pwvQsg3z5zhVxO1Ek2hHXt88rr5NAM+bOJEk5BLZ6TJneyto0p2Y2LvoLwKUGbw8XQC2 8aEQ== X-Gm-Message-State: AOJu0YyBxmThoY4onDXTvG9PGrzjx6/hM6kebEWaMRGUyoxMJo/Bu+6H nfpqdjblg5NzL95U5YUivraWItCoCpxqtKNJkDh2nhq/abytt8wYSANIoNaMk68= X-Google-Smtp-Source: AGHT+IFb6e8SoBS+jIdEbhEnPOTn1oMOKgn24x4BMj3NuTqbQg9Bf9QAFoTopF5ucK+WHh3bSwpjBw== X-Received: by 2002:a05:6a20:a326:b0:19e:30b2:bee0 with SMTP id x38-20020a056a20a32600b0019e30b2bee0mr248650pzk.34.1707185381156; Mon, 05 Feb 2024 18:09:41 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUi+P7EnlC0AZyeICHA6Lj0QomkyTY0f/lcyKTVgmhCbpmlMRsxt0cZHaTViN5WC/57jYv6CfBuU2pvnkj2dLJtw9wNgqodcyyOpUKdsGQV9VnM Received: from brittons-large-Vivobook (mobile-166-171-250-223.mycingular.net. [166.171.250.223]) by smtp.gmail.com with ESMTPSA id t27-20020a62d15b000000b006e04efcfbc2sm615095pfl.74.2024.02.05.18.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 18:09:37 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 82968520299; Mon, 5 Feb 2024 17:09:31 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v5 6/7] completion: bisect: complete log opts for visualize subcommand Date: Mon, 5 Feb 2024 17:09:29 -0900 Message-ID: <20240206020930.312164-7-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206020930.312164-1-britton.kerin@gmail.com> References: <20240128223447.342493-1-britton.kerin@gmail.com> <20240206020930.312164-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Arguments passed to the "visualize" subcommand of git-bisect(1) get forwarded to git-log(1). It thus supports the same options as git-log(1) would, but our Bash completion script does not know to handle this. Make completion of porcelain git-log options and option arguments to the visualize subcommand work by calling __git_complete_log_opts when the start of an option to the subcommand is seen (visualize doesn't support any options besides the git-log options). Add test. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 4 ++++ t/t9902-completion.sh | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 8c3b1b8e96..b4cd94182e 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1490,6 +1490,10 @@ _git_bisect () __gitcomp "--term-good --term-old --term-bad --term-new" return ;; + visualize) + __git_complete_log_opts + return + ;; bad|new|"$term_bad"|good|old|"$term_good"|reset|skip) __git_complete_refs ;; diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index f4d3aa67e3..74132699b1 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1360,6 +1360,20 @@ test_expect_success 'git-bisect - options to terms subcommand are candidates' ' ) ' +test_expect_success 'git-bisect - git-log options to visualize subcommand are candidates' ' + ( + cd git-bisect && + # The completion used for git-log and here does not complete + # every git-log option, so rather than hope to stay in sync + # with exactly what it does we will just spot-test here. + test_completion "git bisect visualize --sta" <<-\EOF && + --stat Z + EOF + test_completion "git bisect visualize --summar" <<-\EOF + --summary Z + EOF + ) +' test_expect_success 'git checkout - completes refs and unique remote branches for DWIM' ' test_completion "git checkout " <<-\EOF From patchwork Tue Feb 6 02:09:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13546534 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (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 4C8C259B52 for ; Tue, 6 Feb 2024 02:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185382; cv=none; b=TDpHdhbA7X6BXG1Z35dduHLQAu++XsdtcNCDGBwkYm5U74lgdN3NHplIfHwmKDD0FWsjRfES1Ql5NNxKMqwJTZTTBobXqua18PZl3sgI79b0E/8LCtw1lPeA+BMxa/v+HioAh+szUqi9kPdEeAKDpMVI5U4dxeaLI9eyMZWip1Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707185382; c=relaxed/simple; bh=HGXJ6yJVYJRmrwSgaipEGVpNY+0QrXRWz5feVRBK+FM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FDWBXyPnp8ahSpoUI6yJ3uqaGys/YxXOlEOPEZpwKRBmSiUIiGMm0mT8TTkKbEkV8OxIOM9FFLeym9Eq5KHfXM7td3WhglDCA8gq76xSdQBs6K/9HeM+lTLCpQI89/nVslH90CrMkNb6OD9E2inmo9lZg25IB/G2u6xwZ9cqQmw= 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=kkE5T1RV; arc=none smtp.client-ip=209.85.210.181 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="kkE5T1RV" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6e04d24bd39so1004567b3a.0 for ; Mon, 05 Feb 2024 18:09:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707185380; x=1707790180; 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+JK/rItI+4UK66WxLpJmpNmDuoetU2nq7vmVLgnJKo=; b=kkE5T1RV+UiD30t7Ber0T71ec0s6ZoMfJuuUyvoWcNEVIBlirhXJdtlxAHMQ3U+dir O3geIus2GzYS1vHaWQRF9xBi4IHgmYopnNo+K3HbkO97qt1C7TMAvcSi+7/dM3TWswrd GfP+8O+ZomiNF0H0zr8bMYllhhGK8f8Ij5A9XVYoymte7tups36tB0U4GVjoRWNkdpsi Pqzjc+8Lq2B5Kgle6F8LS2NNBLQqNwVfax+j2LU4EkKyfjTlacpkWtalGYqaK1IdMYr/ WiaVMynf1dX08xmU38idZMshebe8nZstG5dUGVtXW5PzGlqjzGy54Gmnv4fRrP4LuHUY qv+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707185380; x=1707790180; 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+JK/rItI+4UK66WxLpJmpNmDuoetU2nq7vmVLgnJKo=; b=xQfa5nx/xSzcn20WHjuP/UGCsXwmnHqS08LF8xKBO13Uz9YQdyOsnKx4v4wm+vKoRd 8jshtoiI5AUiqw2JKy4Q5i0R3w6SpyMIa+NNnjAbJrQxtmDor8Q/tCgRuTmKdgW2/a/5 QF4gYCR8sUFgr/q0I2+j6pww1TDzlOtKe+ThnW6DA81iI9QWUuTCCNs3yG1+64ji0+7h f+2FYVc4Zv1IKZvMYG/LrACLJXvXpfkFBXnQQ7QYRdjJ51VUgZOjvLyspLGWBCkm5f3X 1WhRvt47xt+IGxbV1jnwybqLpYqf2uNfm7INlCAITj99ZmTgoNBUOJxWfA4ASrJJZMtu AiXw== X-Gm-Message-State: AOJu0YwQF3jgYnFiuhFZ5r1/fSqAET3hHYLD8CBI5+clYOZYNVtoBF/a oFzug6dUV4z/OFkvsnY0NLfuVkNh40sQEfda5qNOgz1jyOv4j+Ei X-Google-Smtp-Source: AGHT+IGNWphNKLvs1AoZ3TvPiDGd9KwgvJHB6VS0EzSaCq1I1LflSMn27K2w/dMUUwt2rOfAc+Z2vA== X-Received: by 2002:aa7:8893:0:b0:6db:e366:53a8 with SMTP id z19-20020aa78893000000b006dbe36653a8mr1134399pfe.12.1707185380540; Mon, 05 Feb 2024 18:09:40 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWwotcerYUrbyiL0EOWaOWttCBd/u/PhZ81njtZbzYDY9EUoV2HB5Yi1TAG+XNXJo6978ZCZkifaoXBk6yaFXF2uxssm86GzF0NQSxCwqtGCcQx Received: from brittons-large-Vivobook (mobile-166-171-250-223.mycingular.net. [166.171.250.223]) by smtp.gmail.com with ESMTPSA id 33-20020a630b21000000b005c662e103a1sm781065pgl.41.2024.02.05.18.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 18:09:37 -0800 (PST) Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 8454B52029A; Mon, 5 Feb 2024 17:09:31 -0900 (AKST) From: Britton Leo Kerin To: git@vger.kernel.org Cc: Junio C Hamano , Patrick Steinhardt , Britton Leo Kerin Subject: [PATCH v5 7/7] completion: bisect: recognize but do not complete view subcommand Date: Mon, 5 Feb 2024 17:09:30 -0900 Message-ID: <20240206020930.312164-8-britton.kerin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240206020930.312164-1-britton.kerin@gmail.com> References: <20240128223447.342493-1-britton.kerin@gmail.com> <20240206020930.312164-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The "view" alias for the visualize subcommand is neither completed nor recognized. It's undesirable to complete it because it's first letters are the same as for visualize, making completion less rather than more efficient without adding much in the way of interface discovery. However, it needs to be recognized in order to enable log option completion for it. Recognize but do not complete the view command by creating and using separate lists of completable_subcommands and all_subcommands. Add tests. Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 15 +++++++++++---- t/t9902-completion.sh | 24 ++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index b4cd94182e..b3d5468c15 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1462,12 +1462,19 @@ _git_bisect () # more usual bad/new/good/old because git bisect gives a good error # message if these are given when not in use, and that's better than # silent refusal to complete if the user is confused. - local subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help" - local subcommand="$(__git_find_on_cmdline "$subcommands")" + # + # We want to recognize 'view' but not complete it, because it overlaps + # with 'visualize' too much and is just an alias for it. + # + local completable_subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help" + local all_subcommands="$completable_subcommands view" + + local subcommand="$(__git_find_on_cmdline "$all_subcommands")" + if [ -z "$subcommand" ]; then __git_find_repo_path if [ -f "$__git_repo_path"/BISECT_START ]; then - __gitcomp "$subcommands" + __gitcomp "$completable_subcommands" else __gitcomp "replay start" fi @@ -1490,7 +1497,7 @@ _git_bisect () __gitcomp "--term-good --term-old --term-bad --term-new" return ;; - visualize) + visualize|view) __git_complete_log_opts return ;; diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 74132699b1..6a6019b0a8 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -1375,6 +1375,30 @@ test_expect_success 'git-bisect - git-log options to visualize subcommand are ca ) ' +test_expect_success 'git-bisect - view subcommand is not a candidate' ' + ( + cd git-bisect && + test_completion "git bisect vi" <<-\EOF + visualize Z + EOF + ) +' + +test_expect_success 'git-bisect - existing view subcommand is recognized and enables completion of git-log options' ' + ( + cd git-bisect && + # The completion used for git-log and here does not complete + # every git-log option, so rather than hope to stay in sync + # with exactly what it does we will just spot-test here. + test_completion "git bisect view --sta" <<-\EOF && + --stat Z + EOF + test_completion "git bisect view --summar" <<-\EOF + --summary Z + EOF + ) +' + test_expect_success 'git checkout - completes refs and unique remote branches for DWIM' ' test_completion "git checkout " <<-\EOF HEAD Z