Skip to contentSkip to conversation

completion: add missing 'git log' options

PATCH In review Philippe Blain via GitGitGadget 2 participants 6 messages Jan 21, 2024 – Jan 22, 2024

lore
Share & tools
lore
#0 lore raw

cover completion: add missing 'git log' options

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

Signature · 1 line
gitgitgadget
#1 lore raw

PATCH 1/4 completion: complete missing rev-list options

From: Philippe Blain <[email protected]>

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.

---
 contrib/completion/git-completion.bash | 10 ++++++++++
 1 file changed, 10 insertions(+)
contrib/completion/git-completion.bash +10 -0
index 8c40ade4941..6108d523a11 100644
@@ -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="
Signature · 1 line
gitgitgadget
#2 lore raw

PATCH 2/4 completion: complete --patch-with-raw

In reply to Philippe Blain via GitGitGadget

From: Philippe Blain <[email protected]>

---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +1 -1
index 6108d523a11..ccb17f4ad7b 100644
@@ -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
Signature · 1 line
gitgitgadget
#4 lore raw

PATCH 3/4 completion: complete --encoding

In reply to Philippe Blain via GitGitGadget

From: Philippe Blain <[email protected]>

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

---
 contrib/completion/git-completion.bash | 1 +
 1 file changed, 1 insertion(+)
contrib/completion/git-completion.bash +1 -0
index ccb17f4ad7b..a7ae2cbe55b 100644
@@ -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"
Signature · 1 line
gitgitgadget
#5 lore raw

PATCH 4/4 completion: complete missing 'git log' options

In reply to Philippe Blain via GitGitGadget

From: Philippe Blain <[email protected]>

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

---
 contrib/completion/git-completion.bash | 2 ++
 1 file changed, 2 insertions(+)
contrib/completion/git-completion.bash +2 -0
index a7ae2cbe55b..2f1412d85ea 100644
@@ -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
 			"
Signature · 1 line
gitgitgadget
#3 lore raw

Re: [PATCH 2/4] completion: complete --patch-with-raw

In reply to Philippe Blain via GitGitGadget
Quoted 12 lines · Philippe Blain via GitGitGadget

From: Philippe Blain <[email protected]>

---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/completion/git-completion.bash +0 -0
index 6108d523a11..ccb17f4ad7b 100644

contrib/completion/git-completion.bash __git_diff_common_options="--stat --numstat --shortstat --summary · line 1811

Quoted 6 lines
contrib/completion/git-completion.bash +1 -1
@@ -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.