From: Patrick Steinhardt <ps@pks.im>
To: Britton Leo Kerin <britton.kerin@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v3 3/5] completion: move to maintain define-before-use
Date: Fri, 19 Jan 2024 08:04:55 +0100 [thread overview]
Message-ID: <ZaofFwDaNrjmbxk_@tanuki> (raw)
In-Reply-To: <20240118204323.1113859-4-britton.kerin@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 9319 bytes --]
On Thu, Jan 18, 2024 at 11:43:21AM -0900, Britton Leo Kerin wrote:
Same here: please explain what the problem is that this patch is trying
to solve in the commit message.
Also, as far as I can see, this patch is actually a prerequisite for the
preceding patch where we already call `__git_complete_log_opts ()`. So a
better way to structure this would be to introduce and move
`__git_complete_log_opts ()` in a preparatory patch, and only then start
calling the function for "visualize" in a subsequent patch.
Patrick
> Signed-off-by: Britton Leo Kerin <britton.kerin@gmail.com>
> ---
> contrib/completion/git-completion.bash | 269 ++++++++++++-------------
> 1 file changed, 134 insertions(+), 135 deletions(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index c16aded36c..63ca8082a4 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1445,6 +1445,140 @@ _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:"
> +
> +# Check for only porcelain (i.e. not git-rev-list) option (not argument)
> +# and selected option argument completions for git-log options and if any
> +# are found put them in COMPREPLY. COMPREPLY must be empty at the start,
> +# and will be empty on return if no candidates are found.
> +__git_complete_log_opts ()
> +{
> + [ -z "$COMPREPLY" ] || return 1 # Precondition
> +
> + 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,141 +2186,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:"
> -
> -
> -# Check for only porcelain (i.e. not git-rev-list) option (not argument)
> -# and selected option argument completions for git-log options and if any
> -# are found put them in COMPREPLY. COMPREPLY must be empty at the start,
> -# and will be empty on return if no candidates are found.
> -__git_complete_log_opts ()
> -{
> - [ -z "$COMPREPLY" ] || return 1 # Precondition
> -
> - 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
> --
> 2.43.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-01-19 7:04 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-02 19:57 [RFC PATCH 0/6] completion: improvements for git-bisect Britton Leo Kerin
2024-01-10 2:03 ` [PATCH v2 0/5] " Britton Leo Kerin
2024-01-18 20:43 ` [PATCH v3 " Britton Leo Kerin
2024-01-18 20:43 ` [PATCH v3 1/5] completion: complete new old actions, start opts Britton Leo Kerin
2024-01-19 7:04 ` Patrick Steinhardt
2024-01-18 20:43 ` [PATCH v3 2/5] completion: git-log opts to bisect visualize Britton Leo Kerin
2024-01-19 7:04 ` Patrick Steinhardt
2024-01-18 20:43 ` [PATCH v3 3/5] completion: move to maintain define-before-use Britton Leo Kerin
2024-01-19 7:04 ` Patrick Steinhardt [this message]
2024-01-18 20:43 ` [PATCH v3 4/5] completion: custom git-bisect terms Britton Leo Kerin
2024-01-19 7:04 ` Patrick Steinhardt
2024-01-18 20:43 ` [PATCH v3 5/5] completion: git-bisect view recognized but not completed Britton Leo Kerin
2024-01-19 7:05 ` Patrick Steinhardt
2024-01-19 7:05 ` [PATCH v3 0/5] completion: improvements for git-bisect Patrick Steinhardt
2024-01-19 18:27 ` Junio C Hamano
2024-01-26 0:23 ` Britton Kerin
2024-01-28 22:34 ` [PATCH v4 0/8] " Britton Leo Kerin
2024-01-28 22:34 ` [PATCH v4 1/8] completion: bisect: complete bad, new, old, and help subcommands Britton Leo Kerin
2024-02-01 9:55 ` Patrick Steinhardt
2024-01-28 22:34 ` [PATCH v4 2/8] completion: bisect: complete custom terms and related options Britton Leo Kerin
2024-02-01 9:55 ` Patrick Steinhardt
2024-01-28 22:34 ` [PATCH v4 3/8] completion: bisect: complete missing --first-parent and --no-checkout options Britton Leo Kerin
2024-01-28 22:34 ` [PATCH v4 4/8] completion: new function __git_complete_log_opts Britton Leo Kerin
2024-01-28 22:34 ` [PATCH v4 5/8] completion: log: use __git_complete_log_opts Britton Leo Kerin
2024-02-01 9:55 ` Patrick Steinhardt
2024-01-28 22:34 ` [PATCH v4 6/8] completion: bisect: complete log opts for visualize subcommand Britton Leo Kerin
2024-01-28 22:34 ` [PATCH v4 7/8] completion: bisect: recognize but do not complete view subcommand Britton Leo Kerin
2024-01-28 22:34 ` [PATCH v4 8/8] completion: add tests for git-bisect Britton Leo Kerin
2024-01-30 5:47 ` Junio C Hamano
2024-02-01 9:55 ` Patrick Steinhardt
2024-02-01 9:55 ` [PATCH v4 0/8] completion: improvements " Patrick Steinhardt
2024-02-06 2:09 ` [PATCH v5 0/7] " Britton Leo Kerin
2024-02-06 2:09 ` [PATCH v5 1/7] completion: tests: always use 'master' for default initial branch name Britton Leo Kerin
2024-02-06 2:09 ` [PATCH v5 2/7] completion: bisect: complete bad, new, old, and help subcommands Britton Leo Kerin
2024-02-06 7:40 ` Patrick Steinhardt
2024-02-06 2:09 ` [PATCH v5 3/7] completion: bisect: complete custom terms and related options Britton Leo Kerin
2024-02-06 7:40 ` Patrick Steinhardt
2024-02-06 2:09 ` [PATCH v5 4/7] completion: bisect: complete missing --first-parent and --no-checkout options Britton Leo Kerin
2024-02-06 2:09 ` [PATCH v5 5/7] completion: new function __git_complete_log_opts Britton Leo Kerin
2024-02-06 7:40 ` Patrick Steinhardt
2024-02-06 2:09 ` [PATCH v5 6/7] completion: bisect: complete log opts for visualize subcommand Britton Leo Kerin
2024-02-06 2:09 ` [PATCH v5 7/7] completion: bisect: recognize but do not complete view subcommand Britton Leo Kerin
2024-02-06 7:40 ` [PATCH v5 0/7] completion: improvements for git-bisect Patrick Steinhardt
2024-02-06 21:50 ` [PATCH v6 " Britton Leo Kerin
2024-02-06 21:50 ` [PATCH v6 1/7] completion: tests: always use 'master' for default initial branch name Britton Leo Kerin
2024-02-06 21:50 ` [PATCH v6 2/7] completion: bisect: complete bad, new, old, and help subcommands Britton Leo Kerin
2024-02-06 21:50 ` [PATCH v6 3/7] completion: bisect: complete custom terms and related options Britton Leo Kerin
2024-02-06 21:50 ` [PATCH v6 4/7] completion: bisect: complete missing --first-parent and --no-checkout options Britton Leo Kerin
2024-02-06 21:50 ` [PATCH v6 5/7] completion: new function __git_complete_log_opts Britton Leo Kerin
2024-02-06 21:50 ` [PATCH v6 6/7] completion: bisect: complete log opts for visualize subcommand Britton Leo Kerin
2024-02-06 21:50 ` [PATCH v6 7/7] completion: bisect: recognize but do not complete view subcommand Britton Leo Kerin
2024-02-06 22:58 ` [PATCH v6 0/7] completion: improvements for git-bisect Junio C Hamano
2024-02-07 5:26 ` Patrick Steinhardt
[not found] ` <20240110020347.673155-1-britton.kerin@gmail.com>
2024-01-10 2:03 ` [PATCH v2 1/5] completion: complete new old actions, start opts Britton Leo Kerin
2024-01-10 2:03 ` [PATCH v2 2/5] completion: git-log opts to bisect visualize Britton Leo Kerin
2024-01-10 2:03 ` [PATCH v2 3/5] completion: move to maintain define-before-use Britton Leo Kerin
2024-01-10 2:03 ` [PATCH v2 4/5] completion: custom git-bisect terms Britton Leo Kerin
2024-01-10 2:03 ` [PATCH v2 5/5] " Britton Leo Kerin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZaofFwDaNrjmbxk_@tanuki \
--to=ps@pks.im \
--cc=britton.kerin@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).