From patchwork Tue Jan 2 19:57:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13509336 Received: from aa.d.sender-sib.com (aa.d.sender-sib.com [185.41.28.128]) (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 7013715EB9 for ; Tue, 2 Jan 2024 19:58:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aa.d.sender-sib.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sendinblue.com header.i=@sendinblue.com header.b="XT8TETw1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendinblue.com; q=dns/txt; s=mail; bh=paGFajYSK01CCuuL6N8nXExiJZKJPbdxSNTjqLj48Cg=; h=from:subject:date:to:cc:mime-version:content-transfer-encoding:in-reply-to:references:x-csa-complaints:list-unsubscribe-post; b=XT8TETw1L8hD5tMbu/VZyFTIsc9sZpTjA2I9lM+0PPR8YEhJHFX+Fmpzft5ubLhdfu+Eh0t6Q7VF BXAANkKCLoEBP06Z0VEzMlUndaChlm+cbbNULN8Pp9YV8M3WERdqboLI9vABxBbVCp43apVYC6pv pAqxOveYYZQ4QBTraYI= Received: by smtp-relay.sendinblue.com with ESMTP id ac2d9b41-be28-45b8-9113-da59a85d791e; Tue, 02 January 2024 19:57:53 +0000 (UTC) X-Mailin-EID: MjQyODY0MDE0fmdpdEB2Z2VyLmtlcm5lbC5vcmd%2BPDIwMjQwMTAyMTk1NzQ0LjQ3ODUwMy0yLWJyaXR0b24ua2VyaW5AZ21haWwuY29tPn5hYS5kLnNlbmRlci1zaWIuY29t Date: Tue, 2 Jan 2024 10:57:39 -0900 Subject: [RFC PATCH 1/6] completion: complete new old actions, start opts Received: by brittons-large-Vivobook (Postfix, from userid 1000) id BA93B520263; Tue, 2 Jan 2024 10:57:50 -0900 (AKST) Cc: Britton Leo Kerin X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102195744.478503-1-britton.kerin@gmail.com> References: <20240102195744.478503-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: Origin-messageId: <20240102195744.478503-2-britton.kerin@gmail.com> To: X-sib-id: qzd6UUIkvhX59XAz_WefTgjhL-Z9_BVnWo6OGeX_q-Ov2e1TXgCrRfpJ-NXcdv_uIBRYmP0s_s2eMR6OCnxVLiM5-5RzihIErR0GZqkUXBQPtee3lF1q_LDFMgyiI971fcfkXUFU754aYHYbDFzN4NNbVnI2gd3BGjQnS7qyrT4b X-CSA-Complaints: csa-complaints@eco.de List-Unsubscribe-Post: List-Unsubscribe=One-Click Feedback-ID: 185.41.28.128:6940237_-1:6940237:Sendinblue From: "Britton Leo Kerin" Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 185b47d802..15d22ff7d9 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1449,7 +1449,7 @@ _git_bisect () { __git_has_doubledash && return - local subcommands="start bad good skip reset visualize replay log run" + local subcommands="start bad new good old 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 +1462,20 @@ _git_bisect () fi case "$subcommand" in - bad|good|reset|skip|start) + start) + case "$cur" in + --*) + __gitcomp "--term-new --term-bad --term-old --term-good --first-parent --no-checkout" + return + ;; + *) + ;; + esac + ;; + esac + + case "$subcommand" in + bad|new|good|old|reset|skip|start) __git_complete_refs ;; *) From patchwork Tue Jan 2 19:57:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13509337 Received: from bi.d.mailin.fr (bi.d.mailin.fr [185.41.28.109]) (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 C42A116402 for ; Tue, 2 Jan 2024 19:58:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bi.d.mailin.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sendinblue.com header.i=@sendinblue.com header.b="0ucIF8cf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendinblue.com; q=dns/txt; s=mail; bh=jvz56T59CRnw2lhFMgvret3LEz9uk9e5nA305bQTAQo=; h=from:subject:date:to:cc:mime-version:content-transfer-encoding:in-reply-to:references:x-csa-complaints:list-unsubscribe-post; b=0ucIF8cfjY9xu4ERGtvUc7G23OIQvEaaKw+KnG3aNOL+QHwfmZP+poe9QHYgSxINMDa2VyGEU71e Dlmircshvx6J68fGfj1WkXE7cqHqpKgGI9wFMZPBZMst9yFKnKF4/2zigGLksQnJoDwO3j8lm7+4 2fLbBCHDFyr53J1FqFk= Received: by smtp-relay.sendinblue.com with ESMTP id 66708709-247c-49ea-afda-6ac607159795; Tue, 02 January 2024 19:57:53 +0000 (UTC) X-Mailin-EID: MjQyODY0MDE0fmdpdEB2Z2VyLmtlcm5lbC5vcmd%2BPDIwMjQwMTAyMTk1NzQ0LjQ3ODUwMy0zLWJyaXR0b24ua2VyaW5AZ21haWwuY29tPn5iaS5kLm1haWxpbi5mcg%3D%3D Date: Tue, 2 Jan 2024 10:57:40 -0900 Subject: [RFC PATCH 2/6] completion: git-log opts to bisect visualize Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 436D7520261; Tue, 2 Jan 2024 10:57:51 -0900 (AKST) Cc: Britton Leo Kerin X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102195744.478503-1-britton.kerin@gmail.com> References: <20240102195744.478503-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <66708709-247c-49ea-afda-6ac607159795@smtp-relay.sendinblue.com> Origin-messageId: <20240102195744.478503-3-britton.kerin@gmail.com> To: X-sib-id: gDRfXqW-RANFOaeV07lwcDIa5ikn2M0AtOK0j-IxYLMM_qG2TscIQQE44lZuQW_NOi4kfFolBRleymzadeopoVa08hPjk2UaEHJVwq6C9lYc1ZizKQNE3ea6u1JC1GeAeafwuvTtiImnadGGBKVGraRqrLmT0ueqKEuPIMSrDKoF X-CSA-Complaints: csa-complaints@eco.de List-Unsubscribe-Post: List-Unsubscribe=One-Click Feedback-ID: 185.41.28.109:6940237_-1:6940237:Sendinblue From: "Britton Leo Kerin" To do this the majority of _git_log has been factored out into the new __git_complete_log_opts. This is needed because the visualize command accepts git-log options but not rev arguments (they are fixed to the commits under bisection). Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 30 ++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 15d22ff7d9..3472fab514 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1472,6 +1472,16 @@ _git_bisect () ;; esac ;; + visualize) + case "$cur" in + -*) + __git_complete_log_opts + return + ;; + *) + ;; + esac + ;; esac case "$subcommand" in @@ -2074,11 +2084,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 () -{ - __git_has_doubledash && return - __git_find_repo_path +# Find only porcelain (i.e. not git-rev-list) option (not argument) and +# selected option argument completions for git-log options and put them in +# COMPREPLY. +__git_complete_log_opts () +{ local merge="" if [ -f "$__git_repo_path/MERGE_HEAD" ]; then merge="--merge" @@ -2171,6 +2182,17 @@ _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 Jan 2 19:57:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13509339 Received: from aa.d.sender-sib.com (aa.d.sender-sib.com [185.41.28.128]) (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 D876B16413 for ; Tue, 2 Jan 2024 19:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aa.d.sender-sib.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sendinblue.com header.i=@sendinblue.com header.b="220wpOaP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendinblue.com; q=dns/txt; s=mail; bh=yHqlKFDwPJ4G5E3t+doXcGPFWVFt32PEsLQCUM1fS5s=; h=from:subject:date:to:cc:mime-version:content-transfer-encoding:in-reply-to:references:x-csa-complaints:list-unsubscribe-post; b=220wpOaP7KbuliIf5PvCteUa6VQ4iZx2jxAkolubNzTAP65S1u4KUfO7lWbwL2sWadvkFB9brUTm 9A9NdnWGrmJuC6BvghVfn+iv4hX8H3ANOYN4MMKKLX67w02Q005Izn1rIV/YHuOQOr44Eh068YiB 3GAe7elEn4urNlPBz0Q= Received: by smtp-relay.sendinblue.com with ESMTP id 85d66039-f19a-4ee3-99ae-f8b01b8bd1d9; Tue, 02 January 2024 19:57:53 +0000 (UTC) X-Mailin-EID: MjQyODY0MDE0fmdpdEB2Z2VyLmtlcm5lbC5vcmd%2BPDIwMjQwMTAyMTk1NzQ0LjQ3ODUwMy00LWJyaXR0b24ua2VyaW5AZ21haWwuY29tPn5hYS5kLnNlbmRlci1zaWIuY29t Date: Tue, 2 Jan 2024 10:57:41 -0900 Subject: [RFC PATCH 3/6] completion: move to maintain define-before-use Received: by brittons-large-Vivobook (Postfix, from userid 1000) id C15E2520263; Tue, 2 Jan 2024 10:57:51 -0900 (AKST) Cc: Britton Leo Kerin X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102195744.478503-1-britton.kerin@gmail.com> References: <20240102195744.478503-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <85d66039-f19a-4ee3-99ae-f8b01b8bd1d9@smtp-relay.sendinblue.com> Origin-messageId: <20240102195744.478503-4-britton.kerin@gmail.com> To: X-sib-id: KrWs_lg1oYJMk_VJsep_dpusy6Xp6PHgmcq9CuGulYNBuAi3brXRU8rZm_1iRgqOKH1cbHRVoxhmr8I-kqjtNVuHYIRakvt_0hpPRE608TQFvyDdvtKckvXVIvcAGvFq0HoiAHh0uGfzK7YdYyPuaLSrAF9WyOuAVOlVUgkkZG61 X-CSA-Complaints: csa-complaints@eco.de List-Unsubscribe-Post: List-Unsubscribe=One-Click Feedback-ID: 185.41.28.128:6940237_-1:6940237:Sendinblue From: "Britton Leo Kerin" Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 265 ++++++++++++------------- 1 file changed, 132 insertions(+), 133 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 3472fab514..4940ad3e24 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1445,6 +1445,138 @@ _git_archive () __git_complete_file } +# Options that go well for log, shortlog and gitk +__git_log_common_options=" + --not --all + --branches --tags --remotes + --first-parent --merges --no-merges + --max-count= + --max-age= --since= --after= + --min-age= --until= --before= + --min-parents= --max-parents= + --no-min-parents --no-max-parents +" +# Options that go well for log and gitk (not shortlog) +__git_log_gitk_options=" + --dense --sparse --full-history + --simplify-merges --simplify-by-decoration + --left-right --notes --no-notes +" +# Options that go well for log and shortlog (not gitk) +__git_log_shortlog_options=" + --author= --committer= --grep= + --all-match --invert-grep +" +# Options accepted by log and show +__git_log_show_options=" + --diff-merges --diff-merges= --no-diff-merges --dd --remerge-diff +" + +__git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-combined cc remerge r" + +__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:" + +# Find only porcelain (i.e. not git-rev-list) option (not argument) and +# selected option argument completions for git-log options and put them in +# COMPREPLY. +__git_complete_log_opts () +{ + local merge="" + if [ -f "$__git_repo_path/MERGE_HEAD" ]; then + merge="--merge" + fi + case "$prev,$cur" in + -L,:*:*) + return # fall back to Bash filename completion + ;; + -L,:*) + __git_complete_symbol --cur="${cur#:}" --sfx=":" + return + ;; + -G,*|-S,*) + __git_complete_symbol + return + ;; + esac + case "$cur" in + --pretty=*|--format=*) + __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) + " "" "${cur#*=}" + return + ;; + --date=*) + __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" + return + ;; + --decorate=*) + __gitcomp "full short no" "" "${cur##--decorate=}" + return + ;; + --diff-algorithm=*) + __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" + return + ;; + --submodule=*) + __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" + return + ;; + --ws-error-highlight=*) + __gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}" + return + ;; + --no-walk=*) + __gitcomp "sorted unsorted" "" "${cur##--no-walk=}" + return + ;; + --diff-merges=*) + __gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}" + return + ;; + --*) + __gitcomp " + $__git_log_common_options + $__git_log_shortlog_options + $__git_log_gitk_options + $__git_log_show_options + --root --topo-order --date-order --reverse + --follow --full-diff + --abbrev-commit --no-abbrev-commit --abbrev= + --relative-date --date= + --pretty= --format= --oneline + --show-signature + --cherry-mark + --cherry-pick + --graph + --decorate --decorate= --no-decorate + --walk-reflogs + --no-walk --no-walk= --do-walk + --parents --children + --expand-tabs --expand-tabs= --no-expand-tabs + $merge + $__git_diff_common_options + " + return + ;; + -L:*:*) + return # fall back to Bash filename completion + ;; + -L:*) + __git_complete_symbol --cur="${cur#-L:}" --sfx=":" + return + ;; + -G*) + __git_complete_symbol --pfx="-G" --cur="${cur#-G}" + return + ;; + -S*) + __git_complete_symbol --pfx="-S" --cur="${cur#-S}" + return + ;; + esac + +} + _git_bisect () { __git_has_doubledash && return @@ -2052,139 +2184,6 @@ _git_ls_tree () __git_complete_file } -# Options that go well for log, shortlog and gitk -__git_log_common_options=" - --not --all - --branches --tags --remotes - --first-parent --merges --no-merges - --max-count= - --max-age= --since= --after= - --min-age= --until= --before= - --min-parents= --max-parents= - --no-min-parents --no-max-parents -" -# Options that go well for log and gitk (not shortlog) -__git_log_gitk_options=" - --dense --sparse --full-history - --simplify-merges --simplify-by-decoration - --left-right --notes --no-notes -" -# Options that go well for log and shortlog (not gitk) -__git_log_shortlog_options=" - --author= --committer= --grep= - --all-match --invert-grep -" -# Options accepted by log and show -__git_log_show_options=" - --diff-merges --diff-merges= --no-diff-merges --dd --remerge-diff -" - -__git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-combined cc remerge r" - -__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:" - - -# Find only porcelain (i.e. not git-rev-list) option (not argument) and -# selected option argument completions for git-log options and put them in -# COMPREPLY. -__git_complete_log_opts () -{ - local merge="" - if [ -f "$__git_repo_path/MERGE_HEAD" ]; then - merge="--merge" - fi - case "$prev,$cur" in - -L,:*:*) - return # fall back to Bash filename completion - ;; - -L,:*) - __git_complete_symbol --cur="${cur#:}" --sfx=":" - return - ;; - -G,*|-S,*) - __git_complete_symbol - return - ;; - esac - case "$cur" in - --pretty=*|--format=*) - __gitcomp "$__git_log_pretty_formats $(__git_pretty_aliases) - " "" "${cur#*=}" - return - ;; - --date=*) - __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" - return - ;; - --decorate=*) - __gitcomp "full short no" "" "${cur##--decorate=}" - return - ;; - --diff-algorithm=*) - __gitcomp "$__git_diff_algorithms" "" "${cur##--diff-algorithm=}" - return - ;; - --submodule=*) - __gitcomp "$__git_diff_submodule_formats" "" "${cur##--submodule=}" - return - ;; - --ws-error-highlight=*) - __gitcomp "$__git_ws_error_highlight_opts" "" "${cur##--ws-error-highlight=}" - return - ;; - --no-walk=*) - __gitcomp "sorted unsorted" "" "${cur##--no-walk=}" - return - ;; - --diff-merges=*) - __gitcomp "$__git_diff_merges_opts" "" "${cur##--diff-merges=}" - return - ;; - --*) - __gitcomp " - $__git_log_common_options - $__git_log_shortlog_options - $__git_log_gitk_options - $__git_log_show_options - --root --topo-order --date-order --reverse - --follow --full-diff - --abbrev-commit --no-abbrev-commit --abbrev= - --relative-date --date= - --pretty= --format= --oneline - --show-signature - --cherry-mark - --cherry-pick - --graph - --decorate --decorate= --no-decorate - --walk-reflogs - --no-walk --no-walk= --do-walk - --parents --children - --expand-tabs --expand-tabs= --no-expand-tabs - $merge - $__git_diff_common_options - " - return - ;; - -L:*:*) - return # fall back to Bash filename completion - ;; - -L:*) - __git_complete_symbol --cur="${cur#-L:}" --sfx=":" - return - ;; - -G*) - __git_complete_symbol --pfx="-G" --cur="${cur#-G}" - return - ;; - -S*) - __git_complete_symbol --pfx="-S" --cur="${cur#-S}" - return - ;; - esac - -} - _git_log () { __git_has_doubledash && return From patchwork Tue Jan 2 19:57:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13509338 Received: from bi.d.mailin.fr (bi.d.mailin.fr [185.41.28.109]) (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 DF3F716415 for ; Tue, 2 Jan 2024 19:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bi.d.mailin.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sendinblue.com header.i=@sendinblue.com header.b="GmLdWdOX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendinblue.com; q=dns/txt; s=mail; bh=OJAZlgtb2of+PzCihRXxYKS52QcBToY7nm64FTyNJRk=; h=from:subject:date:to:cc:mime-version:content-transfer-encoding:in-reply-to:references:x-csa-complaints:list-unsubscribe-post; b=GmLdWdOXwi/tk0VAK1uOXGEN8yyno4UOZun8CAvhmw/dmhmLpWF64CvUltZXW84rtATeAoUSSbf1 O2muFNhGLOD7c9vOt4sCt3KRW+pysiQNMi/iQBUi7R4zIbHEJQ8KLAG706WWaVUDe7x4mYV+hpv0 nnKaxT/LsRH7h+9+Neg= Received: by smtp-relay.sendinblue.com with ESMTP id ed2116c7-88ed-4fa9-9286-89a945ce9e50; Tue, 02 January 2024 19:57:54 +0000 (UTC) X-Mailin-EID: MjQyODY0MDE0fmdpdEB2Z2VyLmtlcm5lbC5vcmd%2BPDIwMjQwMTAyMTk1NzQ0LjQ3ODUwMy01LWJyaXR0b24ua2VyaW5AZ21haWwuY29tPn5iaS5kLm1haWxpbi5mcg%3D%3D Date: Tue, 2 Jan 2024 10:57:42 -0900 Subject: [RFC PATCH 4/6] completion: custom git-bisect terms Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 57F2E520261; Tue, 2 Jan 2024 10:57:52 -0900 (AKST) Cc: Britton Leo Kerin X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102195744.478503-1-britton.kerin@gmail.com> References: <20240102195744.478503-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: Origin-messageId: <20240102195744.478503-5-britton.kerin@gmail.com> To: X-sib-id: V0njMbMIJ-l1zf8UDl-DPfrSgUh_rUU9CF9VNiNOCLXuhCUCTXPwrxVjmEFQvpkLTZSiW0EHjMSHSac-lB5qosiafXgGwpMSPOAHY-OG6CHcq6hbjE1GkiEwdsf00Mk1Z1jtnSuFnpMvvvs0mnK-_yP9fSHtob_wxjqV0yb-CjP- X-CSA-Complaints: csa-complaints@eco.de List-Unsubscribe-Post: List-Unsubscribe=One-Click Feedback-ID: 185.41.28.109:6940237_-1:6940237:Sendinblue From: "Britton Leo Kerin" Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 4940ad3e24..a09598c5c1 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1581,10 +1581,19 @@ _git_bisect () { __git_has_doubledash && return - local subcommands="start bad new good old terms skip reset visualize replay log run help" + __git_find_repo_path + + local term_bad term_good + if [ -f "$__git_repo_path"/BISECT_START ]; then + term_bad=`__git bisect terms --term-bad` + term_good=`__git bisect terms --term-good` + fi + + 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 if [ -f "$__git_repo_path"/BISECT_START ]; then __gitcomp "$subcommands" else @@ -1617,7 +1626,7 @@ _git_bisect () esac case "$subcommand" in - bad|new|good|old|reset|skip|start) + bad|new|"$term_bad"|good|old|"$term_good"|reset|skip|start) __git_complete_refs ;; *) From patchwork Tue Jan 2 19:57:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13509340 Received: from aa.d.sender-sib.com (aa.d.sender-sib.com [185.41.28.128]) (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 2F6691642A for ; Tue, 2 Jan 2024 19:58:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aa.d.sender-sib.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sendinblue.com header.i=@sendinblue.com header.b="NikABz6S" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendinblue.com; q=dns/txt; s=mail; bh=EwHth4Wf8RKasRYK+iVEJ5qxoMKviQZohIYWZcwE48U=; h=from:subject:date:to:cc:mime-version:content-transfer-encoding:in-reply-to:references:x-csa-complaints:list-unsubscribe-post; b=NikABz6Svo91D0iCl+KOxMtxdAN5jyEV26d6eCzqah2dPP19gTotsokRLPaotuHzrq/yQg89P+Wu Wk/ne9IGo4c+MYMbgehkTrqlxumNiEg1afNf/bfjbKNSwOiqVeZt89AJZ1g8fpujGTquQAaJGcJf LXp4S9O4DuRZu1GXs0g= Received: by smtp-relay.sendinblue.com with ESMTP id cda06ddc-3de6-4fef-a6e2-a3da8c0bac25; Tue, 02 January 2024 19:57:55 +0000 (UTC) X-Mailin-EID: MjQyODY0MDE0fmdpdEB2Z2VyLmtlcm5lbC5vcmd%2BPDIwMjQwMTAyMTk1NzQ0LjQ3ODUwMy02LWJyaXR0b24ua2VyaW5AZ21haWwuY29tPn5hYS5kLnNlbmRlci1zaWIuY29t Date: Tue, 2 Jan 2024 10:57:43 -0900 Subject: [RFC PATCH 5/6] completion: recognize but do not complete 'view' Received: by brittons-large-Vivobook (Postfix, from userid 1000) id E6484520263; Tue, 2 Jan 2024 10:57:52 -0900 (AKST) Cc: Britton Leo Kerin X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102195744.478503-1-britton.kerin@gmail.com> References: <20240102195744.478503-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: Origin-messageId: <20240102195744.478503-6-britton.kerin@gmail.com> To: X-sib-id: EqSk34DoGcqbfgSyS6NXUfesj1fWarMKoVIcUYQTxUiHomX9DmtHUNcbtgxvrSKVABZFpFgj8kCldFzEW4t8yNh3dX-htFB9ih6tGFU5L8a_JHAQ54UHAfvQytX4JMApIZy1-acQabBdRyh62z19GYRYwDbwOm4N28wgNlvUBE0r X-CSA-Complaints: csa-complaints@eco.de List-Unsubscribe-Post: List-Unsubscribe=One-Click Feedback-ID: 185.41.28.128:6940237_-1:6940237:Sendinblue From: "Britton Leo Kerin" Completing it might annoy some existing users by creating completion ambiguity on 'v' and 'vi' without adding anything useful in terms of interface discovery/recall (because 'view' is just an alias anyway). Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index a09598c5c1..3bb790220a 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1589,13 +1589,16 @@ _git_bisect () term_good=`__git bisect terms --term-good` fi - local subcommands="start bad new $term_bad good old $term_good terms skip reset visualize replay log run help" + # 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 "$subcommands")" + local subcommand="$(__git_find_on_cmdline "$all_subcommands")" if [ -z "$subcommand" ]; then if [ -f "$__git_repo_path"/BISECT_START ]; then - __gitcomp "$subcommands" + __gitcomp "$completable_subcommands" else __gitcomp "replay start" fi @@ -1613,7 +1616,7 @@ _git_bisect () ;; esac ;; - visualize) + visualize|view) case "$cur" in -*) __git_complete_log_opts From patchwork Tue Jan 2 19:57:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Britton Kerin X-Patchwork-Id: 13509341 Received: from bi.d.mailin.fr (bi.d.mailin.fr [185.41.28.109]) (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 DDAA116414 for ; Tue, 2 Jan 2024 19:58:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bi.d.mailin.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sendinblue.com header.i=@sendinblue.com header.b="MvQpcwNb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendinblue.com; q=dns/txt; s=mail; bh=AD0KaYz+mhwoCzq94MlWO30nW+nmf0l9kJG58uJLvaQ=; h=from:subject:date:to:cc:mime-version:content-transfer-encoding:in-reply-to:references:x-csa-complaints:list-unsubscribe-post; b=MvQpcwNbQV4dqMzGBkG40Vl+j94upvmRggIRXG3imMqhUFjxIGGF6A9dp6ncwobk7PxQnVjEPo4F R6STfnowlkf/zXjakvvBlHp21nIadSzma7XYOnU1A9SJTrmCqkN6MP34A/dRZe+ftFsYpNNrDT5W QyaAeVmn6ME4nc9/UcQ= Received: by smtp-relay.sendinblue.com with ESMTP id ca077105-345a-4c65-a5a8-06c7be879255; Tue, 02 January 2024 19:57:55 +0000 (UTC) X-Mailin-EID: MjQyODY0MDE0fmdpdEB2Z2VyLmtlcm5lbC5vcmd%2BPDIwMjQwMTAyMTk1NzQ0LjQ3ODUwMy03LWJyaXR0b24ua2VyaW5AZ21haWwuY29tPn5iaS5kLm1haWxpbi5mcg%3D%3D Date: Tue, 2 Jan 2024 10:57:44 -0900 Subject: [RFC PATCH 6/6] completion: add comment Received: by brittons-large-Vivobook (Postfix, from userid 1000) id 93D6C520261; Tue, 2 Jan 2024 10:57:53 -0900 (AKST) Cc: Britton Leo Kerin X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240102195744.478503-1-britton.kerin@gmail.com> References: <20240102195744.478503-1-britton.kerin@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: Origin-messageId: <20240102195744.478503-7-britton.kerin@gmail.com> To: X-sib-id: rhv_g7CX4irG3_dMArnxljOs7AsRD0zXG_qJgo66HTd0xggVOnQ2KgnJQ9RnM9G1Lwb6ar_7FM_tt4JSkyLX0gbtKntAMu0437rBY6FziBpqTeaMJcpn4lap2gbp6_NjkBhaMdkcDLCn_EHhv16dcevSFYJBoW63RoDlz46OSwvj X-CSA-Complaints: csa-complaints@eco.de List-Unsubscribe-Post: List-Unsubscribe=One-Click Feedback-ID: 185.41.28.109:6940237_-1:6940237:Sendinblue From: "Britton Leo Kerin" Signed-off-by: Britton Leo Kerin --- contrib/completion/git-completion.bash | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 3bb790220a..7f9a626e1b 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1589,8 +1589,14 @@ _git_bisect () 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. + # # 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"