# [PATCH 0/4] completion: add missing 'git log' options

6 messages from 2024-01-21 to 2024-01-22. Participants: Philippe Blain via GitGitGadget, Junio C Hamano.
Thread: https://gitlist.dev/t/60777

## Philippe Blain via GitGitGadget, 2024-01-21 04:07

Subject: [PATCH 0/4] completion: add missing 'git log' options
Message-ID: <pull.1650.git.git.1705810071.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/pull.1650.git.git.1705810071.gitgitgadget%40gmail.com

```
I noticed a few 'git log' options (old and newish) were not suggested by the
completion script, so I went through the whole list and added those that
were missing.

Philippe Blain (4):
  completion: complete missing rev-list options
  completion: complete --patch-with-raw
  completion: complete --encoding
  completion: complete missing 'git log' options

 contrib/completion/git-completion.bash | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)


base-commit: e02ecfcc534e2021aae29077a958dd11c3897e4c
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1650%2Fphil-blain%2Fcompletion-log-options-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1650/phil-blain/completion-log-options-v1
Pull-Request: https://github.com/git/git/pull/1650
-- 
gitgitgadget

```

## Philippe Blain via GitGitGadget, 2024-01-21 04:07

Subject: [PATCH 1/4] completion: complete missing rev-list options
Message-ID: <2f72ef0d5f83678de86f4773a547d10e57053300.1705810072.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/2f72ef0d5f83678de86f4773a547d10e57053300.1705810072.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.1650.git.git.1705810071.gitgitgadget@gmail.com>

```
From: Philippe Blain <levraiphilippeblain@gmail.com>

Some options listed in rev-list-options.txt, and thus accepted by 'git
log' and friends, are missing from the Bash completion script.

Add them to __git_log_common_options.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8c40ade4941..6108d523a11 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2071,6 +2071,16 @@ __git_log_common_options="
 	--min-age= --until= --before=
 	--min-parents= --max-parents=
 	--no-min-parents --no-max-parents
+	--alternate-refs --ancestry-path
+	--author-date-order --basic-regexp
+	--bisect --boundary --exclude-first-parent-only
+	--exclude-hidden --extended-regexp
+	--fixed-strings --grep-reflog
+	--ignore-missing --left-only --perl-regexp
+	--reflog --regexp-ignore-case --remove-empty
+	--right-only --show-linear-break
+	--show-notes-by-default --show-pulls
+	--since-as-filter --single-worktree
 "
 # Options that go well for log and gitk (not shortlog)
 __git_log_gitk_options="
-- 
gitgitgadget


```

## Philippe Blain via GitGitGadget, 2024-01-21 04:07

Subject: [PATCH 2/4] completion: complete --patch-with-raw
Message-ID: <1debe2fe18eec7f431f355241117afb0a5e2bf5f.1705810072.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/1debe2fe18eec7f431f355241117afb0a5e2bf5f.1705810072.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.1650.git.git.1705810071.gitgitgadget@gmail.com>

```
From: Philippe Blain <levraiphilippeblain@gmail.com>

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6108d523a11..ccb17f4ad7b 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1807,7 +1807,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--output= --output-indicator-context=
 			--output-indicator-new= --output-indicator-old=
 			--ws-error-highlight=
-			--pickaxe-all --pickaxe-regex
+			--pickaxe-all --pickaxe-regex --patch-with-raw
 "
 
 # Options for diff/difftool
-- 
gitgitgadget


```

## Philippe Blain via GitGitGadget, 2024-01-21 04:07

Subject: [PATCH 3/4] completion: complete --encoding
Message-ID: <faa601ecb92b301d5730474efd11fba27d6a5cc7.1705810072.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/faa601ecb92b301d5730474efd11fba27d6a5cc7.1705810072.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.1650.git.git.1705810071.gitgitgadget@gmail.com>

```
From: Philippe Blain <levraiphilippeblain@gmail.com>

The option --encoding is supported by 'git log' and 'git show', so add
it to __git_log_show_options.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 1 +
 1 file changed, 1 insertion(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ccb17f4ad7b..a7ae2cbe55b 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2096,6 +2096,7 @@ __git_log_shortlog_options="
 # Options accepted by log and show
 __git_log_show_options="
 	--diff-merges --diff-merges= --no-diff-merges --dd --remerge-diff
+	--encoding=
 "
 
 __git_diff_merges_opts="off none on first-parent 1 separate m combined c dense-combined cc remerge r"
-- 
gitgitgadget


```

## Philippe Blain via GitGitGadget, 2024-01-21 04:07

Subject: [PATCH 4/4] completion: complete missing 'git log' options
Message-ID: <9991dd4bfa6747dccc12c8a5d9fe8d6ed95fdb52.1705810072.git.gitgitgadget@gmail.com>
URL: https://gitlist.dev/e/9991dd4bfa6747dccc12c8a5d9fe8d6ed95fdb52.1705810072.git.gitgitgadget%40gmail.com
In-Reply-To: <pull.1650.git.git.1705810071.gitgitgadget@gmail.com>

```
From: Philippe Blain <levraiphilippeblain@gmail.com>

Some options specific to 'git log' are missing from the Bash completion
script. Add them to _git_log.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 contrib/completion/git-completion.bash | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a7ae2cbe55b..2f1412d85ea 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2180,6 +2180,8 @@ _git_log ()
 			--no-walk --no-walk= --do-walk
 			--parents --children
 			--expand-tabs --expand-tabs= --no-expand-tabs
+			--clear-decorations --decorate-refs=
+			--decorate-refs-exclude=
 			$merge
 			$__git_diff_common_options
 			"
-- 
gitgitgadget

```

## Junio C Hamano, 2024-01-22 16:09

Subject: Re: [PATCH 2/4] completion: complete --patch-with-raw
Message-ID: <xmqqo7ddcptt.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqo7ddcptt.fsf%40gitster.g
In-Reply-To: <1debe2fe18eec7f431f355241117afb0a5e2bf5f.1705810072.git.gitgitgadget@gmail.com>

```
"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
> ---
>  contrib/completion/git-completion.bash | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 6108d523a11..ccb17f4ad7b 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1807,7 +1807,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
>  			--output= --output-indicator-context=
>  			--output-indicator-new= --output-indicator-old=
>  			--ws-error-highlight=
> -			--pickaxe-all --pickaxe-regex
> +			--pickaxe-all --pickaxe-regex --patch-with-raw
>  "

Its ancient company, --patch-with-stat, is listed there, so it is
not all that wrong to include it as a suggestion, I guess.

But in the longer term, I think we would want to slim "git diff -h"
output by hiding them (no reason to touch code to remove the
support) from the "common diff options" part.  They were added as a
kludge before I realized we need more than these two combinations
and made the options --patch, --stat, and --raw cumulative.

Thanks.

```
