git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bash completion: refactor diff options
@ 2009-01-11 13:14 Thomas Rast
  2009-01-12  9:16 ` [PATCH next] " Thomas Rast
  2009-01-18  1:03 ` [PATCH next resend] " Thomas Rast
  0 siblings, 2 replies; 8+ messages in thread
From: Thomas Rast @ 2009-01-11 13:14 UTC (permalink / raw)
  To: git; +Cc: Shawn O. Pearce

diff, log and show all take the same diff options.  Refactor them from
__git_diff and __git_log into a variable, and complete them in
__git_show too.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>

---

This conflicts with the --patience series; I can send a version based
on that if it goes in first.


 contrib/completion/git-completion.bash |   38 ++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 7b074d7..5017369 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -759,24 +759,29 @@ _git_describe ()
 	__gitcomp "$(__git_refs)"
 }
 
-_git_diff ()
-{
-	__git_has_doubledash && return
-
-	local cur="${COMP_WORDS[COMP_CWORD]}"
-	case "$cur" in
-	--*)
-		__gitcomp "--cached --stat --numstat --shortstat --summary
+__git_diff_common_options="--stat --numstat --shortstat --summary
 			--patch-with-stat --name-only --name-status --color
 			--no-color --color-words --no-renames --check
 			--full-index --binary --abbrev --diff-filter=
-			--find-copies-harder --pickaxe-all --pickaxe-regex
+			--find-copies-harder
 			--text --ignore-space-at-eol --ignore-space-change
 			--ignore-all-space --exit-code --quiet --ext-diff
 			--no-ext-diff
 			--no-prefix --src-prefix= --dst-prefix=
-			--base --ours --theirs
 			--inter-hunk-context=
+			--raw
+"
+
+_git_diff ()
+{
+	__git_has_doubledash && return
+
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	case "$cur" in
+	--*)
+		__gitcomp "--cached --pickaxe-all --pickaxe-regex
+			--base --ours --theirs
+			$__git_diff_common_options
 			"
 		return
 		;;
@@ -959,16 +964,15 @@ _git_log ()
 			--relative-date --date=
 			--author= --committer= --grep=
 			--all-match
-			--pretty= --name-status --name-only --raw
+			--pretty=
 			--not --all
 			--left-right --cherry-pick
 			--graph
-			--stat --numstat --shortstat
-			--decorate --diff-filter=
-			--color-words --walk-reflogs
+			--decorate
+			--walk-reflogs
 			--parents --children --full-history
 			--merge
-			--inter-hunk-context=
+			$__git_diff_common_options
 			"
 		return
 		;;
@@ -1473,7 +1477,9 @@ _git_show ()
 		return
 		;;
 	--*)
-		__gitcomp "--pretty="
+		__gitcomp "--pretty=
+			$__git_diff_common_options
+			"
 		return
 		;;
 	esac
-- 
tg: (7eb5bbd..) t/bash-complete-show (depends on: origin/master)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-01-20  8:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-11 13:14 [PATCH] bash completion: refactor diff options Thomas Rast
2009-01-12  9:16 ` [PATCH next] " Thomas Rast
2009-01-18  1:03 ` [PATCH next resend] " Thomas Rast
2009-01-18  7:18   ` Junio C Hamano
2009-01-19 17:31     ` Shawn O. Pearce
2009-01-19 21:17       ` [PATCH v2 1/2] bash completion: move pickaxe options to log Thomas Rast
2009-01-19 21:18         ` [PATCH v2 2/2] bash completion: refactor diff options Thomas Rast
2009-01-20  8:36           ` Junio C Hamano

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).