Skip to contentSkip to conversation

git-completion.bash: __git_diff_common_options: add --[no-]patch

PATCH In review Robert Karszniewicz 2 participants 3 messages Oct 6, 2020 – Oct 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 git-completion.bash: __git_diff_common_options: add --[no-]patch

At the same time also deduplicate those options from command completions which use $__git_diff_common_options.

---
 contrib/completion/git-completion.bash | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
contrib/completion/git-completion.bash +2 -3
index 0a96ad87e7..f363554996 100644
@@ -1688,6 +1688,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
 			--submodule --submodule= --ignore-submodules
 			--indent-heuristic --no-indent-heuristic
 			--textconv --no-textconv
+			--patch --no-patch
 "
 
 _git_diff ()
@@ -2031,11 +2032,9 @@ _git_log ()
 			--no-walk --no-walk= --do-walk
 			--parents --children
 			--expand-tabs --expand-tabs= --no-expand-tabs
-			--patch
 			$merge
 			$__git_diff_common_options
 			--pickaxe-all --pickaxe-regex
-			--patch --no-patch
 			"
 		return
 		;;
@@ -2938,7 +2937,7 @@ _git_show ()
 		;;
 	--*)
 		__gitcomp "--pretty= --format= --abbrev-commit --no-abbrev-commit
-			--oneline --show-signature --patch
+			--oneline --show-signature
 			--expand-tabs --expand-tabs= --no-expand-tabs
 			$__git_diff_common_options
 			"
Signature · 1 line
2.28.0
#1 lore raw

PATCH 2/2 git-completion.bash: stash-show: complete $__git_diff_common_options

---
 contrib/completion/git-completion.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
contrib/completion/git-completion.bash +4 -1
index f363554996..83bc64607b 100644
@@ -3020,7 +3020,10 @@ _git_stash ()
 		list,--*)
 			__gitcomp "--name-status --oneline --patch-with-stat"
 			;;
-		show,--*|branch,--*)
+		show,--*)
+			__gitcomp "$__git_diff_common_options"
+			;;
+		branch,--*)
 			;;
 		branch,*)
 			if [ $cword -eq 3 ]; then
Signature · 1 line
2.28.0